From 28d744ee6ac2bd04b36a7b34b5d3b499056a562a Mon Sep 17 00:00:00 2001 From: albert <> Date: Mon, 1 Sep 2003 00:18:58 +0000 Subject: [PATCH] Peter Moulder fixed CFLAGS --- Makefile | 36 ++++++++++++++++++++++++++---------- NEWS | 1 + README | 3 --- proc/module.mk | 6 +++--- ps/module.mk | 6 +++--- 5 files changed, 33 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 9521ecc9..858e3fce 100644 --- a/Makefile +++ b/Makefile @@ -63,13 +63,29 @@ TARFILES := AUTHORS BUGS NEWS README TODO COPYING COPYING.LIB \ CURSES := -I/usr/include/ncurses -lncurses -LDFLAGS := -Wl,-warn-common +# Preprocessor flags. +PKG_CPPFLAGS := -D_GNU_SOURCE -I proc +CPPFLAGS := +ALL_CPPFLAGS := $(PKG_CPPFLAGS) $(CPPFLAGS) -CFLAGS := -D_GNU_SOURCE -O2 -g3 -fno-common -ffast-math -I proc \ +# Left out -Wconversion due to noise in glibc headers. +# Left out a number of things that older compilers lack: +# -Wpadded -Wunreachable-code -Wdisabled-optimization +# +# Since none of the PKG_CFLAGS things are truly required +# to compile procps, they might best be moved to CFLAGS. +# On the other hand, they aren't normal -O -g things either. +# +PKG_CFLAGS := -fno-common -ffast-math \ -W -Wall -Wshadow -Wcast-align -Wredundant-decls \ -Wbad-function-cast -Wcast-qual -Wwrite-strings -Waggregate-return \ -# -Wpadded -Wunreachable-code -Wdisabled-optimization \ - -Wstrict-prototypes -Wmissing-prototypes # -Wconversion + -Wstrict-prototypes -Wmissing-prototypes +CFLAGS := -O2 -g3 +ALL_CFLAGS := $(PKG_CFLAGS) $(CFLAGS) + +PKG_LDFLAGS := -Wl,-warn-common +LDFLAGS := +ALL_LDFLAGS := $(PKG_LDFLAGS) $(LDFLAGS) ############ misc. @@ -112,7 +128,7 @@ CLEAN += $(junk) $(foreach dir,$(DIRS),$(addprefix $(dir), $(junk))) #endif # #%.d: %.c -# depend.sh $(CFLAGS) $< > $@ +# depend.sh $(ALL_CPPFLAGS) $(ALL_CFLAGS) $< > $@ ############ # don't want to type "make procps-$(TARVERSION).tar.gz" @@ -140,21 +156,21 @@ install: $(filter-out $(SKIP) $(addprefix $(DESTDIR),$(SKIP)),$(INSTALL)) ############ prog.c --> prog.o %.o : %.c - $(CC) $(CFLAGS) -c -o $@ $^ + $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c -o $@ $^ w.o: w.c - $(CC) $(CFLAGS) $(W_SHOWFROM) -c $< + $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) $(W_SHOWFROM) -c $< ############ prog.o --> prog pmap w uptime tload free sysctl vmstat utmp pgrep skill: % : %.o $(LIBPROC) - $(CC) $(LDFLAGS) -o $@ $^ + $(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) -o $@ $^ top: % : %.o $(LIBPROC) - $(CC) $(LDFLAGS) -o $@ $^ $(CURSES) + $(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) -o $@ $^ $(CURSES) watch: % : %.o - $(CC) $(LDFLAGS) -o $@ $^ $(CURSES) + $(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) -o $@ $^ $(CURSES) ############ progX --> progY diff --git a/NEWS b/NEWS index cb8164fe..d364938a 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,6 @@ procps-3.1.11 --> procps-3.1.12 +required flags moved out of CFLAGS #205429 RPM generation handles /lib64 WCHAN skips leading '.' vmstat: numerous new features diff --git a/README b/README index f4466779..25d27b84 100644 --- a/README +++ b/README @@ -16,9 +16,6 @@ INSTALLATION named t, v, and p to ensure that the correct libproc (the new one) is used during your testing. - If you need to add a compiler option, use CC to do it: - make CC='gcc -foo' - You may set SKIP to avoid building or installing things. For example: diff --git a/proc/module.mk b/proc/module.mk index de0399b5..11353197 100644 --- a/proc/module.mk +++ b/proc/module.mk @@ -29,7 +29,7 @@ endif # Separate rule for this directory, to use -fpic or -fPIC $(filter-out proc/version.o,$(LIBOBJ)): proc/%.o: proc/%.c - $(CC) -c $(CFLAGS) $(LIBFLAGS) $< -o $@ + $(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) $(LIBFLAGS) $< -o $@ LIB_X := COPYING module.mk library.map TARFILES += $(LIBSRC) $(LIBHDR) $(addprefix proc/,$(LIB_X)) @@ -51,7 +51,7 @@ proc/$(SONAME): $(LIBOBJ) # AUTOMATIC DEPENDENCY GENERATION -- GCC AND GNUMAKE DEPENDENT proc/.depend: $(LIBSRC) $(LIBHDR) - $(strip $(CC) $(LIB_CFLAGS) -MM -MG $(LIBSRC) > $@) + $(strip $(CC) $(ALL_CPPFLAGS) $(LIB_CFLAGS) -MM -MG $(LIBSRC) > $@) ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),tar) @@ -74,4 +74,4 @@ $(lib)/$(SONAME) : proc/$(SONAME) proc/version.o: proc/version.c proc/version.h - $(CC) $(CFLAGS) $(LIBFLAGS) -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\" -c -o $@ $< + $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) $(LIBFLAGS) -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\" -c -o $@ $< diff --git a/ps/module.mk b/ps/module.mk index e3ab74b1..5726ec8d 100755 --- a/ps/module.mk +++ b/ps/module.mk @@ -20,14 +20,14 @@ PS_X := COPYING HACKING TRANSLATION common.h module.mk it p ps.1 regression TARFILES += $(PSSRC) $(addprefix ps/,$(PS_X)) ps/ps: $(PSOBJ) $(LIBPROC) - $(CC) $(LDFLAGS) -o $@ $^ + $(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) -o $@ $^ # This just adds the stacktrace code ps/debug: $(PSOBJ) stacktrace.o $(LIBPROC) - $(CC) -o $@ $^ -lefence + $(CC) $(ALL_CFLAGS) $(ALL_LDFLAGS) -o $@ $^ -lefence $(PSOBJ): %.o: %.c ps/common.h proc/$(SONAME) - $(CC) -c $(CFLAGS) $< -o $@ + $(CC) -c $(ALL_CPPFLAGS) $(ALL_CFLAGS) $< -o $@ ps/stacktrace.o: ps/stacktrace.c