diff --git a/Makefile b/Makefile index 483b8784..e1836e58 100644 --- a/Makefile +++ b/Makefile @@ -4,14 +4,14 @@ SUBDIRS = lib bin .PHONY: all all: - for dir in $(SUBDIRS); do \ - $(MAKE) -C $$dir; \ + @for dir in $(SUBDIRS); do \ + $(MAKE) -C $$dir || exit 1; \ done .PHONY: install install: - for dir in $(SUBDIRS); do \ - $(MAKE) -C $$dir install; \ + @for dir in $(SUBDIRS); do \ + $(MAKE) -C $$dir install || exit 1; \ done @echo @echo "Binaries have been installed into $(SBINDIR)." @@ -22,12 +22,12 @@ install: .PHONY: uninstall uninstall: - for dir in $(SUBDIRS); do \ - $(MAKE) -C $$dir uninstall; \ + @for dir in $(SUBDIRS); do \ + $(MAKE) -C $$dir uninstall || exit 1; \ done .PHONY: clean clean: - for dir in $(SUBDIRS); do \ - $(MAKE) -C $$dir clean; \ + @for dir in $(SUBDIRS); do \ + $(MAKE) -C $$dir clean || exit 1; \ done diff --git a/bin/Makefile b/bin/Makefile index 835b75ac..d0ca2feb 100644 --- a/bin/Makefile +++ b/bin/Makefile @@ -1,33 +1,32 @@ include ../vars.mk -SUBDIRS = xbps-bin -SUBDIRS += xbps-cmpver +SUBDIRS = xbps-cmpver SUBDIRS += xbps-digest SUBDIRS += xbps-fetch SUBDIRS += xbps-pkgdb SUBDIRS += xbps-repo -SUBDIRS += xbps-fetch +SUBDIRS += xbps-bin .PHONY: all all: - for dir in $(SUBDIRS); do \ - $(MAKE) -C $$dir; \ + @for dir in $(SUBDIRS); do \ + $(MAKE) -C $$dir || exit 1; \ done .PHONY: install install: - for dir in $(SUBDIRS); do \ - $(MAKE) -C $$dir install; \ + @for dir in $(SUBDIRS); do \ + $(MAKE) -C $$dir install || exit 1; \ done .PHONY: uninstall uninstall: - for bin in $(SUBDIRS); do \ + @for bin in $(SUBDIRS); do \ -rm -f $(SBINDIR)/$$bin; \ done .PHONY: clean clean: - for dir in $(SUBDIRS); do \ - $(MAKE) -C $$dir clean; \ + @for dir in $(SUBDIRS); do \ + $(MAKE) -C $$dir clean || exit 1; \ done diff --git a/bin/xbps-bin/Makefile b/bin/xbps-bin/Makefile index d49ca900..3a3ffe99 100644 --- a/bin/xbps-bin/Makefile +++ b/bin/xbps-bin/Makefile @@ -3,6 +3,7 @@ include $(TOPDIR)/vars.mk BIN = xbps-bin OBJS = check.o install.o main.o remove.o show-deps.o ../xbps-repo/util.o +MAN = $(BIN).8 include $(TOPDIR)/prog.mk diff --git a/bin/xbps-cmpver/Makefile b/bin/xbps-cmpver/Makefile index 975331cb..93817347 100644 --- a/bin/xbps-cmpver/Makefile +++ b/bin/xbps-cmpver/Makefile @@ -2,6 +2,5 @@ TOPDIR = ../.. include $(TOPDIR)/vars.mk BIN = xbps-cmpver -MAN = # empty include $(TOPDIR)/prog.mk diff --git a/bin/xbps-digest/Makefile b/bin/xbps-digest/Makefile index 9fac7f2d..0529461c 100644 --- a/bin/xbps-digest/Makefile +++ b/bin/xbps-digest/Makefile @@ -2,6 +2,5 @@ TOPDIR = ../.. include $(TOPDIR)/vars.mk BIN = xbps-digest -MAN = # empty include $(TOPDIR)/prog.mk diff --git a/bin/xbps-fetch/Makefile b/bin/xbps-fetch/Makefile index 551ada7e..890d2c86 100644 --- a/bin/xbps-fetch/Makefile +++ b/bin/xbps-fetch/Makefile @@ -2,6 +2,5 @@ TOPDIR = ../.. include $(TOPDIR)/vars.mk BIN = xbps-fetch -MAN = # empty include $(TOPDIR)/prog.mk diff --git a/bin/xbps-pkgdb/Makefile b/bin/xbps-pkgdb/Makefile index a3af8da2..3c3b00b0 100644 --- a/bin/xbps-pkgdb/Makefile +++ b/bin/xbps-pkgdb/Makefile @@ -2,6 +2,5 @@ TOPDIR = ../.. include $(TOPDIR)/vars.mk BIN = xbps-pkgdb -MAN = # empty include $(TOPDIR)/prog.mk diff --git a/bin/xbps-repo/Makefile b/bin/xbps-repo/Makefile index c5e315cd..0ccfbf35 100644 --- a/bin/xbps-repo/Makefile +++ b/bin/xbps-repo/Makefile @@ -3,5 +3,6 @@ include $(TOPDIR)/vars.mk BIN = xbps-repo OBJS = main.o util.o index.o +MAN = $(BIN).8 include $(TOPDIR)/prog.mk diff --git a/doc/README b/doc/README index 74b0e12b..a725ef3b 100644 --- a/doc/README +++ b/doc/README @@ -33,9 +33,7 @@ To build the xbps utils, you'll need for both shared and dynamic: * proplib (devel pkg) * openssl (devel pkg) -If you only want to build the static binaries, you can pass STATIC=1 -to the make command. You'll need development packages for the ones -mentioned above as well as the following: +And the following packages as well to build the static binaries: * attr (devel pkg with static lib) * acl (devel pkg with static lib) diff --git a/lib/Makefile b/lib/Makefile index fdbea4b2..16d82f96 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -20,38 +20,35 @@ OBJS += repository.o requiredby.o sha256.o sortdeps.o state.o OBJS += sync_remote_pkgidx.o unpack.o util.o pkgmatch.o .PHONY: all -ifdef STATIC -all: libfetch libxbps.a -else all: libfetch libxbps.so libxbps.a -endif libfetch: - $(MAKE) -C fetch + @$(MAKE) -C fetch %.o: %.c - $(CC) $(CPPFLAGS) $(SHAREDLIB_CFLAGS) $(CFLAGS) \ + @echo " [CC] $@" + @$(CC) $(CPPFLAGS) $(SHAREDLIB_CFLAGS) $(CFLAGS) \ $(LDFLAGS) $(STATIC_LIBS) -c $< libxbps.so: $(OBJS) $(LIBFETCH_OBJS) - $(CC) $(LDFLAGS) $(SHAREDLIB_LDFLAGS) $^ -o $(LIBXBPS_SHLIB) - -ln -sf $(LIBXBPS_SHLIB) libxbps.so.$(LIBMAJOR) - -ln -sf $(LIBXBPS_SHLIB) libxbps.so + @echo " [CCLD] $@" + @$(CC) $(LDFLAGS) $(SHAREDLIB_LDFLAGS) $^ -o $(LIBXBPS_SHLIB) + @-ln -sf $(LIBXBPS_SHLIB) libxbps.so.$(LIBMAJOR) + @-ln -sf $(LIBXBPS_SHLIB) libxbps.so libxbps.a: $(OBJS) $(LIBFETCH_OBJS) - $(AR) rcs $@ $^ - ranlib $@ + @echo " [AR] $@" + @$(AR) rcs $@ $^ + @echo " [RANLIB] $@" + @ranlib $@ .PHONY: install install: all install -d $(LIBDIR) -ifdef STATIC install -m 644 libxbps.a $(LIBDIR) -else install -m 644 $(LIBXBPS_SHLIB) $(LIBDIR) cp -a libxbps.so $(LIBDIR) cp -a libxbps.so.$(LIBMAJOR) $(LIBDIR) -endif .PHONY: uninstall uninstall: @@ -60,4 +57,4 @@ uninstall: .PHONY: clean clean: -rm -f libxbps* $(OBJS) - $(MAKE) -C fetch clean + @$(MAKE) -C fetch clean diff --git a/lib/fetch/Makefile b/lib/fetch/Makefile index 32c94f10..694c24c7 100644 --- a/lib/fetch/Makefile +++ b/lib/fetch/Makefile @@ -20,14 +20,17 @@ GEN = ftperr.h httperr.h all: $(INCS) $(GEN) $(OBJS) %.o: %.c $(INCS) $(GEN) - $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \ + @echo " [CC] $@" + @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \ $(SHAREDLIB_CFLAGS) -c $< ftperr.h: ftp.errors - ./errlist.sh ftp_errlist FTP ftp.errors > $@ + @echo " [GEN] $@" + @./errlist.sh ftp_errlist FTP ftp.errors > $@ httperr.h: http.errors - ./errlist.sh http_errlist HTTP http.errors > $@ + @echo " [GEN] $@" + @./errlist.sh http_errlist HTTP http.errors > $@ .PHONY: clean clean: diff --git a/prog.mk b/prog.mk index ddd80c4f..243c1562 100644 --- a/prog.mk +++ b/prog.mk @@ -1,26 +1,25 @@ -OBJS ?= main.o -MAN ?= $(BIN).8 +OBJS ?= main.o +LDFLAGS += -lxbps -LDFLAGS += -lxbps - -ifdef STATIC -all: $(BIN).static -MAN = -else -all: $(BIN) $(MAN) -endif - -.PHONY: all +%.o: %.c + @echo " [CC] $@" + @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(STATIC_LIBS) -c $< $(MAN): - a2x -f manpage $(MAN).txt + @echo " [ASCIIDOC] $(MAN)" + @a2x -f manpage $(MAN).txt $(BIN).static: $(OBJS) - $(CC) $^ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \ - $(STATIC_LIBS) -o $@ + @echo " [CCLD] $@" + @$(CC) -static $^ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \ + $(STATIC_LIBS) -o $@ >/dev/null 2>&1 $(BIN): $(OBJS) - $(CC) $^ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ + @echo " [CCLD] $@" + @$(CC) $^ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ + +.PHONY: all +all: $(BIN) $(BIN).static $(MAN) .PHONY: clean clean: @@ -31,11 +30,8 @@ clean: .PHONY: install install: all install -d $(SBINDIR) -ifndef STATIC install $(INSTALL_STRIPPED) -m 755 $(BIN) $(SBINDIR) -else install $(INSTALL_STRIPPED) -m 755 $(BIN).static $(SBINDIR) -endif ifdef MAN install -d $(MANDIR) install -m 644 $(MAN) $(MANDIR) @@ -45,3 +41,7 @@ endif uninstall: -rm -f $(SBINDIR)/$(BIN) -rm -f $(SBINDIR)/$(BIN).static + +ifdef MAN + -rm -f $(MANDIR)/$(MAN) +endif diff --git a/vars.mk b/vars.mk index 0b41ec4c..369ca9c6 100644 --- a/vars.mk +++ b/vars.mk @@ -23,12 +23,8 @@ SHAREDLIB_CFLAGS = -fvisibility=hidden WARNFLAGS ?= -pedantic -std=c99 -Wall -Wextra -Werror -Wshadow -Wformat=2 WARNFLAGS += -Wmissing-declarations -Wcomment -Wunused-macros -Wendif-labels WARNFLAGS += -Wcast-qual -Wcast-align -Wstack-protector -CFLAGS = $(DEBUG_FLAGS) $(WARNFLAGS) -fstack-protector-all +CFLAGS += $(DEBUG_FLAGS) $(WARNFLAGS) -fPIC -DPIC -fstack-protector-all -ifdef STATIC -CFLAGS += -static +# Grr, hate the static libs! STATIC_LIBS = -lprop -lpthread -larchive -lssl -lcrypto -ldl -lacl \ -lattr -lcrypto -llzma -lbz2 -lz -else -CFLAGS += -fPIC -DPIC -endif