Skip to contentSkip to conversation

Fixup Makefiles

multipath-tools Hannes Reinecke 1 participant 1 message Dec 9, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Christophe,

this patch cleans up the Makefiles. I've splitup CFLAGS so that you now can specify an optimisation flags via 'OPTFLAGS' from the commandline (overriding the default). It also cleans up the Makefiles, moving common parts into Makefile.inc, deleting left-over tabs etc.

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke			[email protected]
SuSE Linux Products GmbH		S390 & zSeries
Maxfeldstraße 5				+49 911 74053 688
90409 Nürnberg				http://www.suse.de

Makefile cleanup

Fixup CFLAGS so that it can be adjusted by setting 'OPTFLAGS' from the commandline.
General cleanup of Makefiles; move common parts into Makefile.inc.

Makefile.inc +9 -1
@@ -25,9 +25,17 @@ exec_prefix = $(prefix)
 bindir      = $(exec_prefix)/sbin
 checkersdir = $(TOPDIR)/libcheckers
 multipathdir = $(TOPDIR)/libmultipath
-mandir      = /usr/share/man/man8
+mandir      = $(prefix)/usr/share/man/man8
+rcdir	    = $(prefix)/etc/init.d
 
 GZIP        = /bin/gzip -9 -c
 
 CHECKERSLIB = $(checkersdir)/libcheckers
 MULTIPATHLIB = $(multipathdir)/libmultipath
+
+OPTFLAGS     = -pipe -g -Wall -Wunused -Wstrict-prototypes
+CFLAGS	     = $(OPTFLAGS)
+
+%.o:	%.c
+	$(CC) $(CFLAGS) -c -o $@ $<
+
devmap_name/Makefile +1 -2
@@ -6,7 +6,6 @@ BUILD = glibc
 include ../Makefile.inc
 
 OBJS = devmap_name.o
-CFLAGS = -pipe -g -Wall -Wunused -Wstrict-prototypes
 
 ifeq ($(strip $(BUILD)),klibc)
 	OBJS += $(libdm)
@@ -24,7 +23,7 @@ prepare:
 glibc: prepare $(OBJS)
 	$(CC) $(OBJS) -o $(EXEC) $(LDFLAGS)
 	$(GZIP) $(EXEC).8 > $(EXEC).8.gz
-	
+
 klibc: prepare $(OBJS)
 	$(CC) -static -o $(EXEC) $(OBJS)
 	$(GZIP) $(EXEC).8 > $(EXEC).8.gz
kpartx/Makefile +1 -1
@@ -6,7 +6,7 @@ BUILD=glibc
 
 include ../Makefile.inc
 
-CFLAGS = -pipe -g -Wall -Wunused -Wstrict-prototypes -I. -D_LARGEFILE64_SOURCE
+CFLAGS += -I. -D_LARGEFILE64_SOURCE
 
 ifeq ($(strip $(BUILD)),klibc)
 	OBJS = bsd.o dos.o kpartx.o solaris.o unixware.o gpt.o crc32.o \
libmultipath/Makefile +1 -3
@@ -13,9 +13,7 @@ OBJS = memory.o parser.o vector.o devmap
        switchgroup.o uxsock.o print.o alias.o log_pthread.o \
        log.o configure.o structs_vec.o
 
-CFLAGS = -pipe -g -Wall -Wunused -Wstrict-prototypes
-
-PREVBUILD = $(shell nm debug.o|grep log_safe)
+PREVBUILD = $(shell nm debug.o 2> /dev/null|grep log_safe)
 
 ifeq ($(strip $(DAEMON)),1)
 	CFLAGS += -DDAEMON
multipath/Makefile +2 -3
@@ -7,8 +7,7 @@ include ../Makefile.inc
 
 OBJS = main.o $(MULTIPATHLIB)-$(BUILD).a $(CHECKERSLIB)-$(BUILD).a
 
-CFLAGS = -pipe -g -Wall -Wunused -Wstrict-prototypes \
-	 -I$(multipathdir) -I$(checkersdir)
+CFLAGS += -I$(multipathdir) -I$(checkersdir)
 
 ifeq ($(strip $(BUILD)),klibc)
 	OBJS += $(libdm) $(libsysfs)
@@ -27,7 +26,7 @@ prepare:
 glibc: prepare $(OBJS)
 	$(CC) $(OBJS) -o $(EXEC) $(LDFLAGS)
 	$(GZIP) $(EXEC).8 > $(EXEC).8.gz
-	
+
 klibc: prepare $(OBJS)
 	$(CC) -static -o $(EXEC) $(CRT0) $(OBJS) $(KLIBC) $(LIBGCC)
 	$(GZIP) $(EXEC).8 > $(EXEC).8.gz
multipathd/Makefile +1 -9
@@ -4,17 +4,9 @@ EXEC = multipathd
 include ../Makefile.inc
 
 #
-# directories where to put stuff
-#
-bindir = /usr/bin
-mandir = /usr/share/man/man8
-rcdir = /etc/init.d
-
-#
 # basic flags setting
 #
-CFLAGS = -pipe -g -Wall -Wunused -Wstrict-prototypes \
-	 -DDAEMON -I$(multipathdir) -I$(checkersdir)
+CFLAGS += -DDAEMON -I$(multipathdir) -I$(checkersdir)
 LDFLAGS = -lpthread -ldevmapper -lsysfs -lreadline -lncurses
 
 #
path_priority/pp_alua/Makefile +1 -4
@@ -24,7 +24,7 @@ ifneq ($(shell ls $(TOPDIR)/Makefile.inc
 include $(TOPDIR)/Makefile.inc
 endif
 
-CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -DDEBUG=$(DEBUG)
+CFLAGS += -DDEBUG=$(DEBUG)
 
 all: $(BUILD)
 
@@ -45,9 +45,6 @@ uninstall:
 clean:	
 	rm -f *.o *.gz $(EXEC)
 
-%.o:	%.c
-	$(CC) $(CFLAGS) -c -o $@ $<
-
 $(EXEC).8.gz:	$(EXEC).8
 	$(GZIP) $< >$@
 
path_priority/pp_balance_units/Makefile +3 -4
@@ -9,11 +9,10 @@ TOPDIR	= ../..
 include $(TOPDIR)/Makefile.inc
 
 ifeq ($(strip $(BUILD)),klibc)
-	CFLAGS = -I/usr/include -DDEBUG=$(DEBUG)
+	CFLAGS += -I/usr/include -DDEBUG=$(DEBUG)
 	OBJS = pp_balance_units.o $(MULTIPATHLIB)-$(BUILD).a
 else
-	CFLAGS = -pipe -g -Wall -Wunused -Wstrict-prototypes \
-		 -I$(multipathdir) -DDEBUG=$(DEBUG)
+	CFLAGS += -I$(multipathdir) -DDEBUG=$(DEBUG)
 	LDFLAGS = -ldevmapper
 	OBJS = pp_balance_units.o $(MULTIPATHLIB)-$(BUILD).a
 endif
@@ -27,7 +26,7 @@ prepare:
 
 glibc: prepare $(OBJS)
 	$(CC) -o $(EXEC) $(OBJS) $(LDFLAGS)
-	
+
 klibc: prepare $(OBJS)
 	$(CC) -static -o $(EXEC) $(CRT0) $(OBJS) $(KLIBC) $(LIBGCC)
 
path_priority/pp_emc/Makefile +0 -2
@@ -5,8 +5,6 @@ OBJS		= pp_emc.o
 TOPDIR		= ../..
 include $(TOPDIR)/Makefile.inc
 
-CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes
-
 all: $(BUILD)
 
 glibc:	$(OBJS)
path_priority/pp_netapp/Makefile +0 -5
@@ -5,8 +5,6 @@ OBJS		= pp_netapp.o
 TOPDIR		= ../..
 include $(TOPDIR)/Makefile.inc
 
-CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes
-
 all: $(BUILD)
 
 glibc:	$(OBJS)
@@ -22,6 +20,3 @@ uninstall:
 	rm $(DESTDIR)$(bindir)/$(EXEC)
 clean:	
 	rm -f *.o $(EXEC)
-
-%.o:	%.c
-	$(CC) $(CFLAGS) -c -o $@ $<
path_priority/pp_random/Makefile +0 -5
@@ -5,8 +5,6 @@ OBJS		= pp_random.o
 TOPDIR		= ../..
 include $(TOPDIR)/Makefile.inc
 
-CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes
-
 all: $(BUILD)
 
 glibc:	$(OBJS)
@@ -22,6 +20,3 @@ uninstall:
 	rm $(DESTDIR)$(bindir)/$(EXEC)
 clean:	
 	rm -f *.o $(EXEC)
-
-%.o:	%.c
-	$(CC) $(CFLAGS) -c -o $@ $<
path_priority/pp_tpc/Makefile +0 -5
@@ -5,8 +5,6 @@ OBJS		= pp_tpc.o
 TOPDIR		= ../..
 include $(TOPDIR)/Makefile.inc
 
-CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes
-
 all: $(BUILD)
 
 glibc:	$(OBJS)
@@ -22,6 +20,3 @@ uninstall:
 	rm $(DESTDIR)$(bindir)/$(EXEC)
 clean:	
 	rm -f *.o $(EXEC)
-
-%.o:	%.c
-	$(CC) $(CFLAGS) -c -o $@ $<