From: teodor Date: Thu, 26 Oct 2006 12:18:44 +0000 (+0000) Subject: Remove making of library: now just linking nesessary object files X-Git-Url: http://sigaev.ru/git/gitweb.cgi?a=commitdiff_plain;h=4dac833f9fc978646c9202f789e437f175db7215;p=ftsbench.git Remove making of library: now just linking nesessary object files --- diff --git a/Makefile b/Makefile index c9a1c8a..b6639c6 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,13 @@ topbuilddir=. PROGRAM=ftsbench stopfilter +PROGRAMOBJ_ftsbench = rand.o finnegan.o utils.o WITH_PGSQL=yes WITH_MYSQL=yes -SUBDIRS= -LIBRARY=ftsbench.a -LIBOBJ=rand.o finnegan.o utils.o - ifeq ($(WITH_PGSQL), yes) -LIBOBJ+=pgdriver.o +PROGRAMOBJ_ftsbench+=pgdriver.o PGSQLCFG=/usr/local/pgsql/bin/pg_config EXTRALIB+=-L`$(PGSQLCFG) --libdir` -lpq -L/usr/lib -lcrypt EXTRAINCLUDE+=-I`$(PGSQLCFG) --includedir` @@ -18,7 +15,7 @@ EXTRAFLAGS+=-DWITH_PGSQL endif ifeq ($(WITH_MYSQL), yes) -LIBOBJ+=mysqldriver.o +PROGRAMOBJ_ftsbench+=mysqldriver.o MYSQLCFG=/usr/local/mysql/bin/mysql_config EXTRALIB+=`$(MYSQLCFG) --libs_r` EXTRAINCLUDE+=`$(MYSQLCFG) --cflags` diff --git a/Makefile.global b/Makefile.global index 5232a32..601c037 100644 --- a/Makefile.global +++ b/Makefile.global @@ -35,10 +35,6 @@ ifdef SUBDIRS SUBDIROBJS := $(SUBDIRS:%=%/SUBSYS.o) endif -ifdef PROGRAM -PROGRAMOBJ := $(PROGRAM:%=%.o) -endif - .SUFFIXES: .o.c .c.o: @@ -46,13 +42,19 @@ endif all: $(SUBSYS) $(LIBRARY) $(PROGRAM) +define prog_dep + $(1): $$(PROGRAMOBJ_$(1)) +endef + +$(foreach prog,$(PROGRAM),$(eval $(call prog_dep,$(prog)))) + ifdef PROGRAM ifdef LIBRARY $(PROGRAM): $(LIBRARY) endif $(PROGRAM): %: %.o - $(CC) -o $@ $< $(LIBRARY) $(LIB) + $(CC) -o $@ $< $(PROGRAMOBJ_$(@)) $(LIBRARY) $(LIB) endif ifdef LIBRARY @@ -70,18 +72,17 @@ ifdef SUBDIRS $(SUBDIROBJS): $(SUBDIRS:%=%-recursive) ; $(SUBDIRS:%=%-recursive): - $(MAKE) -C $(subst -recursive,,$@) -f Makefile SUBSYS.o + $(MAKE) -C $(subst -recursive,,$@) -f Makefile OS=$(OS) SUBSYS.o endif clean: -ifdef OBJ - rm -rf $(OBJ) -endif ifdef LIBOBJ rm -rf $(LIBOBJ) endif ifdef PROGRAM - rm -rf $(PROGRAM) $(PROGRAMOBJ) *core core.* + rm -rf $(PROGRAM) + rm -rf $(foreach P, $(PROGRAM), $P.o $(PROGRAMOBJ_$(P))) + rm -rf *core core.* endif ifdef LIBRARY rm -rf $(LIBRARY) @@ -90,5 +91,5 @@ ifdef SUBOBJ rm -rf $(SUBOBJ) $(SUBSYS) endif ifdef SUBDIRS - for dir in $(SUBDIRS); do $(MAKE) -f Makefile -C $$dir clean || exit; done + for dir in $(SUBDIRS); do $(MAKE) -f Makefile -C $$dir OS=$(OS) clean || exit; done endif