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
|
||||
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
|
||||
|
19
bin/Makefile
19
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
|
||||
|
@ -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
|
||||
|
||||
|
@ -2,6 +2,5 @@ TOPDIR = ../..
|
||||
include $(TOPDIR)/vars.mk
|
||||
|
||||
BIN = xbps-cmpver
|
||||
MAN = # empty
|
||||
|
||||
include $(TOPDIR)/prog.mk
|
||||
|
@ -2,6 +2,5 @@ TOPDIR = ../..
|
||||
include $(TOPDIR)/vars.mk
|
||||
|
||||
BIN = xbps-digest
|
||||
MAN = # empty
|
||||
|
||||
include $(TOPDIR)/prog.mk
|
||||
|
@ -2,6 +2,5 @@ TOPDIR = ../..
|
||||
include $(TOPDIR)/vars.mk
|
||||
|
||||
BIN = xbps-fetch
|
||||
MAN = # empty
|
||||
|
||||
include $(TOPDIR)/prog.mk
|
||||
|
@ -2,6 +2,5 @@ TOPDIR = ../..
|
||||
include $(TOPDIR)/vars.mk
|
||||
|
||||
BIN = xbps-pkgdb
|
||||
MAN = # empty
|
||||
|
||||
include $(TOPDIR)/prog.mk
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
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
|
||||
|
||||
.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
|
||||
|
@ -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:
|
||||
|
34
prog.mk
34
prog.mk
@ -1,26 +1,25 @@
|
||||
OBJS ?= main.o
|
||||
MAN ?= $(BIN).8
|
||||
|
||||
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
|
||||
|
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 += -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
|
||||
|
Loading…
Reference in New Issue
Block a user