Restructure the Makefiles, INET6 and SSL support in libfetch is now
mandatory, build executables as PIE objects. --HG-- extra : convert_revision : xtraeme%40gmail.com-20100106101556-tqzwk80xpp0iz20t
This commit is contained in:
parent
253be2e783
commit
ec907d0646
19
lib/Makefile
19
lib/Makefile
@ -1,14 +1,11 @@
|
|||||||
include ../vars.mk
|
include ../vars.mk
|
||||||
|
|
||||||
LIBMAJOR = 0
|
LIBMAJOR = 0
|
||||||
LIBMINOR = 0
|
LIBMINOR = 0
|
||||||
LIBMICRO = 0
|
LIBMICRO = 0
|
||||||
LIBXBPS_SHLIB = libxbps.so.$(LIBMAJOR).$(LIBMINOR).$(LIBMICRO)
|
LIBXBPS_SHLIB = libxbps.so.$(LIBMAJOR).$(LIBMINOR).$(LIBMICRO)
|
||||||
SHAREDLIB_LDFLAGS = -lprop -larchive
|
LDFLAGS += -lprop -larchive -lssl
|
||||||
ifdef WITH_SSL
|
LDFLAGS += -shared -Wl,-soname,libxbps.so.$(LIBMAJOR)
|
||||||
SHAREDLIB_LDFLAGS += -lssl
|
|
||||||
endif
|
|
||||||
SHAREDLIB_LDFLAGS += -shared -Wl,-soname,libxbps.so.$(LIBMAJOR)
|
|
||||||
|
|
||||||
# libfetch
|
# 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
|
||||||
@ -29,11 +26,11 @@ libfetch:
|
|||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
@echo " [CC] $@"
|
@echo " [CC] $@"
|
||||||
@$(CC) $(CPPFLAGS) $(SHAREDLIB_CFLAGS) $(CFLAGS) -c $<
|
@$(CC) $(CPPFLAGS) $(CFLAGS) $(SHAREDLIB_CFLAGS) -c $<
|
||||||
|
|
||||||
libxbps.so: $(OBJS) $(LIBFETCH_OBJS)
|
libxbps.so: $(OBJS) $(LIBFETCH_OBJS)
|
||||||
@echo " [CCLD] $@"
|
@echo " [CCLD] $@"
|
||||||
@$(CC) $(LDFLAGS) $(SHAREDLIB_LDFLAGS) $^ -o $(LIBXBPS_SHLIB)
|
@$(CC) $(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
|
||||||
|
|
||||||
|
@ -3,14 +3,7 @@ include $(TOPDIR)/vars.mk
|
|||||||
|
|
||||||
CFLAGS += -Wno-unused-macros -Wno-conversion -Wno-stack-protector
|
CFLAGS += -Wno-unused-macros -Wno-conversion -Wno-stack-protector
|
||||||
CPPFLAGS += -DFTP_COMBINE_CWDS -DNETBSD -I$(TOPDIR)/include
|
CPPFLAGS += -DFTP_COMBINE_CWDS -DNETBSD -I$(TOPDIR)/include
|
||||||
|
CPPFLAGS += -DINET6 -DWITH_SSL
|
||||||
ifdef WITH_INET6
|
|
||||||
CPPFLAGS += -DINET6
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifdef WITH_SSL
|
|
||||||
CPPFLAGS += -DWITH_SSL
|
|
||||||
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
|
||||||
@ -21,7 +14,7 @@ all: $(INCS) $(GEN) $(OBJS)
|
|||||||
|
|
||||||
%.o: %.c $(INCS) $(GEN)
|
%.o: %.c $(INCS) $(GEN)
|
||||||
@echo " [CC] $@"
|
@echo " [CC] $@"
|
||||||
@$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(SHAREDLIB_CFLAGS) -c $<
|
@$(CC) $(CPPFLAGS) $(CFLAGS) $(SHAREDLIB_CFLAGS) $(LDFLAGS) -c $<
|
||||||
|
|
||||||
ftperr.h: ftp.errors
|
ftperr.h: ftp.errors
|
||||||
@echo " [GEN] $@"
|
@echo " [GEN] $@"
|
||||||
|
3
prog.mk
3
prog.mk
@ -1,4 +1,5 @@
|
|||||||
OBJS ?= main.o
|
OBJS ?= main.o
|
||||||
|
CFLAGS += -fPIE
|
||||||
LDFLAGS += -lxbps
|
LDFLAGS += -lxbps
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
@ -44,5 +45,5 @@ $(BIN).static: $(OBJS)
|
|||||||
|
|
||||||
$(BIN): $(OBJS)
|
$(BIN): $(OBJS)
|
||||||
@echo " [CCLD] $@"
|
@echo " [CCLD] $@"
|
||||||
@$(CC) $^ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
|
@$(CC) $^ $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -pie -o $@
|
||||||
|
|
||||||
|
16
vars.mk
16
vars.mk
@ -1,8 +1,5 @@
|
|||||||
# Common variables.
|
# Common variables.
|
||||||
|
|
||||||
WITH_INET6 = yes
|
|
||||||
WITH_SSL = yes
|
|
||||||
|
|
||||||
PREFIX ?= /usr/local
|
PREFIX ?= /usr/local
|
||||||
SBINDIR ?= $(DESTDIR)$(PREFIX)/sbin
|
SBINDIR ?= $(DESTDIR)$(PREFIX)/sbin
|
||||||
LIBDIR ?= $(DESTDIR)$(PREFIX)/lib
|
LIBDIR ?= $(DESTDIR)$(PREFIX)/lib
|
||||||
@ -10,20 +7,21 @@ MANDIR ?= $(DESTDIR)$(PREFIX)/share/man/man8
|
|||||||
TOPDIR ?= ..
|
TOPDIR ?= ..
|
||||||
INSTALL_STRIPPED ?= -s
|
INSTALL_STRIPPED ?= -s
|
||||||
|
|
||||||
|
LDFLAGS = -L$(TOPDIR)/lib
|
||||||
|
CPPFLAGS = -I$(TOPDIR)/include -D_XOPEN_SOURCE=600 -D_GNU_SOURCE
|
||||||
|
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
|
||||||
|
|
||||||
LDFLAGS = -L$(TOPDIR)/lib
|
WARNFLAGS = -pedantic -std=c99 -Wall -Wextra -Werror -Wshadow -Wformat=2
|
||||||
CPPFLAGS += -I$(TOPDIR)/include -D_XOPEN_SOURCE=600 -D_GNU_SOURCE
|
|
||||||
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 += -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) -fPIC -DPIC -fstack-protector-all
|
CFLAGS = $(DEBUG_FLAGS) $(WARNFLAGS) -fPIC -DPIC -fstack-protector-all
|
||||||
|
SHAREDLIB_CFLAGS = -fvisibility=hidden
|
||||||
|
|
||||||
# Grr, hate the static libs!
|
# Grr, hate the static libs!
|
||||||
STATIC_LIBS = -lprop -lpthread -larchive -lssl -lcrypto -ldl -lacl \
|
STATIC_LIBS = -lprop -lpthread -larchive -lssl -lcrypto -ldl -lacl \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user