Improve make output similar to what recent GNU configure scripts do.
Also always build the static bins so that it's done in one pass, that means that objects are PIC and built with SSP. --HG-- extra : convert_revision : xtraeme%40gmail.com-20091119050337-hkdksjqxy9n7vy7m
This commit is contained in:
parent
9e062cec4f
commit
db9ae90dd4
16
Makefile
16
Makefile
@ -4,14 +4,14 @@ SUBDIRS = lib bin
|
|||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all:
|
all:
|
||||||
for dir in $(SUBDIRS); do \
|
@for dir in $(SUBDIRS); do \
|
||||||
$(MAKE) -C $$dir; \
|
$(MAKE) -C $$dir || exit 1; \
|
||||||
done
|
done
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install:
|
install:
|
||||||
for dir in $(SUBDIRS); do \
|
@for dir in $(SUBDIRS); do \
|
||||||
$(MAKE) -C $$dir install; \
|
$(MAKE) -C $$dir install || exit 1; \
|
||||||
done
|
done
|
||||||
@echo
|
@echo
|
||||||
@echo "Binaries have been installed into $(SBINDIR)."
|
@echo "Binaries have been installed into $(SBINDIR)."
|
||||||
@ -22,12 +22,12 @@ install:
|
|||||||
|
|
||||||
.PHONY: uninstall
|
.PHONY: uninstall
|
||||||
uninstall:
|
uninstall:
|
||||||
for dir in $(SUBDIRS); do \
|
@for dir in $(SUBDIRS); do \
|
||||||
$(MAKE) -C $$dir uninstall; \
|
$(MAKE) -C $$dir uninstall || exit 1; \
|
||||||
done
|
done
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
for dir in $(SUBDIRS); do \
|
@for dir in $(SUBDIRS); do \
|
||||||
$(MAKE) -C $$dir clean; \
|
$(MAKE) -C $$dir clean || exit 1; \
|
||||||
done
|
done
|
||||||
|
19
bin/Makefile
19
bin/Makefile
@ -1,33 +1,32 @@
|
|||||||
include ../vars.mk
|
include ../vars.mk
|
||||||
|
|
||||||
SUBDIRS = xbps-bin
|
SUBDIRS = xbps-cmpver
|
||||||
SUBDIRS += xbps-cmpver
|
|
||||||
SUBDIRS += xbps-digest
|
SUBDIRS += xbps-digest
|
||||||
SUBDIRS += xbps-fetch
|
SUBDIRS += xbps-fetch
|
||||||
SUBDIRS += xbps-pkgdb
|
SUBDIRS += xbps-pkgdb
|
||||||
SUBDIRS += xbps-repo
|
SUBDIRS += xbps-repo
|
||||||
SUBDIRS += xbps-fetch
|
SUBDIRS += xbps-bin
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all:
|
all:
|
||||||
for dir in $(SUBDIRS); do \
|
@for dir in $(SUBDIRS); do \
|
||||||
$(MAKE) -C $$dir; \
|
$(MAKE) -C $$dir || exit 1; \
|
||||||
done
|
done
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install:
|
install:
|
||||||
for dir in $(SUBDIRS); do \
|
@for dir in $(SUBDIRS); do \
|
||||||
$(MAKE) -C $$dir install; \
|
$(MAKE) -C $$dir install || exit 1; \
|
||||||
done
|
done
|
||||||
|
|
||||||
.PHONY: uninstall
|
.PHONY: uninstall
|
||||||
uninstall:
|
uninstall:
|
||||||
for bin in $(SUBDIRS); do \
|
@for bin in $(SUBDIRS); do \
|
||||||
-rm -f $(SBINDIR)/$$bin; \
|
-rm -f $(SBINDIR)/$$bin; \
|
||||||
done
|
done
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
for dir in $(SUBDIRS); do \
|
@for dir in $(SUBDIRS); do \
|
||||||
$(MAKE) -C $$dir clean; \
|
$(MAKE) -C $$dir clean || exit 1; \
|
||||||
done
|
done
|
||||||
|
@ -3,6 +3,7 @@ include $(TOPDIR)/vars.mk
|
|||||||
|
|
||||||
BIN = xbps-bin
|
BIN = xbps-bin
|
||||||
OBJS = check.o install.o main.o remove.o show-deps.o ../xbps-repo/util.o
|
OBJS = check.o install.o main.o remove.o show-deps.o ../xbps-repo/util.o
|
||||||
|
MAN = $(BIN).8
|
||||||
|
|
||||||
include $(TOPDIR)/prog.mk
|
include $(TOPDIR)/prog.mk
|
||||||
|
|
||||||
|
@ -2,6 +2,5 @@ TOPDIR = ../..
|
|||||||
include $(TOPDIR)/vars.mk
|
include $(TOPDIR)/vars.mk
|
||||||
|
|
||||||
BIN = xbps-cmpver
|
BIN = xbps-cmpver
|
||||||
MAN = # empty
|
|
||||||
|
|
||||||
include $(TOPDIR)/prog.mk
|
include $(TOPDIR)/prog.mk
|
||||||
|
@ -2,6 +2,5 @@ TOPDIR = ../..
|
|||||||
include $(TOPDIR)/vars.mk
|
include $(TOPDIR)/vars.mk
|
||||||
|
|
||||||
BIN = xbps-digest
|
BIN = xbps-digest
|
||||||
MAN = # empty
|
|
||||||
|
|
||||||
include $(TOPDIR)/prog.mk
|
include $(TOPDIR)/prog.mk
|
||||||
|
@ -2,6 +2,5 @@ TOPDIR = ../..
|
|||||||
include $(TOPDIR)/vars.mk
|
include $(TOPDIR)/vars.mk
|
||||||
|
|
||||||
BIN = xbps-fetch
|
BIN = xbps-fetch
|
||||||
MAN = # empty
|
|
||||||
|
|
||||||
include $(TOPDIR)/prog.mk
|
include $(TOPDIR)/prog.mk
|
||||||
|
@ -2,6 +2,5 @@ TOPDIR = ../..
|
|||||||
include $(TOPDIR)/vars.mk
|
include $(TOPDIR)/vars.mk
|
||||||
|
|
||||||
BIN = xbps-pkgdb
|
BIN = xbps-pkgdb
|
||||||
MAN = # empty
|
|
||||||
|
|
||||||
include $(TOPDIR)/prog.mk
|
include $(TOPDIR)/prog.mk
|
||||||
|
@ -3,5 +3,6 @@ include $(TOPDIR)/vars.mk
|
|||||||
|
|
||||||
BIN = xbps-repo
|
BIN = xbps-repo
|
||||||
OBJS = main.o util.o index.o
|
OBJS = main.o util.o index.o
|
||||||
|
MAN = $(BIN).8
|
||||||
|
|
||||||
include $(TOPDIR)/prog.mk
|
include $(TOPDIR)/prog.mk
|
||||||
|
@ -33,9 +33,7 @@ To build the xbps utils, you'll need for both shared and dynamic:
|
|||||||
* proplib (devel pkg)
|
* proplib (devel pkg)
|
||||||
* openssl (devel pkg)
|
* openssl (devel pkg)
|
||||||
|
|
||||||
If you only want to build the static binaries, you can pass STATIC=1
|
And the following packages as well to build the static binaries:
|
||||||
to the make command. You'll need development packages for the ones
|
|
||||||
mentioned above as well as the following:
|
|
||||||
|
|
||||||
* attr (devel pkg with static lib)
|
* attr (devel pkg with static lib)
|
||||||
* acl (devel pkg with static lib)
|
* acl (devel pkg with static lib)
|
||||||
|
27
lib/Makefile
27
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
|
OBJS += sync_remote_pkgidx.o unpack.o util.o pkgmatch.o
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
ifdef STATIC
|
|
||||||
all: libfetch libxbps.a
|
|
||||||
else
|
|
||||||
all: libfetch libxbps.so libxbps.a
|
all: libfetch libxbps.so libxbps.a
|
||||||
endif
|
|
||||||
|
|
||||||
libfetch:
|
libfetch:
|
||||||
$(MAKE) -C fetch
|
@$(MAKE) -C fetch
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(CC) $(CPPFLAGS) $(SHAREDLIB_CFLAGS) $(CFLAGS) \
|
@echo " [CC] $@"
|
||||||
|
@$(CC) $(CPPFLAGS) $(SHAREDLIB_CFLAGS) $(CFLAGS) \
|
||||||
$(LDFLAGS) $(STATIC_LIBS) -c $<
|
$(LDFLAGS) $(STATIC_LIBS) -c $<
|
||||||
|
|
||||||
libxbps.so: $(OBJS) $(LIBFETCH_OBJS)
|
libxbps.so: $(OBJS) $(LIBFETCH_OBJS)
|
||||||
$(CC) $(LDFLAGS) $(SHAREDLIB_LDFLAGS) $^ -o $(LIBXBPS_SHLIB)
|
@echo " [CCLD] $@"
|
||||||
-ln -sf $(LIBXBPS_SHLIB) libxbps.so.$(LIBMAJOR)
|
@$(CC) $(LDFLAGS) $(SHAREDLIB_LDFLAGS) $^ -o $(LIBXBPS_SHLIB)
|
||||||
-ln -sf $(LIBXBPS_SHLIB) libxbps.so
|
@-ln -sf $(LIBXBPS_SHLIB) libxbps.so.$(LIBMAJOR)
|
||||||
|
@-ln -sf $(LIBXBPS_SHLIB) libxbps.so
|
||||||
|
|
||||||
libxbps.a: $(OBJS) $(LIBFETCH_OBJS)
|
libxbps.a: $(OBJS) $(LIBFETCH_OBJS)
|
||||||
$(AR) rcs $@ $^
|
@echo " [AR] $@"
|
||||||
ranlib $@
|
@$(AR) rcs $@ $^
|
||||||
|
@echo " [RANLIB] $@"
|
||||||
|
@ranlib $@
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: all
|
install: all
|
||||||
install -d $(LIBDIR)
|
install -d $(LIBDIR)
|
||||||
ifdef STATIC
|
|
||||||
install -m 644 libxbps.a $(LIBDIR)
|
install -m 644 libxbps.a $(LIBDIR)
|
||||||
else
|
|
||||||
install -m 644 $(LIBXBPS_SHLIB) $(LIBDIR)
|
install -m 644 $(LIBXBPS_SHLIB) $(LIBDIR)
|
||||||
cp -a libxbps.so $(LIBDIR)
|
cp -a libxbps.so $(LIBDIR)
|
||||||
cp -a libxbps.so.$(LIBMAJOR) $(LIBDIR)
|
cp -a libxbps.so.$(LIBMAJOR) $(LIBDIR)
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: uninstall
|
.PHONY: uninstall
|
||||||
uninstall:
|
uninstall:
|
||||||
@ -60,4 +57,4 @@ uninstall:
|
|||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
-rm -f libxbps* $(OBJS)
|
-rm -f libxbps* $(OBJS)
|
||||||
$(MAKE) -C fetch clean
|
@$(MAKE) -C fetch clean
|
||||||
|
@ -20,14 +20,17 @@ GEN = ftperr.h httperr.h
|
|||||||
all: $(INCS) $(GEN) $(OBJS)
|
all: $(INCS) $(GEN) $(OBJS)
|
||||||
|
|
||||||
%.o: %.c $(INCS) $(GEN)
|
%.o: %.c $(INCS) $(GEN)
|
||||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \
|
@echo " [CC] $@"
|
||||||
|
@$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \
|
||||||
$(SHAREDLIB_CFLAGS) -c $<
|
$(SHAREDLIB_CFLAGS) -c $<
|
||||||
|
|
||||||
ftperr.h: ftp.errors
|
ftperr.h: ftp.errors
|
||||||
./errlist.sh ftp_errlist FTP ftp.errors > $@
|
@echo " [GEN] $@"
|
||||||
|
@./errlist.sh ftp_errlist FTP ftp.errors > $@
|
||||||
|
|
||||||
httperr.h: http.errors
|
httperr.h: http.errors
|
||||||
./errlist.sh http_errlist HTTP http.errors > $@
|
@echo " [GEN] $@"
|
||||||
|
@./errlist.sh http_errlist HTTP http.errors > $@
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
|
34
prog.mk
34
prog.mk
@ -1,26 +1,25 @@
|
|||||||
OBJS ?= main.o
|
OBJS ?= main.o
|
||||||
MAN ?= $(BIN).8
|
|
||||||
|
|
||||||
LDFLAGS += -lxbps
|
LDFLAGS += -lxbps
|
||||||
|
|
||||||
ifdef STATIC
|
%.o: %.c
|
||||||
all: $(BIN).static
|
@echo " [CC] $@"
|
||||||
MAN =
|
@$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(STATIC_LIBS) -c $<
|
||||||
else
|
|
||||||
all: $(BIN) $(MAN)
|
|
||||||
endif
|
|
||||||
|
|
||||||
.PHONY: all
|
|
||||||
|
|
||||||
$(MAN):
|
$(MAN):
|
||||||
a2x -f manpage $(MAN).txt
|
@echo " [ASCIIDOC] $(MAN)"
|
||||||
|
@a2x -f manpage $(MAN).txt
|
||||||
|
|
||||||
$(BIN).static: $(OBJS)
|
$(BIN).static: $(OBJS)
|
||||||
$(CC) $^ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \
|
@echo " [CCLD] $@"
|
||||||
$(STATIC_LIBS) -o $@
|
@$(CC) -static $^ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \
|
||||||
|
$(STATIC_LIBS) -o $@ >/dev/null 2>&1
|
||||||
|
|
||||||
$(BIN): $(OBJS)
|
$(BIN): $(OBJS)
|
||||||
$(CC) $^ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
@echo " [CCLD] $@"
|
||||||
|
@$(CC) $^ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
all: $(BIN) $(BIN).static $(MAN)
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
@ -31,11 +30,8 @@ clean:
|
|||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: all
|
install: all
|
||||||
install -d $(SBINDIR)
|
install -d $(SBINDIR)
|
||||||
ifndef STATIC
|
|
||||||
install $(INSTALL_STRIPPED) -m 755 $(BIN) $(SBINDIR)
|
install $(INSTALL_STRIPPED) -m 755 $(BIN) $(SBINDIR)
|
||||||
else
|
|
||||||
install $(INSTALL_STRIPPED) -m 755 $(BIN).static $(SBINDIR)
|
install $(INSTALL_STRIPPED) -m 755 $(BIN).static $(SBINDIR)
|
||||||
endif
|
|
||||||
ifdef MAN
|
ifdef MAN
|
||||||
install -d $(MANDIR)
|
install -d $(MANDIR)
|
||||||
install -m 644 $(MAN) $(MANDIR)
|
install -m 644 $(MAN) $(MANDIR)
|
||||||
@ -45,3 +41,7 @@ endif
|
|||||||
uninstall:
|
uninstall:
|
||||||
-rm -f $(SBINDIR)/$(BIN)
|
-rm -f $(SBINDIR)/$(BIN)
|
||||||
-rm -f $(SBINDIR)/$(BIN).static
|
-rm -f $(SBINDIR)/$(BIN).static
|
||||||
|
|
||||||
|
ifdef MAN
|
||||||
|
-rm -f $(MANDIR)/$(MAN)
|
||||||
|
endif
|
||||||
|
8
vars.mk
8
vars.mk
@ -23,12 +23,8 @@ SHAREDLIB_CFLAGS = -fvisibility=hidden
|
|||||||
WARNFLAGS ?= -pedantic -std=c99 -Wall -Wextra -Werror -Wshadow -Wformat=2
|
WARNFLAGS ?= -pedantic -std=c99 -Wall -Wextra -Werror -Wshadow -Wformat=2
|
||||||
WARNFLAGS += -Wmissing-declarations -Wcomment -Wunused-macros -Wendif-labels
|
WARNFLAGS += -Wmissing-declarations -Wcomment -Wunused-macros -Wendif-labels
|
||||||
WARNFLAGS += -Wcast-qual -Wcast-align -Wstack-protector
|
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
|
# Grr, hate the static libs!
|
||||||
CFLAGS += -static
|
|
||||||
STATIC_LIBS = -lprop -lpthread -larchive -lssl -lcrypto -ldl -lacl \
|
STATIC_LIBS = -lprop -lpthread -larchive -lssl -lcrypto -ldl -lacl \
|
||||||
-lattr -lcrypto -llzma -lbz2 -lz
|
-lattr -lcrypto -llzma -lbz2 -lz
|
||||||
else
|
|
||||||
CFLAGS += -fPIC -DPIC
|
|
||||||
endif
|
|
||||||
|
Loading…
Reference in New Issue
Block a user