diff options
author | Torsten Werner <twerner@debian.org> | 2009-09-30 21:23:15 +0200 |
---|---|---|
committer | Andrew G. Morgan <morgan@kernel.org> | 2010-08-08 15:26:04 -0700 |
commit | 7ebd7c568c94a8e617aaf2a00a0b4b097bc910ff (patch) | |
tree | 10e876fa33e7ed1de8f06cd3a02fbb4248eaf5d3 | |
parent | 03134f14a65bae774899ade233a70a5c33f97110 (diff) | |
download | libcap2-7ebd7c568c94a8e617aaf2a00a0b4b097bc910ff.tar.gz |
fix Makefiles
This patch allows modifications of $(CFLAGS) when invoking make and fixes some
library linking issues.
Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
-rw-r--r-- | Make.Rules | 6 | ||||
-rw-r--r-- | libcap/Makefile | 4 | ||||
-rw-r--r-- | pam_cap/Makefile | 5 | ||||
-rw-r--r-- | progs/Makefile | 4 |
4 files changed, 9 insertions, 10 deletions
@@ -43,7 +43,7 @@ MINOR=19 # Compilation specifics KERNEL_HEADERS := $(topdir)/libcap/include -IPATH += -I$(topdir)/libcap/include -I$(KERNEL_HEADERS) +IPATH += -fPIC -I$(topdir)/libcap/include -I$(KERNEL_HEADERS) CC := gcc CFLAGS := -O2 @@ -52,7 +52,7 @@ BUILD_CFLAGS := $(CFLAGS) $(IPATH) AR := ar RANLIB := ranlib DEBUG = -g #-DDEBUG -WARNINGS=-fPIC -Wall -Wwrite-strings \ +WARNINGS=-Wall -Wwrite-strings \ -Wpointer-arith -Wcast-qual -Wcast-align \ -Wstrict-prototypes -Wmissing-prototypes \ -Wnested-externs -Winline -Wshadow @@ -62,7 +62,7 @@ LDFLAGS := #-g SYSTEM_HEADERS = /usr/include INCS=$(topdir)/libcap/include/sys/capability.h LDFLAGS += -L$(topdir)/libcap -CFLAGS += -Dlinux $(WARNINGS) $(DEBUG) $(IPATH) +CFLAGS += -Dlinux $(WARNINGS) $(DEBUG) PAM_CAP := $(shell if [ -f /usr/include/security/pam_modules.h ]; then echo yes ; else echo no ; fi) INDENT := $(shell if [ -n "$(which indent 2>/dev/null)" ]; then echo "| indent -kr" ; fi) DYNAMIC := $(shell if [ ! -d "$(topdir)/.git" ]; then echo yes; fi) diff --git a/libcap/Makefile b/libcap/Makefile index 8a61752..4762c60 100644 --- a/libcap/Makefile +++ b/libcap/Makefile @@ -55,10 +55,10 @@ $(MINLIBNAME): $(OBJS) ln -sf $(MAJLIBNAME) $(LIBNAME) %.o: %.c $(INCLS) - $(CC) $(CFLAGS) -c $< -o $@ + $(CC) $(CFLAGS) $(IPATH) -c $< -o $@ cap_text.o: cap_text.c $(USE_GPERF_OUTPUT) $(INCLS) - $(CC) $(CFLAGS) $(INCLUDE_GPERF_OUTPUT) -c $< -o $@ + $(CC) $(CFLAGS) $(IPATH) $(INCLUDE_GPERF_OUTPUT) -c $< -o $@ install: all mkdir -p -m 0755 $(INCDIR)/sys diff --git a/pam_cap/Makefile b/pam_cap/Makefile index eae88ed..397a7cc 100644 --- a/pam_cap/Makefile +++ b/pam_cap/Makefile @@ -3,8 +3,7 @@ topdir=$(shell pwd)/.. include ../Make.Rules -LDLIBS += -lcap -CFLAGS += -fPIC +LDLIBS += -L../libcap -lcap -lpam all: pam_cap.so $(MAKE) testcompile @@ -17,7 +16,7 @@ pam_cap.so: pam_cap.o $(LD) $(LDFLAGS) -o pam_cap.so $< $(LDLIBS) pam_cap.o: pam_cap.c - $(CC) $(CFLAGS) -c $< -o $@ + $(CC) $(CFLAGS) $(IPATH) -c $< -o $@ testcompile: test.c pam_cap.o $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+ -lpam -ldl $(LDLIBS) diff --git a/progs/Makefile b/progs/Makefile index a1542dc..8000a91 100644 --- a/progs/Makefile +++ b/progs/Makefile @@ -14,7 +14,7 @@ BUILD=$(PROGS) ifneq ($(DYNAMIC),yes) LDFLAGS += --static endif -LDLIBS += -lcap +LDLIBS += -L../libcap -lcap all: $(BUILD) @@ -22,7 +22,7 @@ $(BUILD): %: %.o $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS) %.o: %.c $(INCS) - $(CC) $(CFLAGS) -c $< -o $@ + $(CC) $(IPATH) $(CFLAGS) -c $< -o $@ install: all mkdir -p -m 0755 $(SBINDIR) |