Clean up the build system: - Do NOT use anything outside the directory like an absolute /tmp - Use $(MAKE) to get parallel support - $(DESTDIR) fun - Disable the apache module install, do it from the ebuild Signed-off-by: Robin H. Johnson diff -Nuar --exclude '*.orig' OpenSRF-0.9.orig/Makefile OpenSRF-0.9/Makefile --- OpenSRF-0.9.orig/Makefile 2007-06-21 13:45:35.000000000 -0700 +++ OpenSRF-0.9/Makefile 2008-09-28 21:01:49.000000000 -0700 @@ -1,15 +1,18 @@ all: @echo -e "\n * Run 'make verbose' to see full make output\n" - source install.conf && make -s -C src all + source install.conf && $(MAKE) -s -C src all verbose: - source install.conf && make -C src all + source install.conf && $(MAKE) -C src all jserver: - source install.conf && make -s -C src jserver + source install.conf && $(MAKE) -s -C src jserver install: - source install.conf && make -s -C src install + source install.conf && $(MAKE) -s -C src install + +install-verbose: + source install.conf && $(MAKE) -C src install jserver-install: source install.conf && make -s -C src jserver-install diff -Nuar --exclude '*.orig' OpenSRF-0.9.orig/src/Makefile OpenSRF-0.9/src/Makefile --- OpenSRF-0.9.orig/src/Makefile 2007-07-02 07:24:04.000000000 -0700 +++ OpenSRF-0.9/src/Makefile 2008-09-28 21:00:08.000000000 -0700 @@ -1,15 +1,17 @@ # TOP level 'src' makefile for OpenSRF -export TMPDIR = $(TMP)/opensrf export OPENSRF = opensrf export BINDIR = $(PREFIX)/bin export LIBDIR = $(PREFIX)/lib export PERLDIR = $(LIBDIR)/perl5 export INCLUDEDIR = $(PREFIX)/include +export BUILDDIR = ../../build +export BUILDDIR_SHALLOW = ../build export LDLIBS += -export LDFLAGS += -Wl,-rpath=$(LIBDIR) -L $(TMPDIR) -L . +export LDFLAGS += -Wl,-rpath=$(LIBDIR) -L $(BUILDDIR) -L . +export CFLAGS += -D_LARGEFILE64_SOURCE export CFLAGS += -pipe -g -Wall -O2 -fPIC -I ../../include/ -I$(LIBXML2_HEADERS) -I$(APACHE2_HEADERS) \ -I$(LIBXML2_HEADERS)/libxml -I$(APR_HEADERS) @@ -35,31 +37,31 @@ # -------------------------------------------------------------------------------- prep: - mkdir -p $(TMPDIR) + mkdir -p $(BUILDDIR_SHALLOW) objson/libobjson.so: prep @echo $@ - make -C objson + $(MAKE) -C objson opensrf: objson/libobjson.so - make -C libopensrf - make -C c-apps + $(MAKE) -C libopensrf + $(MAKE) -C c-apps router: opensrf @echo $@ - make -C router + $(MAKE) -C router srfsh: opensrf @echo $@ - make -C srfsh + $(MAKE) -C srfsh gateway: opensrf @echo $@ - make -C gateway + $(MAKE) -C gateway jserver: opensrf @echo $@ - make -C jserver + $(MAKE) -C jserver # -------------------------------------------------------------------------------- @@ -69,60 +71,60 @@ # make sure the install directories exist install-prep: @echo $@ - mkdir -p $(LIBDIR) - mkdir -p $(BINDIR) - mkdir -p $(PERLDIR) - mkdir -p $(INCLUDEDIR) - mkdir -p $(ETCDIR) + mkdir -p $(DESTDIR)$(LIBDIR) + mkdir -p $(DESTDIR)$(BINDIR) + mkdir -p $(DESTDIR)$(PERLDIR) + mkdir -p $(DESTDIR)$(INCLUDEDIR) + mkdir -p $(DESTDIR)$(ETCDIR) objson-install: install-prep @echo $@ - make -C objson install + $(MAKE) -C objson install # installs libopensrf.so, opensrf-c, headers, example configs, and osrf_ctl.sh opensrf-install: objson-install @echo $@ - cp $(TMPDIR)/libopensrf.so $(LIBDIR)/libopensrf.so - cp -r ../include/opensrf $(INCLUDEDIR) - cp libopensrf/opensrf $(BINDIR)/opensrf-c - make -C c-apps install - cp ../bin/osrf_ctl.sh $(BINDIR) - cp ../examples/opensrf.xml.example $(ETCDIR) - cp ../examples/opensrf_core.xml.example $(ETCDIR) - cp ../examples/srfsh.xml.example $(ETCDIR) + cp $(BUILDDIR_SHALLOW)/libopensrf.so $(DESTDIR)$(LIBDIR)/libopensrf.so + cp -r ../include/opensrf $(DESTDIR)$(INCLUDEDIR) + cp libopensrf/opensrf $(DESTDIR)$(BINDIR)/opensrf-c + $(MAKE) -C c-apps install + cp ../bin/osrf_ctl.sh $(DESTDIR)$(BINDIR) + cp ../examples/opensrf.xml.example $(DESTDIR)$(ETCDIR) + cp ../examples/opensrf_core.xml.example $(DESTDIR)$(ETCDIR) + cp ../examples/srfsh.xml.example $(DESTDIR)$(ETCDIR) gateway-install: install-prep opensrf-install @echo $@ - make -C gateway install + $(MAKE) -C gateway install router-install: install-prep opensrf-install @echo $@ - make -C router install + $(MAKE) -C router install srfsh-install: install-prep opensrf-install @echo $@ - make -C srfsh install + $(MAKE) -C srfsh install jserver-install: install-prep @echo $@ - make -C jserver install + $(MAKE) -C jserver install perl-install: install-prep @echo $@ - cp -r perlmods/* $(PERLDIR)/ + cp -r perlmods/* $(DESTDIR)$(PERLDIR)/ # -------------------------------------------------------------------------------- # CLEAN # -------------------------------------------------------------------------------- clean: - make -C libopensrf clean - make -C router clean - make -C gateway clean - make -C jserver clean - make -C objson clean - make -C srfsh clean - make -C c-apps clean - /bin/rm -rf $(TMPDIR) *.o + $(MAKE) -C libopensrf clean + $(MAKE) -C router clean + $(MAKE) -C gateway clean + $(MAKE) -C jserver clean + $(MAKE) -C objson clean + $(MAKE) -C srfsh clean + $(MAKE) -C c-apps clean + /bin/rm -rf $(BUILDDIR_SHALLOW) *.o diff -Nuar --exclude '*.orig' OpenSRF-0.9.orig/src/c-apps/Makefile OpenSRF-0.9/src/c-apps/Makefile --- OpenSRF-0.9.orig/src/c-apps/Makefile 2005-09-12 06:33:26.000000000 -0700 +++ OpenSRF-0.9/src/c-apps/Makefile 2008-09-28 21:00:08.000000000 -0700 @@ -8,18 +8,18 @@ osrf_version.o: osrf_version.c osrf_math.so: osrf_math.o - $(CC) -shared -W1 $(LDLIBS) $(LDFLAGS) osrf_math.o -o $(TMPDIR)/osrf_math.so + $(CC) -shared -W1 $(LDLIBS) $(LDFLAGS) osrf_math.o -o osrf_math.so osrf_dbmath.so: osrf_dbmath.o - $(CC) -shared -W1 $(LDLIBS) $(LDFLAGS) osrf_dbmath.o -o $(TMPDIR)/osrf_dbmath.so + $(CC) -shared -W1 $(LDLIBS) $(LDFLAGS) osrf_dbmath.o -o osrf_dbmath.so osrf_version.so: osrf_version.o - $(CC) -shared -W1 $(LDLIBS) $(LDFLAGS) osrf_version.o -o $(TMPDIR)/osrf_version.so + $(CC) -shared -W1 $(LDLIBS) $(LDFLAGS) osrf_version.o -o osrf_version.so install: - cp $(TMPDIR)/osrf_math.so $(LIBDIR)/ - cp $(TMPDIR)/osrf_dbmath.so $(LIBDIR)/ - cp $(TMPDIR)/osrf_version.so $(LIBDIR)/ + cp osrf_math.so $(DESTDIR)$(LIBDIR) + cp osrf_dbmath.so $(DESTDIR)$(LIBDIR) + cp osrf_version.so $(DESTDIR)$(LIBDIR) clean: rm -f *.o *.so diff -Nuar --exclude '*.orig' OpenSRF-0.9.orig/src/gateway/Makefile OpenSRF-0.9/src/gateway/Makefile --- OpenSRF-0.9.orig/src/gateway/Makefile 2006-04-14 08:17:22.000000000 -0700 +++ OpenSRF-0.9/src/gateway/Makefile 2008-09-28 21:03:01.000000000 -0700 @@ -2,14 +2,12 @@ CFLAGS += -DASSUME_STATELESS LDLIBS += -lobjson -lopensrf -all: osrf_json_gateway.so copy +all: osrf_json_gateway.so +#robbat2 - DISABLED, we will do this inside the ebuild install: - $(APXS2) -i -a -n osrf_json_gateway osrf_json_gateway.so - cp apachetools.h $(INCLUDEDIR)/opensrf/ - -copy: - cp apachetools.h $(TMPDIR) + cp apachetools.h $(DESTDIR)$(INCLUDEDIR)/opensrf/ +# $(APXS2) -i -a -n osrf_json_gateway osrf_json_gateway.so apachetools.o: apachetools.h apachetools.c $(CC) -c $(CFLAGS) apachetools.c -o $@ @@ -17,9 +15,8 @@ osrf_json_gateway.o: osrf_json_gateway.c $(CC) -c $(CFLAGS) osrf_json_gateway.c -o $@ -osrf_json_gateway.so: copy apachetools.o osrf_json_gateway.o +osrf_json_gateway.so: apachetools.o osrf_json_gateway.o $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -shared -W1 apachetools.o osrf_json_gateway.o -o osrf_json_gateway.so - clean: /bin/rm -f *.o *.so diff -Nuar --exclude '*.orig' OpenSRF-0.9.orig/src/jserver/Makefile OpenSRF-0.9/src/jserver/Makefile --- OpenSRF-0.9.orig/src/jserver/Makefile 2005-10-10 13:22:30.000000000 -0700 +++ OpenSRF-0.9/src/jserver/Makefile 2008-09-28 21:00:08.000000000 -0700 @@ -10,7 +10,7 @@ osrf_chat_main.o: osrf_chat_main.c install: - cp chopchop $(BINDIR) + cp chopchop $(DESTDIR)$(BINDIR) clean: /bin/rm -f *.o chopchop diff -Nuar --exclude '*.orig' OpenSRF-0.9.orig/src/libopensrf/Makefile OpenSRF-0.9/src/libopensrf/Makefile --- OpenSRF-0.9.orig/src/libopensrf/Makefile 2007-06-21 09:22:02.000000000 -0700 +++ OpenSRF-0.9/src/libopensrf/Makefile 2008-09-28 21:00:08.000000000 -0700 @@ -39,10 +39,9 @@ @echo $@ $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -lopensrf opensrf.o -o $@ - # Build the OpenSRF library libopensrf.so: $(TARGETS) - $(CC) -shared -W1 $(LDFLAGS) $(LDLIBS) $(TARGETS) -o $(TMPDIR)/libopensrf.so + $(CC) -shared -W1 $(LDFLAGS) $(LDLIBS) $(TARGETS) -o $(BUILDDIR)/libopensrf.so opensrf.o: opensrf.c @@ -70,4 +69,3 @@ clean: /bin/rm -f *.o libopensrf.so opensrf - diff -Nuar --exclude '*.orig' OpenSRF-0.9.orig/src/objson/Makefile OpenSRF-0.9/src/objson/Makefile --- OpenSRF-0.9.orig/src/objson/Makefile 2007-06-21 09:19:20.000000000 -0700 +++ OpenSRF-0.9/src/objson/Makefile 2008-09-28 21:00:08.000000000 -0700 @@ -27,7 +27,7 @@ # -------------------------------------------------------------------- OBJS = utils.o json2xml.o object.o json_parser.o xml2json.o -CFLAGS += -DSTRICT_JSON_WRITE -DOSRF_DISABLE_MD5 +CFLAGS += -DSTRICT_JSON_WRITE -DOSRF_DISABLE_MD5 -I../../include TARGETS = object.o json_parser.o json2xml.o xml2json.o ../libopensrf/utils.o ../libopensrf/md5.o JSON_INC = ../../include/objson @@ -42,11 +42,11 @@ ../libopensrf/md5.o: ../libopensrf/md5.c ../../include/opensrf/md5.h install: - cp -r ../../include/objson $(INCLUDEDIR) - cp $(TMPDIR)/libobjson.so $(LIBDIR)/libobjson.so + cp -r ../../include/objson $(DESTDIR)$(INCLUDEDIR) + cp $(BUILDDIR)/libobjson.so $(DESTDIR)$(LIBDIR)/libobjson.so libobjson.so: $(TARGETS) - $(CC) -shared -W1 $(TARGETS) -o $(TMPDIR)/libobjson.so + $(CC) -shared -W1 $(TARGETS) -o $(BUILDDIR)/libobjson.so clean: /bin/rm -f *.o *.so diff -Nuar --exclude '*.orig' OpenSRF-0.9.orig/src/router/Makefile OpenSRF-0.9/src/router/Makefile --- OpenSRF-0.9.orig/src/router/Makefile 2005-10-03 15:19:41.000000000 -0700 +++ OpenSRF-0.9/src/router/Makefile 2008-09-28 21:00:08.000000000 -0700 @@ -7,7 +7,7 @@ #osrf_router install: - cp opensrf_router $(BINDIR) + cp opensrf_router $(DESTDIR)$(BINDIR) #opensrf_router: router.o # $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) router.o -o $@ diff -Nuar --exclude '*.orig' OpenSRF-0.9.orig/src/srfsh/Makefile OpenSRF-0.9/src/srfsh/Makefile --- OpenSRF-0.9.orig/src/srfsh/Makefile 2005-09-01 09:15:27.000000000 -0700 +++ OpenSRF-0.9/src/srfsh/Makefile 2008-09-28 21:00:08.000000000 -0700 @@ -9,7 +9,7 @@ srfsh.o: srfsh.c srfsh.h install: - cp srfsh $(BINDIR) + cp srfsh $(DESTDIR)$(BINDIR) clean: /bin/rm -f *.o srfsh