Skip to content

Commit

Permalink
Makefile fixes to allow building packages
Browse files Browse the repository at this point in the history
- stop using apxs to install apache module
- add support for DESTDIR
  • Loading branch information
tbonfort committed Nov 15, 2012
1 parent 8dcc65b commit 543f753
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 9 deletions.
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ all: .header
install: .header install-module install-lib install-util install-cgi

install-util: .header install-lib
$(INSTALL) -d $(bindir)
cd util; $(MAKE) $(MFLAGS) install

install-cgi: .header install-lib
cd cgi; $(MAKE) $(MFLAGS) install

install-lib: .header
$(INSTALL) -d $(libdir)
cd lib; $(MAKE) $(MFLAGS) install

module: .header
Expand Down
1 change: 1 addition & 0 deletions Makefile.inc.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ libdir=@libdir@
bindir=@bindir@
top_builddir = @top_builddir@
SHELL = @SHELL@
DESTDIR=

TARGETS=mapcache mapcache_seed @MODULE_TARGET@
APXS=@APXS@
Expand Down
13 changes: 9 additions & 4 deletions apache/Makefile.in
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
include ../Makefile.inc
top_builddir = @top_builddir@
module_dir=`$(APXS) -q LIBEXECDIR`
httpd_inc_dir=-I`apxs -q INCLUDEDIR`

all: mod_mapcache.la


install: mod_mapcache.la
$(APXS) -i -a -n mapcache mod_mapcache.la
$(INSTALL) -d $(DESTDIR)$(module_dir)
$(LIBTOOL) --mode=install $(INSTALL) mod_mapcache.la $(DESTDIR)$(module_dir)

mod_mapcache.la: mod_mapcache.c
@if test ! -f $(libdir)/libmapcache.la; then echo "$(libdir)/libmapcache.la not found, please install before building the mapcache apache module"; exit 1; fi
$(APXS) -Wc,"$(ALL_ENABLED) $(CFLAGS) $(INCLUDES)" -Wl,"$(LIBS)" -c mod_mapcache.c $(libdir)/libmapcache.la
mod_mapcache.lo: mod_mapcache.c
$(LIBTOOL) --tag CC --mode=compile $(CC) $(ALL_ENABLED) $(CFLAGS) $(INCLUDES) $(httpd_inc_dir) -c mod_mapcache.c

mod_mapcache.la: mod_mapcache.lo ../lib/libmapcache.la
$(LIBTOOL) --mode=link --tag CC $(CC) -module -rpath $(module_dir) mod_mapcache.lo $(LIBS) ../lib/libmapcache.la -o $@

clean:
rm -f *.o
Expand Down
3 changes: 2 additions & 1 deletion cgi/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ mapcache: mapcache.c ../lib/libmapcache.la
$(LIBTOOL) --mode=link --tag CC $(CC) -rpath $(bindir) -o mapcache $(CFLAGS) $(ALL_ENABLED) $(INCLUDES) $(FASTCGI_ENABLED) $(FASTCGI_INC) mapcache.c ../lib/libmapcache.la $(LIBS) $(FASTCGI_LIB)

install: mapcache
$(LIBTOOL) --mode=install $(INSTALL) mapcache $(bindir)
$(INSTALL) -d $(DESTDIR)$(bindir)
$(LIBTOOL) --mode=install $(INSTALL) mapcache $(DESTDIR)$(bindir)

clean:
rm -f *.o
Expand Down
3 changes: 2 additions & 1 deletion lib/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ OBJS=$(shell find . -regex '^.*\.c$$' -print |sed "s/^\(.*\)\.c$$/\1.o/")
LOBJS=$(shell find . -regex '^.*\.c$$' -print | sed "s/^\(.*\)\.c$$/\1.lo/")

install: libmapcache.la
$(LIBTOOL) --mode=install $(INSTALL) libmapcache.la $(libdir)
$(INSTALL) -d $(DESTDIR)$(libdir)
$(LIBTOOL) --mode=install $(INSTALL) libmapcache.la $(DESTDIR)$(libdir)

.c.lo:
$(LIBTOOL) --tag CC --mode=compile $(CC) $(ALL_ENABLED) $(CFLAGS) $(INCLUDES) -c $<
Expand Down
3 changes: 2 additions & 1 deletion util/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ mapcache_seed: mapcache_seed.c ../lib/libmapcache.la
$(LIBTOOL) --mode=link --tag CC $(CC) -rpath $(bindir) -o mapcache_seed $(ALL_ENABLED) $(CFLAGS) $(INCLUDES) $(SEEDER_EXTRAINC) mapcache_seed.c ../lib/libmapcache.la $(LIBS) $(SEEDER_EXTRALIBS)

install: mapcache_seed
$(LIBTOOL) --mode=install $(INSTALL) mapcache_seed $(bindir)
$(INSTALL) -d $(DESTDIR)$(bindir)
$(LIBTOOL) --mode=install $(INSTALL) mapcache_seed $(DESTDIR)$(bindir)

clean:
rm -f *.o
Expand Down

0 comments on commit 543f753

Please sign in to comment.