# Generalised Makefile.in # # Copyright 2001,2004 Hugo Mills # # Based on ideas found in the paper "Recursive Make Considered # Harmful" (1997) Peter Miller # A list of modules to build MODULES := organ panpipe # File sources & objects (added to by each module) SRC := # Files to install, in various directories (added to by each module) INSTALL_BIN := INSTALL_SBIN := INSTALL_LOCALSTATE := INSTALL_LIB := # Targets to make (added to by each module) TARGETS := # Other things to distribute EXTRA_DIST := DOC_DIST := doc/notes.txt doc/programmers-reference.txt \ doc/examples/config-file ############################### # Modify above this line only # ############################### ### # Make everything all: targets ### # Include the makefiles for each module MAKEFILES = $(patsubst %,%/Makefile.mk,$(MODULES)) include $(MAKEFILES) # Work out the full list of object files (C and C++ only here) OBJS := $(patsubst %.c,%.o,$(filter %.c,$(SRC))) \ $(patsubst %.cc,%.o,$(filter %.cc,$(SRC))) ### # Tools CXX:=@CXX@ CC:=@CC@ INSTALL:=@INSTALL@ TAR:=@TAR@ COMPRESS:=@COMPRESS@ LIBTOOL:=libtool # -pg -fprofile-arcs CFLAGS:=@CFLAGS@ -Wall CXXFLAGS:=@CXXFLAGS@ -Wall -I. -I @cgicc_includedir@ @LIBXML_CFLAGS@ @SQLITE_CFLAGS@ @PIONNET_CFLAGS@ -DDEBUG -g -O0 #LIBS:=-Xlinker --as-needed @LIBS@ -L/usr/local/lib LIBS:=-Xlinker @LIBS@ -L/usr/local/lib SQLITE_LIBS:=@SQLITE_LIBS@ LIBXML_LIBS:=@LIBXML_LIBS@ PIONNET_LIBS:=@PIONNET_LIBS@ ### # Directories exec_prefix=@exec_prefix@ prefix=@prefix@ ### # All targets targets: config.status config.h $(MAKEFILES) $(TARGETS) POS := @localstatedir@ ### # Clean things up clean: find . \( -name \*~ \ -o -name \*.o \ -o -name \*.d \ -o -name \*.lo \ -o -name core \) \ -exec rm -f \{\} \; rm -f $(TARGETS) realclean: clean find . \( -name \*.d \ -o -name .libs \) \ -exec rm -f \{\} \; ### # Dependency generation include $(filter %.d,$(OBJS:.o=.d)) test: echo $(OBJS) %.d: %.cc ./mkdepend $< $(CXX) $(dir $<) $(CXXFLAGS) >$@ %.d: %.c ./mkdepend $< $(CC) $(dir $<) $(CFLAGS) >$@ ### # Installation of files install: install_bin install_sbin install_lib install_local install_cgi install_web install_data install_bin: $(INSTALL_BIN) mkdir -p @bindir@ ; \ if test ! -z "$(INSTALL_BIN)"; then \ $(INSTALL) -s $(INSTALL_BIN) @bindir@ ; \ fi install_sbin: $(INSTALL_SBIN) mkdir -p @sbindir@ ; \ if test ! -z "$(INSTALL_SBIN)"; then \ $(INSTALL) -s $(INSTALL_SBIN) @sbindir@ ; \ fi install_lib: $(INSTALL_LIB) mkdir -p @libdir@; \ if test ! -z "$(INSTALL_LIB)"; then \ $(INSTALL) -s $(INSTALL_LIB) @libdir@ ; \ fi install_local: $(INSTALL_LOCALSTATE) mkdir -p @localstatedir@ ; \ if test ! -z "$(INSTALL_LOCALSTATE)"; then \ $(INSTALL) -m 0644 $(INSTALL_LOCALSTATE) @localstatedir@ ; \ fi install_cgi: $(INSTALL_CGI) mkdir -p @cgibin@ ; \ if test ! -z "$(INSTALL_CGI)"; then \ $(INSTALL) -s $(INSTALL_CGI) @cgibin@ ; \ fi install_data: $(INSTALL_DATA) mkdir -p @datadir@/calliope/panpipe ; \ for f in $(INSTALL_DATA) ; do \ if test ! -z "$$f"; then \ $(INSTALL) -m 0644 $$f @datadir@/calliope/$$f ; \ fi ; \ done install_web: $(INSTALL_WEB) mkdir -p @webdir@/calliope/panpipe ; \ for f in $(INSTALL_WEB) ; do \ if test ! -z "$$f"; then \ $(INSTALL) -m 0644 $$f @webdir@/calliope/$$f ; \ fi ; \ done ### # Uninstallation of files uninstall: uninstall_bin uninstall_sbin uninstall_local uninstall_bin: -rm -f $(foreach file,$(notdir $(INSTALL_BIN)),@bindir@/$file) uninstall_sbin: -rm -f $(foreach file,$(notdir $(INSTALL_SBIN)),@sbindir@/$file) uninstall_lib: -rm -f $(foreach file,$(notdir $(INSTALL_LIB)),@libdir@/$file) uninstall_local: -rm -f $(foreach file,$(notdir $(INSTALL_LOCALSTATE)),@localstatedir@/$file) uninstall_cgi: -rm -f $(foreach file,$(notdir $(INSTALL_CGI)),@cgidir@/$file) ### # Making a distribution set DIST_FILES := $(SRC_DIST) $(DOC_DIST) $(EXTRA_DIST) \ $(foreach mf,$(MAKEFILES),$(mf).in) Makefile.in \ config.h.in configure.ac configure config.sub config.guess \ mkdepend install-sh stamp-h.in \ CHANGELOG COPYING README TODO PACKAGEVERSION := @PACKAGE@-@VERSION@ DIST_DIR := $(PACKAGEVERSION) TARFILE := $(PACKAGEVERSION).tar@COMPRESS_EXT@ dist: $(TARFILE) # $(DATAFILE_BASIC) $(TARFILE): $(DIST_FILES) mkdir -p $(DIST_DIR) @for d in $(sort $(dir $(DIST_FILES))) ; do \ mkdir -p $(DIST_DIR)/$$d ; \ done @for f in $(DIST_FILES) ; do \ cp $$f $(DIST_DIR)/$$f ; \ done $(TAR) -cf $(PACKAGEVERSION).tar $(DIST_DIR) $(COMPRESS) $(PACKAGEVERSION).tar ### # Libtool support %.lo: %.cc ( cd $(dir $<) ; $(LIBTOOL) --mode=compile $(CXX) $(CXXFLAGS) -I.. -c $(notdir $<) ) ### # Autoconf support configure: configure.ac aclocal.m4 autoconf config.h.in: stamp-h.in stamp-h.in: configure.ac aclocal.m4 autoheader @echo timestamp > stamp-h.in config.h: stamp-h stamp-h: config.h.in config.status ./config.status @echo timestamp >stamp-h aclocal.m4: aclocal #acinclude.m4 %/Makefile.mk: %/Makefile.mk.in ./config.status Makefile: Makefile.in ./config.status config.status: configure ./config.status --recheck