X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=Makefile;h=8446eee924d527bf46fd6e036c532eba5b46dc63;hb=c1bf1edeb726dc2cdedca5358f9b9cd88db72697;hp=f3698329ef9e7d8751cd18d2527631d548be6756;hpb=49fb51c6159db916f93c9439ef9b37ce6be90d02;p=elogind.git diff --git a/Makefile b/Makefile index f3698329e..8446eee92 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,6 @@ USE_LOG = true DEBUG = false # compile with gcc's code coverage option -# (use it with DEBUG, works only with glibc) USE_GCOV = false # include Security-Enhanced Linux support @@ -126,9 +125,7 @@ udevdir = /dev udevdb = ${udevdir}/.udevdb LOCAL_CFG_DIR = etc/udev KERNEL_DIR = /lib/modules/${shell uname -r}/build -srcdir = . DESTDIR = -RELEASE_NAME = udev-$(VERSION) INSTALL = /usr/bin/install -c INSTALL_PROGRAM = ${INSTALL} @@ -140,24 +137,26 @@ CROSS = CC = $(CROSS)gcc LD = $(CROSS)gcc AR = $(CROSS)ar -STRIP = $(CROSS)strip RANLIB = $(CROSS)ranlib HOSTCC = gcc +STRIP = $(CROSS)strip +STRIPCMD = $(STRIP) -s # check if compiler option is supported cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;} -CFLAGS += -g -Wall -pipe -fno-builtin -Wstrict-prototypes -Wsign-compare \ - -Wchar-subscripts -Wmissing-declarations -Wnested-externs \ - -Wpointer-arith -Wcast-align -Wsign-compare -Wmissing-prototypes \ - -Wshadow -CFLAGS += $(call cc-supports, -Wdeclaration-after-statement, ) -CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 +CFLAGS = -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 +WARNINGS = -Wstrict-prototypes -Wsign-compare -Wshadow \ + -Wchar-subscripts -Wmissing-declarations -Wnested-externs \ + -Wpointer-arith -Wcast-align -Wsign-compare -Wmissing-prototypes +WARNINGS += $(call cc-supports, -Wdeclaration-after-statement, ) +CFLAGS += $(WARNINGS) LDFLAGS = -Wl,-warn-common -# use '-Os' optimization if available, else use -O2 +# use -Os optimization if available, else use -O2 OPTFLAGS := $(call cc-supports, -Os, -O2) +CFLAGS += $(OPTFLAGS) # include our local copy of libsysfs CFLAGS += -I$(PWD)/libsysfs/sysfs \ @@ -167,14 +166,10 @@ ifeq ($(strip $(USE_LOG)),true) CFLAGS += -DUSE_LOG endif -# if DEBUG is enabled, then we do not strip or optimize +# if DEBUG is enabled, then we do not strip ifeq ($(strip $(DEBUG)),true) CFLAGS += -DDEBUG - STRIPCMD = /bin/true -Since_we_are_debugging -else - CFLAGS += $(OPTFLAGS) -fomit-frame-pointer - LDFLAGS += -s -Wl - STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment + STRIPCMD = endif ifeq ($(strip $(USE_GCOV)),true) @@ -238,7 +233,9 @@ all: $(KLCC) $(PROGRAMS) $(MAN_PAGES) # "Static Pattern Rule" to build all programs $(PROGRAMS): %: $(HOST_PROGS) $(KLCC) $(HEADERS) $(GEN_HEADERS) $(LIBSYSFS) $(LIBUDEV) %.o $(QUIET) $(LD) $(LDFLAGS) $@.o -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) +ifneq ($(STRIPCMD),) $(QUIET) $(STRIPCMD) $@ +endif # our own copy of klibc, it is not used if KLCC is given $(KLCC): @@ -293,6 +290,7 @@ clean: - find -name "*.gcov" -print0 | xargs -0rt rm -f - rm -f udev_gcov.txt - rm -f core $(PROGRAMS) $(GEN_HEADERS) $(GEN_CONFIGS) + - rm -f udev-$(VERSION).tar.gz $(MAKE) -C klibc SUBDIRS=klibc clean @extras="$(EXTRAS)"; for target in $$extras; do \ echo $$target; \ @@ -303,8 +301,8 @@ clean: .PHONY: clean release: - git-tar-tree HEAD $(RELEASE_NAME) | gzip -9v > $(RELEASE_NAME).tar.gz - @echo "$(RELEASE_NAME).tar.gz created" + git-tar-tree HEAD udev-$(VERSION) | gzip -9v > udev-$(VERSION).tar.gz + @echo "udev-$(VERSION).tar.gz created" .PHONY: release install-config: $(GEN_CONFIGS) @@ -412,7 +410,7 @@ buildtest: .PHONY: buildtest gcov-all: - $(MAKE) clean all DEBUG=true USE_GCOV=true + $(MAKE) clean all STRIPCMD= USE_GCOV=true @echo @echo "binaries built with gcov support." @echo "run the tests and analyze with 'make udev_gcov.txt'"