diff --git a/lib/Makefile b/lib/Makefile index 95ae3b57..e5a918d7 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -1,17 +1,22 @@ include ../vars.mk -LIBMAJOR = 0 -LIBMINOR = 0 -LIBMICRO = 0 -LIBXBPS_SHLIB = libxbps.so.$(LIBMAJOR).$(LIBMINOR).$(LIBMICRO) +LIBXBPS_MAJOR = 0 +LIBXBPS_MINOR = 0 +LIBXBPS_MICRO = 0 +LIBXBPS_SHLIB = libxbps.so.$(LIBXBPS_MAJOR).$(LIBXBPS_MINOR).$(LIBXBPS_MICRO) LDFLAGS += -lprop -larchive -lssl -LDFLAGS += -shared -Wl,-soname,libxbps.so.$(LIBMAJOR) +LDFLAGS += -shared -Wl,-soname,libxbps.so.$(LIBXBPS_MAJOR) # libfetch -LIBFETCH_OBJS = fetch/common.o fetch/fetch.o fetch/file.o fetch/ftp.o fetch/http.o +LIBFETCH_OBJS = fetch/common.o fetch/fetch.o fetch/file.o +LIBFETCH_OBJS += fetch/ftp.o fetch/http.o +LIBFETCH_CPPFLAGS = -DFTP_COMBINE_CWDS -DNETBSD -DINET6 -DWITH_SSL +LIBFETCH_CFLAGS = -Wno-unused-macros -Wno-conversion -Wno-stack-protector +LIBFETCH_INCS = fetch/common.h +LIBFETCH_GEN = fetch/ftperr.h fetch/httperr.h # libxbps -OBJS += configure.o config_files.o cmpver.o download.o fexec.o +OBJS = configure.o config_files.o cmpver.o download.o fexec.o OBJS += humanize_number.o orphans.o plist.o purge.o register.o OBJS += regpkgs_dictionary.o remove.o remove_obsoletes.o repository.o OBJS += repository_finddeps.o repository_findpkg.o repository_plist.o @@ -19,25 +24,35 @@ OBJS += repository_pool.o repository_sync_index.o requiredby.o sha256.o OBJS += sortdeps.o state.o unpack.o util.o pkgmatch.o mkpath.o .PHONY: all -all: libfetch libxbps.so libxbps.a +all: libxbps.so libxbps.a -libfetch: - @$(MAKE) -C fetch +fetch/ftperr.h: fetch/ftp.errors + @echo " [GEN]\t\t$@" + @./fetch/errlist.sh ftp_errlist FTP $< > $@ -%.o: %.c - @echo " [CC] $@" - @$(CC) $(CPPFLAGS) $(CFLAGS) $(SHAREDLIB_CFLAGS) -c $< +fetch/httperr.h: fetch/http.errors + @echo " [GEN]\t\t$@" + @./fetch/errlist.sh http_errlist HTTP $< > $@ + +$(LIBFETCH_OBJS): %.o: %.c $(LIBFETCH_INCS) $(LIBFETCH_GEN) + @echo " [CC]\t\t$@" + @$(CC) $(CPPFLAGS) $(LIBFETCH_CPPFLAGS) $(CFLAGS) \ + $(LIBFETCH_CFLAGS) $(SHAREDLIB_CFLAGS) -c $< -o $@ + +$(OBJS): %.o: %.c + @echo " [CC]\t\t$@" + @$(CC) $(CPPFLAGS) $(CFLAGS) $(SHAREDLIB_CFLAGS) -c $< -o $@ libxbps.so: $(OBJS) $(LIBFETCH_OBJS) - @echo " [CCLD] $@" + @echo " [CCLD]\t\t$@" @$(CC) $(LDFLAGS) $^ -o $(LIBXBPS_SHLIB) - @-ln -sf $(LIBXBPS_SHLIB) libxbps.so.$(LIBMAJOR) + @-ln -sf $(LIBXBPS_SHLIB) libxbps.so.$(LIBXBPS_MAJOR) @-ln -sf $(LIBXBPS_SHLIB) libxbps.so libxbps.a: $(OBJS) $(LIBFETCH_OBJS) - @echo " [AR] $@" + @echo " [AR]\t\t$@" @$(AR) rcs $@ $^ - @echo " [RANLIB] $@" + @echo " [RANLIB]\t$@" @ranlib $@ .PHONY: install @@ -46,7 +61,7 @@ install: all install -m 644 libxbps.a $(LIBDIR) install -m 755 $(LIBXBPS_SHLIB) $(LIBDIR) cp -a libxbps.so $(LIBDIR) - cp -a libxbps.so.$(LIBMAJOR) $(LIBDIR) + cp -a libxbps.so.$(LIBXBPS_MAJOR) $(LIBDIR) .PHONY: uninstall uninstall: @@ -54,5 +69,5 @@ uninstall: .PHONY: clean clean: - -rm -f libxbps* $(OBJS) - @$(MAKE) -C fetch clean + -rm -f libxbps* $(OBJS) $(LIBFETCH_OBJS) + -rm -f $(LIBFETCH_GEN) diff --git a/lib/fetch/Makefile b/lib/fetch/Makefile deleted file mode 100644 index a018c301..00000000 --- a/lib/fetch/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -TOPDIR = ../.. -include $(TOPDIR)/vars.mk - -CFLAGS += -Wno-unused-macros -Wno-conversion -Wno-stack-protector -CPPFLAGS += -DFTP_COMBINE_CWDS -DNETBSD -I$(TOPDIR)/include -CPPFLAGS += -DINET6 -DWITH_SSL - -OBJS= fetch.o common.o ftp.o http.o file.o -INCS= common.h -GEN = ftperr.h httperr.h - -.PHONY: all -all: $(INCS) $(GEN) $(OBJS) - -%.o: %.c $(INCS) $(GEN) - @echo " [CC] $@" - @$(CC) $(CPPFLAGS) $(CFLAGS) $(SHAREDLIB_CFLAGS) $(LDFLAGS) -c $< - -ftperr.h: ftp.errors - @echo " [GEN] $@" - @./errlist.sh ftp_errlist FTP ftp.errors > $@ - -httperr.h: http.errors - @echo " [GEN] $@" - @./errlist.sh http_errlist HTTP http.errors > $@ - -.PHONY: clean -clean: - -rm -f $(GEN) $(OBJS) diff --git a/prog.mk b/prog.mk index 699867f2..fe2ce05c 100644 --- a/prog.mk +++ b/prog.mk @@ -31,19 +31,19 @@ ifdef MAN endif %.o: %.c - @echo " [CC] $@" + @echo " [CC]\t\t$@" @$(CC) $(CPPFLAGS) $(CFLAGS) -c $< $(MAN): - @echo " [ASCIIDOC] $(MAN)" + @echo " [ASCIIDOC]\t$(MAN)" @a2x -f manpage $(MAN).txt $(BIN).static: $(OBJS) - @echo " [CCLD] $@" + @echo " [CCLD]\t\t$@" @$(CC) -static $^ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \ $(STATIC_LIBS) -o $@ >/dev/null 2>&1 $(BIN): $(OBJS) - @echo " [CCLD] $@" + @echo " [CCLD]\t\t$@" @$(CC) $^ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -pie -o $@ diff --git a/vars.mk b/vars.mk index 92b3bfd3..15944507 100644 --- a/vars.mk +++ b/vars.mk @@ -25,5 +25,5 @@ CFLAGS = $(DEBUG_FLAGS) $(WARNFLAGS) -fPIC -DPIC -fstack-protector-all SHAREDLIB_CFLAGS = -fvisibility=hidden # Grr, hate the static libs! -STATIC_LIBS = -lprop -lpthread -larchive -lssl -lcrypto -ldl -lacl \ - -lattr -llzma -lbz2 -lz +STATIC_LIBS = -lprop -lpthread -larchive -lssl -lcrypto -ldl -lacl +STATIC_LIBS += -lattr -llzma -lbz2 -lz