# common makefile for gambit modules, to be included by specific makefile # Copyright (c) 1994-2021 by Marc Feeley, All Rights Reserved. # The specific makefile must contain: # # herefromlib = /// # libfromhere = ../../../.. # as many .. as components in herefromlib # SUBDIRS = # as many as there are subdirs # HEADERS_SCM = foo\#.scm # MODULES_SCM = foo.scm foo.sld test/test.scm # MAIN_MODULES = foo # OTHER_RCFILES = makefile # include $(libfromhere)/module-common.mk herefromroot = lib/$(herefromlib) rootfromhere = $(libfromhere)/.. PACKAGE_SHORTNAME = @PACKAGE_SHORTNAME@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ @SET_MAKE@ srcdir = @srcdir@ VPATH = @srcdir@ srcdirpfx = @srcdirpfx@ C_COMPILER = @C_COMPILER_MF@ C_PREPROC = @C_PREPROC_MF@ FLAGS_OBJ = @FLAGS_OBJ_MF@ FLAGS_DYN = @FLAGS_DYN_MF@ FLAGS_LIB = @FLAGS_LIB_MF@ FLAGS_EXE = @FLAGS_EXE_MF@ FLAGS_OPT = @FLAGS_OPT_MF@ FLAGS_OPT_RTS = @FLAGS_OPT_RTS_MF@ DEFS = @DEFS@ LIBS = @LIBS@ GAMBITLIB_DEFS = @GAMBITLIB_DEFS_MF@ LIB_PREFIX = @LIB_PREFIX@ LIB_VERSION_SUFFIX = @LIB_VERSION_SUFFIX@ LIB_MAJOR_VERSION_SUFFIX = @LIB_MAJOR_VERSION_SUFFIX@ BUILD_TARGETS = @BUILD_TARGETS@ LIB_EXTENSION = @LIB_EXTENSION@ GAMBITLIB = @GAMBITLIB@ GAMBITGSCLIB = @GAMBITGSCLIB@ GAMBITGSILIB = @GAMBITGSILIB@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_LIB = @INSTALL_LIB@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ LN_S = @LN_S@ RANLIB = @RANLIB@ AR = @AR@ RC = @RC@ GIT = @GIT@ HG = @HG@ prefix = @prefix@ exec_prefix = @exec_prefix@ includedir = @includedir@ libdir = @libdir@ bindir = @bindir@ docdir = @docdir@ infodir = @infodir@ emacsdir = @emacsdir@ libexecdir = @libexecdir@ datarootdir = @datarootdir@ datadir = @datadir@ htmldir = @htmldir@ dvidir = @dvidir@ pdfdir = @pdfdir@ psdir = @psdir@ localedir = @localedir@ mandir = @mandir@ .SUFFIXES: RCFILES = $(HEADERS_SCM) $(MODULES_SCM) $(DATA_FILES) $(OTHER_RCFILES) GENDISTFILES = DISTFILES = $(RCFILES) $(GENDISTFILES) INSTFILES_LIB_DATA = $(HEADERS_SCM) $(MODULES_SCM) $(DATA_FILES) MDEFINES = prefix=$(prefix) exec_prefix=$(exec_prefix) \ includedir=$(includedir) libdir=$(libdir) \ bindir=$(bindir) docdir=$(docdir) \ infodir=$(infodir) emacsdir=$(emacsdir) all: core core: core-pre: core-post: bootstrap-pre: bootstrap-post: clean-modules: clean-modules-pre @for subdir in $(SUBDIRS); do \ (cd $$subdir && $(MAKE) $@); \ done clean-modules-pre: @here_prefix="`echo $(herefromlib) | sed -e 's,[^/]*$$,,'`"; \ here_suffix="`echo $(herefromlib) | sed -e 's,.*/,,'`"; \ major=`echo $(PACKAGE_VERSION) | sed -e "s/v//g" -e "s/\.[^.]*\.[^.]*//g"`; \ minor=`echo $(PACKAGE_VERSION) | sed -e "s/v[^.]*\.//g" -e "s/\.[^.]*//g"`; \ revision=`echo $(PACKAGE_VERSION) | sed -e "s/v[^.]*\.[^.]*\.//g" -e "s///g"`; \ version_num=`eval expr "\( 100000 \\* $$major \) + \( 1000 \\* $$minor \) + $$revision"`; \ for target in $(BUILD_TARGETS); do \ for main_mod in $(MAIN_MODULES); do \ mod_dir=""; \ if test "$$main_mod" = "$$here_suffix"; then \ modref="$(herefromlib)"; \ else \ modref="$(herefromlib)/$$main_mod"; \ if test -d "$$main_mod"; then \ mod_dir="$$main_mod/"; \ fi; \ fi; \ build_dir="$$main_mod@gambit$$version_num@$$target"; \ if test -d "$$mod_dir$$build_dir"; then \ echo "removing module $$modref ($(herefromroot)/$$mod_dir$$build_dir)"; \ rm -rf "$$mod_dir$$build_dir"; \ fi; \ done; \ done list-modules: list-modules-pre @here_prefix="`echo $(herefromlib) | sed -e 's,[^/]*$$,,'`"; \ here_suffix="`echo $(herefromlib) | sed -e 's,.*/,,'`"; \ for main_mod in $(MAIN_MODULES); do \ if test "$$main_mod" = "$$here_suffix"; then \ modref="$(herefromlib)"; \ else \ modref="$(herefromlib)/$$main_mod"; \ fi; \ echo "$$modref"; \ done list-modules-pre: @for subdir in $(SUBDIRS); do \ (cd $$subdir && $(MAKE) list-modules); \ done test-modules-all: test-modules-all-pre @for subdir in $(SUBDIRS); do \ (cd $$subdir && $(MAKE) test-modules-all); \ done test-modules-all-pre: @here_prefix="`echo $(herefromlib) | sed -e 's,[^/]*$$,,'`"; \ here_suffix="`echo $(herefromlib) | sed -e 's,.*/,,'`"; \ modref="$(herefromlib)"; \ if test -e "$(libfromhere)/$$modref.sld" -o -e "$(libfromhere)/$$modref.scm" -o -e "$(libfromhere)/$$modref/$${modref##*/}.sld" -o -e "$(libfromhere)/$$modref/$${modref##*/}.scm"; then \ if test -d "test"; then \ echo "*** testing $$modref"; \ @SETDLPATH@ $(rootfromhere)/gsi/gsi@exe@ -:~~bin=$(srcdirpfx)$(rootfromhere)/bin,~~lib=$(srcdirpfx)$(rootfromhere)/lib,~~include=$(srcdirpfx)$(rootfromhere)/include \ -f -e '(current-directory "$(rootfromhere)")' $$modref/test || \ echo "*** ignoring error"; \ else \ echo "*** not testing $$modref (lib/$$modref/test/test.scm missing)"; \ fi; \ fi; test-modules: test-modules-pre @for subdir in $(SUBDIRS); do \ (cd $$subdir && $(MAKE) test-modules); \ done test-modules-pre: @here_prefix="`echo $(herefromlib) | sed -e 's,[^/]*$$,,'`"; \ here_suffix="`echo $(herefromlib) | sed -e 's,.*/,,'`"; \ modref="$(herefromlib)"; \ if test -e "$(libfromhere)/$$modref.sld" -o -e "$(libfromhere)/$$modref.scm" -o -e "$(libfromhere)/$$modref/$${modref##*/}.sld" -o -e "$(libfromhere)/$$modref/$${modref##*/}.scm"; then \ if test -d "test"; then \ echo "*** testing $$modref"; \ @SETDLPATH@ $(rootfromhere)/gsi/gsi@exe@ -:~~bin=$(srcdirpfx)$(rootfromhere)/bin,~~lib=$(srcdirpfx)$(rootfromhere)/lib,~~include=$(srcdirpfx)$(rootfromhere)/include \ -f -e '(current-directory "$(rootfromhere)")' $$modref/test; \ else \ echo "*** not testing $$modref (lib/$$modref/test/test.scm missing)"; \ fi; \ fi; modules-pre: @here_prefix="`echo $(herefromlib) | sed -e 's,[^/]*$$,,'`"; \ here_suffix="`echo $(herefromlib) | sed -e 's,.*/,,'`"; \ major=`echo $(PACKAGE_VERSION) | sed -e "s/v//g" -e "s/\.[^.]*\.[^.]*//g"`; \ minor=`echo $(PACKAGE_VERSION) | sed -e "s/v[^.]*\.//g" -e "s/\.[^.]*//g"`; \ revision=`echo $(PACKAGE_VERSION) | sed -e "s/v[^.]*\.[^.]*\.//g" -e "s///g"`; \ version_num=`eval expr "\( 100000 \\* $$major \) + \( 1000 \\* $$minor \) + $$revision"`; \ for target in $(BUILD_TARGETS); do \ for main_mod in $(MAIN_MODULES); do \ mod_dir=""; \ if test "$$main_mod" = "$$here_suffix"; then \ modref="$(herefromlib)"; \ else \ modref="$(herefromlib)/$$main_mod"; \ if test -d "$$main_mod"; then \ mod_dir="$$main_mod/"; \ fi; \ fi; \ need_to_build_module=no; \ build_dir="$$main_mod@gambit$$version_num@$$target"; \ if test ! -d "$$mod_dir$$build_dir" \ -o "$(rootfromhere)/gsc/gsc" -nt "$$mod_dir$$build_dir" \ -o -f "$$mod_dir$$main_mod.sld" -a "$$mod_dir$$main_mod.sld" -nt "$$mod_dir$$build_dir" \ -o -f "$$mod_dir$$main_mod.scm" -a "$$mod_dir$$main_mod.scm" -nt "$$mod_dir$$build_dir" \ -o -f "$$mod_dir$$main_mod#.scm" -a "$$mod_dir$$main_mod#.scm" -nt "$$mod_dir$$build_dir"; then \ need_to_build_module=yes; \ fi; \ if test "$$need_to_build_module" = "yes"; then \ echo ">>>> building module $$modref for $$target"; \ @SETDLPATH@ $(rootfromhere)/gsc/gsc@exe@ -:~~bin=$(srcdirpfx)$(rootfromhere)/bin,~~lib=$(srcdirpfx)$(rootfromhere)/lib,~~include=$(srcdirpfx)$(rootfromhere)/include -f -e "(let ((x (##build-module \"$$mod_dir$$main_mod\" (quote $$target) (quote ((module-ref $$modref)(warnings)))))) (if (not x) (begin (println \"*** module failed to build\") (exit 1))))"; \ else \ echo ">>>> no need to build module $$modref for $$target"; \ fi; \ done; \ done modules-post: install-pre: install-post: core c_libdir="$(DESTDIR)$(prefix)/$(herefromroot)"; \ i_libdir="$(DESTDIR)$(libdir)`echo $(herefromroot)/ | sed -e s:^lib:: -e s:/\\$$::`"; \ t_libdir="$$i_libdir"; \ $(srcdirpfx)$(rootfromhere)/mkidirs "$$i_libdir"; \ if test "@ENABLE_SYMLINKS@" = "yes"; then \ $(srcdirpfx)$(rootfromhere)/mkidirs "$$c_libdir"; \ t_libdir="$$c_libdir"; \ fi; \ for file in $(INSTFILES_LIB_DATA); do \ $(INSTALL_DATA) "$$file" "$$t_libdir/$$file"; \ done; \ for build_dir in *@gambit*; do \ if test -d "$$build_dir"; then \ $(srcdirpfx)$(rootfromhere)/mkidirs "$$t_libdir/$$build_dir"; \ for file in $$build_dir/*; do \ $(INSTALL_PROGRAM) "$$file" "$$t_libdir/$$file"; \ done; \ fi; \ done; \ if test "$$t_libdir" != "$$i_libdir"; then \ r_libdir=`$(rootfromhere)/relpath "$$t_libdir" "$$i_libdir" @ENABLE_MULTIPLE_VERSIONS@`; \ for file in $(INSTFILES_LIB_DATA); do \ (cd "$$i_libdir" && $(LN_S) "$$r_libdir$$file" "$$file"); \ done; \ for build_dir in *@gambit*; do \ if test -d "$$build_dir"; then \ (cd "$$i_libdir" && $(LN_S) "$$r_libdir$$build_dir" "$$build_dir"); \ fi; \ done; \ fi uninstall-pre: uninstall-post: c_libdir="$(DESTDIR)$(prefix)/$(herefromroot)"; \ i_libdir="$(DESTDIR)$(libdir)`echo $(herefromroot)/ | sed -e s:^lib:: -e s:/\\$$::`"; \ t_libdir="$$i_libdir"; \ if test "@ENABLE_SYMLINKS@" = "yes"; then \ t_libdir="$$c_libdir"; \ fi; \ for file in $(INSTFILES_LIB_DATA); do \ rm -f "$$t_libdir/$$file"; \ done; \ for build_dir in *@gambit*; do \ for file in $$build_dir/*; do \ rm -f "$$t_libdir/$$file"; \ done; \ rmdir "$$t_libdir/$$build_dir" 2> /dev/null; \ done; \ if test "$$t_libdir" != "$$i_libdir"; then \ for file in $(INSTFILES_LIB_DATA); do \ rm -f "$$i_libdir/$$file"; \ done; \ fi; \ rmdir "$$t_libdir" 2> /dev/null; \ if test "$$t_libdir" != "$$i_libdir"; then \ rmdir "$$i_libdir" 2> /dev/null; \ fi select-gen-for-commit-pre: select-gen-for-commit-post select-gen-for-commit-post-nonrec: deselect-gen-for-commit-pre: deselect-gen-for-commit-post deselect-gen-for-commit-post-nonrec: mostlyclean-pre: mostlyclean-post mostlyclean-post-nonrec: clean-pre: mostlyclean-pre clean-post clean-post-nonrec: mostlyclean-post-nonrec rm -rf *@gambit* distclean-pre: clean-pre distclean-post distclean-post-nonrec: clean-post-nonrec bootclean-pre: distclean-pre bootclean-post bootclean-post-nonrec: distclean-post-nonrec realclean-pre: bootclean-pre realclean-post realclean-post-nonrec: bootclean-post-nonrec rc-setup-pre: $(RC) add $(RCFILES) rc-setup-post: dist-pre dist-devel-pre: mkdir $(rootfromhere)/$(PACKAGE_TARNAME)/$(herefromroot) chmod 777 $(rootfromhere)/$(PACKAGE_TARNAME)/$(herefromroot) @echo " Copying distribution files:" @for file in $(DISTFILES); do \ echo " $(herefromroot)/$$file"; \ dir=""; \ while [ "$${file#*/}" != "$${file}" ]; do \ temp="$${file#*/}"; \ dir="$$dir$${file%$$temp}"; \ mkdir $(rootfromhere)/$(PACKAGE_TARNAME)/$(herefromroot)/$$dir; \ file="$$temp"; \ done; \ ln $(srcdirpfx)$$dir$$file $(rootfromhere)/$(PACKAGE_TARNAME)/$(herefromroot)/$$dir 2> /dev/null \ || cp -p $(srcdirpfx)$$dir$$file $(rootfromhere)/$(PACKAGE_TARNAME)/$(herefromroot)/$$dir; \ done dist-post dist-devel-post: core-recursive bootstrap-recursive modules-recursive install-recursive uninstall-recursive select-gen-for-commit-recursive deselect-gen-for-commit-recursive mostlyclean-recursive clean-recursive distclean-recursive bootclean-recursive realclean-recursive rc-setup-recursive dist-recursive dist-devel-recursive: @if test -n "$(SUBDIRS)"; then \ for subdir in ""$(SUBDIRS); do \ target=`echo $@ | sed 's/-recursive//'`; \ (cd $$subdir && $(MAKE) $$target) || exit 1; \ done \ fi core: core-post core-post: core-recursive core-recursive: core-pre bootstrap: bootstrap-post bootstrap-post: bootstrap-recursive bootstrap-recursive: bootstrap-pre modules: modules-post modules-post: modules-recursive modules-recursive: modules-pre install: install-post install-post: install-recursive install-recursive: install-pre uninstall: uninstall-post uninstall-post: uninstall-recursive uninstall-recursive: uninstall-pre select-gen-for-commit: select-gen-for-commit-post select-gen-for-commit-post: select-gen-for-commit-recursive select-gen-for-commit-post-nonrec select-gen-for-commit-recursive: select-gen-for-commit-pre deselect-gen-for-commit: deselect-gen-for-commit-post deselect-gen-for-commit-post: deselect-gen-for-commit-recursive deselect-gen-for-commit-post-nonrec deselect-gen-for-commit-recursive: deselect-gen-for-commit-pre mostlyclean: mostlyclean-post mostlyclean-post: mostlyclean-recursive mostlyclean-post-nonrec mostlyclean-recursive: mostlyclean-pre clean: clean-post clean-post: clean-recursive clean-post-nonrec clean-recursive: clean-pre distclean: distclean-post distclean-post: distclean-recursive distclean-post-nonrec distclean-recursive: distclean-pre bootclean: bootclean-post bootclean-post: bootclean-recursive bootclean-post-nonrec bootclean-recursive: bootclean-pre realclean: realclean-post realclean-post: realclean-recursive realclean-post-nonrec realclean-recursive: realclean-pre rc-setup: rc-setup-post rc-setup-post: rc-setup-recursive rc-setup-recursive: rc-setup-pre dist: dist-post dist-post: dist-recursive dist-recursive: dist-pre dist-devel: dist-devel-post dist-devel-post: dist-devel-recursive dist-devel-recursive: dist-devel-pre # Tell versions [3.59,3.63) of GNU make not to export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: