Reorganize the Makefiles so that parallel build is possible.
--HG-- extra : convert_revision : xtraeme%40gmail.com-20091118090545-wpvgwmnqyh77sgz8
This commit is contained in:
parent
f847401c4f
commit
e8d947e15b
23
lib/Makefile
23
lib/Makefile
@ -4,10 +4,14 @@ LIBMAJOR = 0
|
|||||||
LIBMINOR = 0
|
LIBMINOR = 0
|
||||||
LIBMICRO = 0
|
LIBMICRO = 0
|
||||||
LIBXBPS_SHLIB = libxbps.so.$(LIBMAJOR).$(LIBMINOR).$(LIBMICRO)
|
LIBXBPS_SHLIB = libxbps.so.$(LIBMAJOR).$(LIBMINOR).$(LIBMICRO)
|
||||||
LIBXBPS_LDFLAGS = -shared -Wl,-soname,libxbps.so.$(LIBMAJOR)
|
SHAREDLIB_LDFLAGS = -lprop -larchive
|
||||||
|
ifdef WITH_SSL
|
||||||
|
SHAREDLIB_LDFLAGS += -lssl
|
||||||
|
endif
|
||||||
|
SHAREDLIB_LDFLAGS += -shared -Wl,-soname,libxbps.so.$(LIBMAJOR)
|
||||||
|
|
||||||
# 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 fetch/ftp.o fetch/http.o
|
||||||
|
|
||||||
# libxbps
|
# libxbps
|
||||||
OBJS += configure.o cmpver.o depends.o download.o fexec.o findpkg.o
|
OBJS += configure.o cmpver.o depends.o download.o fexec.o findpkg.o
|
||||||
@ -15,29 +19,26 @@ OBJS += humanize_number.o orphans.o plist.o purge.o register.o remove.o
|
|||||||
OBJS += repository.o requiredby.o sha256.o sortdeps.o state.o
|
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
|
||||||
ifdef STATIC
|
ifdef STATIC
|
||||||
all: libfetch libxbps.a
|
all: libfetch libxbps.a
|
||||||
else
|
else
|
||||||
LDFLAGS = -lprop -larchive
|
|
||||||
ifdef WITH_SSL
|
|
||||||
LDFLAGS += -lssl -lcrypto
|
|
||||||
endif
|
|
||||||
all: libfetch libxbps.so libxbps.a
|
all: libfetch libxbps.so libxbps.a
|
||||||
endif
|
endif
|
||||||
.PHONY: all
|
|
||||||
|
|
||||||
libfetch:
|
libfetch:
|
||||||
$(MAKE) -C fetch
|
$(MAKE) -C fetch
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -c $<
|
$(CC) $(CPPFLAGS) $(SHAREDLIB_CFLAGS) $(CFLAGS) \
|
||||||
|
$(LDFLAGS) $(STATIC_LIBS) -c $<
|
||||||
|
|
||||||
libxbps.so: $(OBJS)
|
libxbps.so: $(OBJS) $(LIBFETCH_OBJS)
|
||||||
$(CC) $(LDFLAGS) $(LIBXBPS_LDFLAGS) $^ -o $(LIBXBPS_SHLIB)
|
$(CC) $(LDFLAGS) $(SHAREDLIB_LDFLAGS) $^ -o $(LIBXBPS_SHLIB)
|
||||||
-ln -sf $(LIBXBPS_SHLIB) libxbps.so.$(LIBMAJOR)
|
-ln -sf $(LIBXBPS_SHLIB) libxbps.so.$(LIBMAJOR)
|
||||||
-ln -sf $(LIBXBPS_SHLIB) libxbps.so
|
-ln -sf $(LIBXBPS_SHLIB) libxbps.so
|
||||||
|
|
||||||
libxbps.a: $(OBJS)
|
libxbps.a: $(OBJS) $(LIBFETCH_OBJS)
|
||||||
$(AR) rcs $@ $^
|
$(AR) rcs $@ $^
|
||||||
ranlib $@
|
ranlib $@
|
||||||
|
|
||||||
|
@ -12,19 +12,16 @@ ifdef WITH_SSL
|
|||||||
CPPFLAGS += -DWITH_SSL
|
CPPFLAGS += -DWITH_SSL
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef STATIC
|
|
||||||
CFLAGS += -static
|
|
||||||
endif
|
|
||||||
|
|
||||||
OBJS= fetch.o common.o ftp.o http.o file.o
|
OBJS= fetch.o common.o ftp.o http.o file.o
|
||||||
INCS= common.h
|
INCS= common.h
|
||||||
GEN = ftperr.h httperr.h
|
GEN = ftperr.h httperr.h
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: $(OBJS)
|
all: $(INCS) $(GEN) $(OBJS)
|
||||||
|
|
||||||
%.o: %.c $(INCS) $(GEN)
|
%.o: %.c $(INCS) $(GEN)
|
||||||
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -c $<
|
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \
|
||||||
|
$(SHAREDLIB_CFLAGS) -c $<
|
||||||
|
|
||||||
ftperr.h: ftp.errors
|
ftperr.h: ftp.errors
|
||||||
./errlist.sh ftp_errlist FTP ftp.errors > $@
|
./errlist.sh ftp_errlist FTP ftp.errors > $@
|
||||||
|
8
prog.mk
8
prog.mk
@ -1,11 +1,12 @@
|
|||||||
OBJS ?= main.o
|
OBJS ?= main.o
|
||||||
MAN ?= $(BIN).8
|
MAN ?= $(BIN).8
|
||||||
|
|
||||||
|
LDFLAGS += -lxbps
|
||||||
|
|
||||||
ifdef STATIC
|
ifdef STATIC
|
||||||
all: $(BIN).static
|
all: $(BIN).static
|
||||||
MAN =
|
MAN =
|
||||||
else
|
else
|
||||||
LDFLAGS += -lxbps
|
|
||||||
all: $(BIN) $(MAN)
|
all: $(BIN) $(MAN)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -15,10 +16,11 @@ $(MAN):
|
|||||||
a2x -f manpage $(MAN).txt
|
a2x -f manpage $(MAN).txt
|
||||||
|
|
||||||
$(BIN).static: $(OBJS)
|
$(BIN).static: $(OBJS)
|
||||||
$(CC) $^ -static -lxbps $(LDFLAGS) -o $@
|
$(CC) $^ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \
|
||||||
|
$(STATIC_LIBS) -o $@
|
||||||
|
|
||||||
$(BIN): $(OBJS)
|
$(BIN): $(OBJS)
|
||||||
$(CC) $^ $(LDFLAGS) -o $@
|
$(CC) $^ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
|
10
vars.mk
10
vars.mk
@ -19,16 +19,16 @@ endif
|
|||||||
LDFLAGS = -L$(TOPDIR)/lib
|
LDFLAGS = -L$(TOPDIR)/lib
|
||||||
CPPFLAGS += -I$(TOPDIR)/include -D_XOPEN_SOURCE=600 -D_GNU_SOURCE
|
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
|
||||||
|
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
|
WARNFLAGS += -Wcast-qual -Wcast-align -Wstack-protector
|
||||||
CFLAGS = $(DEBUG_FLAGS) $(WARNFLAGS)
|
CFLAGS = $(DEBUG_FLAGS) $(WARNFLAGS) -fstack-protector-all
|
||||||
|
|
||||||
ifdef STATIC
|
ifdef STATIC
|
||||||
CFLAGS += -static
|
CFLAGS += -static
|
||||||
LDFLAGS += -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
|
else
|
||||||
CFLAGS += -fvisibility=hidden -fstack-protector-all -fPIC -DPIC
|
CFLAGS += -fPIC -DPIC
|
||||||
CPPFLAGS += -Wstack-protector
|
|
||||||
endif
|
endif
|
||||||
|
Loading…
Reference in New Issue
Block a user