#===================================================================== # FILL IN THE BLANKS! # if possible do not change this file directly, instead: # (1) create a file Makefile.vars where you override the default # values of the variables below # (2) create a file Makefile.rules where you add new rules and # dependencies specific to your package # this makes it easier to upgrade your package to a new ozskel # version # # PKG_NAME # the name of your package. This is used as the base name for # creating distribution files (e.g. `tgz' and `zip' files). # Make sure you pick a name such that adding a `tgz' or `zip' # extension results in a filename that does not conflict with # any file or directory existing or created by your package. # PKG_MOGUL_URI # is the URI that uniquely identifies your package in the MOGUL # database. # PKG_URI # is the base URI for the modules in your package. This is # what's going to be used in `import' specifications. # PKG_URI_AUX # this is a sub URI for auxiliary modules and files that you # don't want to expose at the same level as the base URI, but # prefer to isolate in their own directory. # PKG_SOURCES # All the source files for your application. This is used for # creating source distributions. # PKG_INSTALLS # These are the filenames of the main modules of your # applications, e.g. Foo.ozf (i.e. the name of the compiled # functor Foo). They are used to determine what needs to be # installed, and, therefore, what needs to be built. # PKG_INSTALLS_AUX # Auxilliary modules to be installed at the auxiliary URI. # Note that these could also include data files, such as GIF # files etc... # PKG_INSTALLS_DOC # Documentation files to be installed (and therefore to be # built if necessary). # PKG_INSTALLS_BIN # Executable functors and scripts to be installed in $(BINDIR) # i.e. typically ~/.oz/bin # PKG_INSTALLS_INC # include files to be installed in $(INCDIR) i.e. typically # under ~/.oz/include/... using PKG_MOGUL_URI to derive the # proper subdir. # PKG_SUBDIRS # are the immediate subdirectories in which MAKE should recurse # PKG_API # a list of source functor files to hand to ozh for creating the # API documentation # PKG_METHOD # can be set to `find' for forcing the use of find to automati- # cally compute the list of source files to include in your # source archive. or it can be set to `make' to let the makefile # and sub-makefiles decide what to put in the archive. If not # set, its default value is find if PKG_SOURCES is empty and # make otherwise. # PKG_UPDATE # a list of abstract update targets in the set `tgz', `tar', and # `zip'. By default, just `tgz'. #===================================================================== ifndef PKG_NAME PKG_NAME = lewinsky-disaster PKG_MOGUL_URI = mogul:/clinton/lewinsky PKG_URI = x-ozlib://clinton/monica PKG_URI_AUX = $(PKG_URI)/sex-toys endif PKG_SOURCES = PKG_INSTALLS = PKG_INSTALLS_AUX= PKG_INSTALLS_DOC= PKG_INSTALLS_INC= PKG_INSTALLS_BIN= PKG_SUBDIRS = PKG_API = PKG_UPDATE = tgz -include Makefile.vars ifndef PKG_METHOD PKG_METHOD = endif export PKG_NAME export PKG_MOGUL_URI export PKG_URI export PKG_URI_AUX export PKG_METHOD #===================================================================== # DIRECTORIES #===================================================================== VPATH = @srcdir@ SRCDIR = @srcdir@ SRCTOP = @top_srcdir@ BUILDDIR = $(shell pwd) BUILDTOP = @buildtop@ PREFIX = @prefix@ OZHOME = @OZHOME@ CACHE = $(PREFIX)/cache DOCDIR = $(PREFIX)/doc BINDIR = $(PREFIX)/bin PKGDIR = $(PREFIX)/pkg INCDIR = $(PREFIX)/include export OZHOME #===================================================================== # TOOLS #===================================================================== OZTOOL_HOST = @VAR_OZTOOL_HOST@ OZTOOL = @VAR_OZTOOL@ OZE = @VAR_OZE@ OZC = $(OZE) @VAR_OZC@ OZL = $(OZE) @VAR_OZL@ OZH = $(OZE) @VAR_OZH@ INSTALL = @VAR_OZINSTALL@ INSTALL_BIN = $(INSTALL) -x INSTALL_FILE = $(INSTALL) -f INSTALL_DIR = $(INSTALL) -d CFLAGS = @CFLAGS@ OZCFLAGS = -z 9 OZLFLAGS = -z 9 OZHFLAGS = PLATFORM = $(shell $(OZTOOL) platform) ZIP = @VAR_ZIP@ COMPRESS = @VAR_COMPRESS@ #===================================================================== # RECURSIVE PROCESSING AND CLEANING UP # note that, when doing `make distclean', it is very important # to first recurse into subdirectories before removing the local # Makefile, otherwise there is no Makefile left to perform the # recursion! #===================================================================== @SET_MAKE@ all:: veryclean:: clean distclean:: veryclean ifdef PKG_SUBDIRS all clean distclean install install.top install.sub install.bin install.doc install.inc echo.api:: @dirs="$(PKG_SUBDIRS)"; \ for i in $$dirs; do \ if (cd $$i && $(MAKE) $@); \ then true; \ else exit 1; \ fi; \ done endif clean:: -rm -f *~ *.o *.so-* *.ozf confdefs.h distclean:: -rm -f config.cache config.log config.status Makefile #===================================================================== # RULES #===================================================================== .PHONY: all all.top all.aux all.bin all.doc \ clean veryclean distclean \ install install.top install.aux install.bin \ install.doc install.api install.src \ tgz update zip tar api update-tgz update-tar \ update-zip install.inc all :: Makefile all.top all.aux all.bin all.top :: $(PKG_INSTALLS) all.aux :: $(PKG_INSTALLS_AUX) all.bin :: $(PKG_INSTALLS_BIN) %.so-$(PLATFORM): %.o $(OZTOOL) ld $< -o $@ %.o: %.cc $(OZTOOL) c++ $(CFLAGS) -c $< -o $@ %.ozf: %.oz $(OZC) $(OZCFLAGS) -c $< -o $@ %.exe: %.ozf $(OZL) $(OZLFLAGS) -x $< -o $@ #===================================================================== # INSTALLATION #===================================================================== LIBPKG_DIR = $(subst //,/,$(subst :/,/,$(PKG_URI))) LIBPKG_DIR_AUX = $(subst //,/,$(subst :/,/,$(PKG_URI_AUX))) LIBPKG_MOGUL_DIR1 = $(subst mogul:,,$(PKG_MOGUL_URI)) LIBPKG_MOGUL_DIR2 = $(subst :/,/,$(LIBPKG_MOGUL_DIR1)) LIBPKG_MOGUL_DIR3 = O_Z_S_K_E_L_$(subst //,/,$(LIBPKG_MOGUL_DIR2)) LIBPKG_MOGUL_DIR4 = $(subst O_Z_S_K_E_L_/,,$(LIBPKG_MOGUL_DIR3)) LIBPKG_MOGUL_DIR = $(subst O_Z_S_K_E_L_,,$(LIBPKG_MOGUL_DIR4)) LIBDIR_TOP = $(CACHE)/$(LIBPKG_DIR) LIBDIR_AUX = $(CACHE)/$(LIBPKG_DIR_AUX) LIBDIR_DOC = $(DOCDIR)/$(LIBPKG_MOGUL_DIR) LIBDIR_INC = $(INCDIR)/$(LIBPKG_MOGUL_DIR) LIBDIR_API = $(LIBDIR_DOC)/API LIBDIR_BIN = $(BINDIR) LIBFILES_TOP = $(addprefix $(LIBDIR_TOP)/,$(PKG_INSTALLS)) LIBFILES_AUX = $(addprefix $(LIBDIR_AUX)/,$(PKG_INSTALLS_AUX)) LIBFILES_BIN = $(addprefix $(LIBDIR_BIN)/,$(PKG_INSTALLS_BIN)) LIBFILES_DOC = $(addprefix $(LIBDIR_DOC)/,$(PKG_INSTALLS_DOC)) LIBFILES_INC = $(addprefix $(LIBDIR_INC)/,$(PKG_INSTALLS_INC)) API_FROM_SRC = $(wildcard $(SRCDIR)/API/*) API_FROM_BUILD = $(wildcard $(BUILDDIR)/API/*) ifndef API_FROM_BUILD API_DIR = $(SRCDIR)/API API_SOURCES = $(API_FROM_SRC) LIBFILES_API = $(patsubst $(SRCDIR)/API/%,$(LIBDIR_API)/%,$(API_FROM_SRC)) else API_DIR = $(BUILDDIR)/API API_SOURCES = $(API_FROM_BUILD) LIBFILES_API = $(patsubst $(BUILDDIR)/API/%,$(LIBDIR_API)/%,$(API_FROM_BUILD)) endif install :: install.top install.aux install.bin install.doc install.api install.inc install.top :: $(LIBFILES_TOP) install.aux :: $(LIBFILES_AUX) install.bin :: $(LIBFILES_BIN) install.doc :: $(LIBFILES_DOC) install.api :: $(LIBFILES_API) install.inc :: $(LIBFILES_INC) $(LIBFILES_TOP): $(LIBDIR_TOP)/% : % $(INSTALL_FILE) $< $@ $(LIBFILES_AUX): $(LIBDIR_AUX)/% : % $(INSTALL_FILE) $< $@ $(LIBFILES_BIN): $(LIBDIR_BIN)/% : % $(INSTALL_BIN) $< $@ $(LIBFILES_DOC): $(LIBDIR_DOC)/% : % $(INSTALL_FILE) $< $@ $(LIBFILES_API): $(LIBDIR_API)/% : API/% $(INSTALL_FILE) $< $@ $(LIBFILES_INC): $(LIBDIR_INC)/% : % $(INSTALL_FILE) $< $@ #===================================================================== # AUTOMATICALLY REMAKE MAKEFILE WHEN NECESSARY # ===================================================================== Makefile: Makefile.in cd $(BUILDTOP) && ./config.status #===================================================================== # API DOCUMENTATION (using ozh) #===================================================================== OZHDIR = $(API_DIR) ECHO_API = $(BUILDTOP)/ozskel_api api:: api.first api.second api.first:: -rm -f $(ECHO_API) $(MAKE) echo.api api.second:: -rm -rf $(OZHDIR) OZLOAD=all=$(SRCDIR):cache=${HOME}/.oz/cache:cache=$(OZHOME)/cache \ $(OZH) $(OZHFLAGS) -o $(OZHDIR) $(shell cat $(ECHO_API)) echo.api:: echo $(addprefix $(SRCDIR)/,$(PKG_API)) >> $(ECHO_API) clean:: -rm -f $(ECHO_API) veryclean:: -rm -rf $(OZHDIR) #===================================================================== # SOURCE TAR BALL #===================================================================== TMP_DIR = $(BUILDTOP)/ozskel_tmpdir TAR_DIR = $(TMP_DIR)/$(PKG_NAME) TGZ_FILE = $(BUILDTOP)/$(PKG_NAME).tgz ZIP_FILE = $(BUILDTOP)/$(PKG_NAME).zip TAR_FILE = $(BUILDTOP)/$(PKG_NAME).tar ifndef PKG_METHOD ifdef PKG_SOURCES PKG_METHOD = make else PKG_METHOD = find endif endif ifeq ($(PKG_METHOD),make) install.src:: @dirs="$(PKG_SUBDIRS)"; \ for i in $$dirs; do \ if (cd $$i && $(MAKE) $@); \ then true; \ else exit 1; \ fi; \ done endif ADMIN_SOURCES = Makefile.in Makefile.vars Makefile.rules \ ozinstall install-sh configure config.sub config.guess ifeq ($(PKG_METHOD),make) ADMIN_SOURCES1 = $(addprefix $(SRCDIR)/,$(ADMIN_SOURCES)) ADMIN_SOURCES2 = $(wildcard $(ADMIN_SOURCES1)) ADMIN_SOURCES3 = $(subst $(SRCDIR)/,,$(ADMIN_SOURCES2)) PKG_SOURCES1 = $(addprefix $(SRCDIR)/,$(PKG_SOURCES)) PKG_SOURCES2 = $(subst $(SRCTOP)/,,$(PKG_SOURCES1)) ALL_PKG_SOURCES = $(ADMIN_SOURCES3) $(PKG_SOURCES2) else FIND_DIRS = $(SRCDIR) FIND_SKIP_DIRS = API CVS SCCS RCS CVS.adm RCSLOG ozskel_tmpdir FIND_SKIP_FILES = aclocal.m4 configure.in config.status config.cache \ config.log Makefile .cvsignore \ *.ozf *.exe *.o *.so-* *~ tags TAGS .make.state .nse_depinfo \ \#* .\#* ,* _$$* *$$ *.old *.bak *.BAK *.orig *.rej .del-* \ *.a *.old *.obj *.so *.Z *.elc *.ln cvslog.* core CVS.adm RCSLOG\ $(PKG_NAME).* FIND_OPTIONS = \ $(patsubst %,\( ! -name '%' -o -prune \),$(FIND_SKIP_DIRS)) \ $(patsubst %,! -name '%',$(FIND_SKIP_FILES)) \ ! -type d FIND_SOURCES = $(shell find $(FIND_DIRS) $(FIND_OPTIONS) -print) ALL_PKG_SOURCES = $(subst $(SRCDIR)/,,$(FIND_SOURCES)) endif ALL_API_SOURCES = $(API_SOURCES) TAR_PKG_SOURCES = $(addprefix $(TAR_DIR)/,$(ALL_PKG_SOURCES)) TAR_API_SOURCES = $(subst $(API_DIR)/,$(TAR_DIR)/API/,$(ALL_API_SOURCES)) $(TGZ_FILE): tgz tgz:: -rm -rf $(TMP_DIR) $(MAKE) install.src cd $(TMP_DIR) && tar zcf $(TGZ_FILE) $(PKG_NAME) $(TAR_FILE): tar tar:: -rm -rf $(TMP_DIR) $(MAKE) install.src cd $(TMP_DIR) && tar cf $(TAR_FILE) $(PKG_NAME) tarz:: $(TAR_FILE).Z %.Z: % $(COMPRESS) -c $< > $@ install.src:: $(TAR_PKG_SOURCES) $(TAR_API_SOURCES) $(TAR_API_SOURCES): $(TAR_DIR)/API/% : $(API_DIR)/% $(INSTALL) -M $< $@ $(TAR_PKG_SOURCES): $(TAR_DIR)/% : $(SRCTOP)/% $(INSTALL) -M $< $@ update:: $(addprefix update-,$(PKG_UPDATE)) clean:: -rm -rf $(TGZ_FILE) $(TAR_FILE).Z $(TMP_DIR) TGZ_FILE_DST = $(subst $(BUILDTOP)/,$(PKGDIR)/,$(TGZ_FILE)) TAR_FILE_DST = $(subst $(BUILDTOP)/,$(PKGDIR)/,$(TAR_FILE).Z) ZIP_FILE_DST = $(subst $(BUILDTOP)/,$(PKGDIR)/,$(ZIP_FILE)) INSTALL_FILES_DST = $(TGZ_FILE_DST) $(TAR_FILE_DST) $(ZIP_FILE_DST) $(INSTALL_FILES_DST): $(PKGDIR)/% : $(BUILDTOP)/% $(INSTALL_FILE) $< $@ update-tgz :: $(TGZ_FILE_DST) update-tarz:: $(TAR_FILE_DST) update-zip :: $(ZIP_FILE_DST) #===================================================================== # ZIP DISTRIBUTIONS #===================================================================== zip: all -rm -rf $(TAR_DIR) $(MAKE) install PREFIX=$(TAR_DIR) cd $(TAR_DIR) && $(ZIP) -r -D $(ZIP_FILE) * clean:: -rm -f $(ZIP_FILE) #===================================================================== # DEBUGGING # in order to build the package with debugging flags on # execute `make debug-all'. In fact `make debug-FOO' invokes # `make FOO' with debugging flags added to the default settings. #===================================================================== debug-%: $(MAKE) $* CFLAGS="-g $(CFLAGS)" OZCFLAGS="-g $(OZCFLAGS)" #===================================================================== # CREATING TAGS FILES #===================================================================== ETAGS_PATTERNS = *.c *.h *.cc *.hh *.el ETAGS_OPTIONS = -false $(patsubst %, -o -name '%',$(ETAGS_PATTERNS)) tags: cd $(BUILDTOP) && \ etags -l none \ --regex='/[ ]*\(proc\|fun\)[ ]*{[ ]*\([a-zA-Z0-9_]+\)/\2/' \ --regex='/.*[ ]class[ ]\([a-zA-Z0-9_]+\)/\1/' \ `find . -name '*.oz' -print` && \ etags -a -l auto \ --regex='/OZ_BI_define([ ]*\([^ ,)]+\)/\1/' \ `find . \( $(ETAGS_OPTIONS) \) -print` -include Makefile.rules