Rework Makefiles one more time.
- use printf to print commands rather than echo, which it may not have support for escape sequences (-e). - Remove DESTDIR from SBINDIR, MANDIR, LIBDIR and INCLUDEDIR so that you can override it. --HG-- extra : convert_revision : xtraeme%40gmail.com-20100124125958-8mscedj5ntf288jd
This commit is contained in:
parent
f613e8e49d
commit
a0b5e9e83a
4
Makefile
4
Makefile
@ -18,8 +18,8 @@ install:
|
|||||||
$(MAKE) -C $$dir install || exit 1; \
|
$(MAKE) -C $$dir install || exit 1; \
|
||||||
done
|
done
|
||||||
@echo
|
@echo
|
||||||
@echo "Binaries have been installed into $(SBINDIR)."
|
@echo "Binaries have been installed into $(DESTDIR)$(SBINDIR)."
|
||||||
@echo "Librares have been installed into $(LIBDIR)."
|
@echo "Librares have been installed into $(DESTDIR)$(LIBDIR)."
|
||||||
@echo
|
@echo
|
||||||
@echo "WARNING: Don't forget to rerun ldconfig(1)."
|
@echo "WARNING: Don't forget to rerun ldconfig(1)."
|
||||||
@echo
|
@echo
|
||||||
|
@ -7,12 +7,12 @@ all:
|
|||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install:
|
install:
|
||||||
install -d $(INCLUDEDIR)
|
install -d $(DESTDIR)$(INCLUDEDIR)
|
||||||
install -m 644 $(INCS) $(INCLUDEDIR)
|
install -m 644 $(INCS) $(DESTDIR)$(INCLUDEDIR)
|
||||||
|
|
||||||
.PHONY: uninstall
|
.PHONY: uninstall
|
||||||
uninstall:
|
uninstall:
|
||||||
-rm -f $(INCLUDEDIR)/$(INCS)
|
-rm -f $(DESTDIR)$(INCLUDEDIR)/$(INCS)
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
|
26
lib/Makefile
26
lib/Makefile
@ -28,45 +28,45 @@ OBJS += sortdeps.o state.o unpack.o util.o pkgmatch.o mkpath.o
|
|||||||
all: libxbps.so libxbps.a
|
all: libxbps.so libxbps.a
|
||||||
|
|
||||||
fetch/ftperr.h: fetch/ftp.errors
|
fetch/ftperr.h: fetch/ftp.errors
|
||||||
@echo " [GEN]\t\t$@"
|
@printf " [GEN]\t\t$@\n"
|
||||||
@./fetch/errlist.sh ftp_errlist FTP $< > $@
|
@./fetch/errlist.sh ftp_errlist FTP $< > $@
|
||||||
|
|
||||||
fetch/httperr.h: fetch/http.errors
|
fetch/httperr.h: fetch/http.errors
|
||||||
@echo " [GEN]\t\t$@"
|
@printf " [GEN]\t\t$@\n"
|
||||||
@./fetch/errlist.sh http_errlist HTTP $< > $@
|
@./fetch/errlist.sh http_errlist HTTP $< > $@
|
||||||
|
|
||||||
$(LIBFETCH_OBJS): %.o: %.c $(LIBFETCH_INCS) $(LIBFETCH_GEN)
|
$(LIBFETCH_OBJS): %.o: %.c $(LIBFETCH_INCS) $(LIBFETCH_GEN)
|
||||||
@echo " [CC]\t\t$@"
|
@printf " [CC]\t\t$@\n"
|
||||||
@$(CC) $(CPPFLAGS) $(LIBFETCH_CPPFLAGS) $(CFLAGS) \
|
@$(CC) $(CPPFLAGS) $(LIBFETCH_CPPFLAGS) $(CFLAGS) \
|
||||||
$(LIBFETCH_CFLAGS) $(LIBFETCH_SHLIBCFLAGS) -c $< -o $@
|
$(LIBFETCH_CFLAGS) $(LIBFETCH_SHLIBCFLAGS) -c $< -o $@
|
||||||
|
|
||||||
$(OBJS): %.o: %.c
|
$(OBJS): %.o: %.c
|
||||||
@echo " [CC]\t\t$@"
|
@printf " [CC]\t\t$@\n"
|
||||||
@$(CC) $(CPPFLAGS) $(CFLAGS) $(SHAREDLIB_CFLAGS) -c $< -o $@
|
@$(CC) $(CPPFLAGS) $(CFLAGS) $(SHAREDLIB_CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
libxbps.so: $(OBJS) $(LIBFETCH_OBJS)
|
libxbps.so: $(OBJS) $(LIBFETCH_OBJS)
|
||||||
@echo " [CCLD]\t\t$@"
|
@printf " [CCLD]\t\t$@\n"
|
||||||
@$(CC) $(LDFLAGS) $^ -o $(LIBXBPS_SHLIB)
|
@$(CC) $(LDFLAGS) $^ -o $(LIBXBPS_SHLIB)
|
||||||
@-ln -sf $(LIBXBPS_SHLIB) libxbps.so.$(LIBXBPS_MAJOR)
|
@-ln -sf $(LIBXBPS_SHLIB) libxbps.so.$(LIBXBPS_MAJOR)
|
||||||
@-ln -sf $(LIBXBPS_SHLIB) libxbps.so
|
@-ln -sf $(LIBXBPS_SHLIB) libxbps.so
|
||||||
|
|
||||||
libxbps.a: $(OBJS) $(LIBFETCH_OBJS)
|
libxbps.a: $(OBJS) $(LIBFETCH_OBJS)
|
||||||
@echo " [AR]\t\t$@"
|
@printf " [AR]\t\t$@\n"
|
||||||
@$(AR) rcs $@ $^
|
@$(AR) rcs $@ $^
|
||||||
@echo " [RANLIB]\t$@"
|
@printf " [RANLIB]\t$@\n"
|
||||||
@ranlib $@
|
@ranlib $@
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: all
|
install: all
|
||||||
install -d $(LIBDIR)
|
install -d $(DESTDIR)$(LIBDIR)
|
||||||
install -m 644 libxbps.a $(LIBDIR)
|
install -m 644 libxbps.a $(DESTDIR)$(LIBDIR)
|
||||||
install -m 755 $(LIBXBPS_SHLIB) $(LIBDIR)
|
install -m 755 $(LIBXBPS_SHLIB) $(DESTDIR)$(LIBDIR)
|
||||||
cp -a libxbps.so $(LIBDIR)
|
cp -a libxbps.so $(DESTDIR)$(LIBDIR)
|
||||||
cp -a libxbps.so.$(LIBXBPS_MAJOR) $(LIBDIR)
|
cp -a libxbps.so.$(LIBXBPS_MAJOR) $(DESTDIR)$(LIBDIR)
|
||||||
|
|
||||||
.PHONY: uninstall
|
.PHONY: uninstall
|
||||||
uninstall:
|
uninstall:
|
||||||
-rm -f $(LIBDIR)/libxbps.*
|
-rm -f $(DESTDIR)$(LIBDIR)/libxbps.*
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
|
25
prog.mk
25
prog.mk
@ -13,37 +13,36 @@ clean:
|
|||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: all
|
install: all
|
||||||
install -d $(SBINDIR)
|
install -d $(DESTDIR)$(SBINDIR)
|
||||||
install $(INSTALL_STRIPPED) -m 755 $(BIN) $(SBINDIR)
|
install $(INSTALL_STRIPPED) -m 755 $(BIN) $(DESTDIR)$(SBINDIR)
|
||||||
install $(INSTALL_STRIPPED) -m 755 $(BIN).static $(SBINDIR)
|
install $(INSTALL_STRIPPED) -m 755 $(BIN).static $(DESTDIR)$(SBINDIR)
|
||||||
ifdef MAN
|
ifdef MAN
|
||||||
install -d $(MANDIR)
|
install -d $(DESTDIR)$(MANDIR)/man8
|
||||||
install -m 644 $(MAN) $(MANDIR)
|
install -m 644 $(MAN) $(DESTDIR)$(MANDIR)/man8
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: uninstall
|
.PHONY: uninstall
|
||||||
uninstall:
|
uninstall:
|
||||||
-rm -f $(SBINDIR)/$(BIN)
|
-rm -f $(DESTDIR)$(SBINDIR)/$(BIN)
|
||||||
-rm -f $(SBINDIR)/$(BIN).static
|
-rm -f $(DESTDIR)$(SBINDIR)/$(BIN).static
|
||||||
|
|
||||||
ifdef MAN
|
ifdef MAN
|
||||||
-rm -f $(MANDIR)/$(MAN)
|
-rm -f $(DESTDIR)$(MANDIR)/man8/$(MAN)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
@echo " [CC]\t\t$@"
|
@printf " [CC]\t\t$@\n"
|
||||||
@$(CC) $(CPPFLAGS) $(CFLAGS) -c $<
|
@$(CC) $(CPPFLAGS) $(CFLAGS) -c $<
|
||||||
|
|
||||||
$(MAN):
|
$(MAN):
|
||||||
@echo " [ASCIIDOC]\t$(MAN)"
|
@printf " [ASCIIDOC]\t$(MAN)\n"
|
||||||
@a2x -f manpage $(MAN).txt
|
@a2x -f manpage $(MAN).txt
|
||||||
|
|
||||||
$(BIN).static: $(OBJS)
|
$(BIN).static: $(OBJS)
|
||||||
@echo " [CCLD]\t\t$@"
|
@printf " [CCLD]\t\t$@\n"
|
||||||
@$(CC) -static $^ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \
|
@$(CC) -static $^ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \
|
||||||
$(STATIC_LIBS) -o $@ >/dev/null 2>&1
|
$(STATIC_LIBS) -o $@ >/dev/null 2>&1
|
||||||
|
|
||||||
$(BIN): $(OBJS)
|
$(BIN): $(OBJS)
|
||||||
@echo " [CCLD]\t\t$@"
|
@printf " [CCLD]\t\t$@\n"
|
||||||
@$(CC) $^ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -pie -o $@
|
@$(CC) $^ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -pie -o $@
|
||||||
|
|
||||||
|
14
vars.mk
14
vars.mk
@ -1,11 +1,11 @@
|
|||||||
# Common variables.
|
# Common variables.
|
||||||
|
|
||||||
PREFIX ?= /usr/local
|
PREFIX ?= /usr/local
|
||||||
SBINDIR ?= $(DESTDIR)$(PREFIX)/sbin
|
SBINDIR ?= $(PREFIX)/sbin
|
||||||
LIBDIR ?= $(DESTDIR)$(PREFIX)/lib
|
LIBDIR ?= $(PREFIX)/lib
|
||||||
INCLUDEDIR ?= $(DESTDIR)$(PREFIX)/include
|
INCLUDEDIR ?= $(PREFIX)/include
|
||||||
MANDIR ?= $(DESTDIR)$(PREFIX)/share/man/man8
|
MANDIR ?= $(PREFIX)/share/man
|
||||||
TOPDIR ?= ..
|
TOPDIR ?= ..
|
||||||
INSTALL_STRIPPED ?= -s
|
INSTALL_STRIPPED ?= -s
|
||||||
|
|
||||||
# To build the libxbps API documentation, requires graphviz and doxygen.
|
# To build the libxbps API documentation, requires graphviz and doxygen.
|
||||||
@ -17,7 +17,7 @@ CPPFLAGS = -I$(TOPDIR)/include -D_XOPEN_SOURCE=600 -D_GNU_SOURCE
|
|||||||
CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES
|
CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGE_FILES
|
||||||
|
|
||||||
ifdef DEBUG
|
ifdef DEBUG
|
||||||
INSTALL_STRIPPED=
|
INSTALL_STRIPPED =
|
||||||
DEBUG_FLAGS = -g
|
DEBUG_FLAGS = -g
|
||||||
CPPFLAGS += -DDEBUG
|
CPPFLAGS += -DDEBUG
|
||||||
endif
|
endif
|
||||||
|
Loading…
Reference in New Issue
Block a user