diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /web/glasgow/lit2x-0.16/mkworld |
Initial commit
Diffstat (limited to 'web/glasgow/lit2x-0.16/mkworld')
44 files changed, 15455 insertions, 0 deletions
diff --git a/web/glasgow/lit2x-0.16/mkworld/Jmakefile b/web/glasgow/lit2x-0.16/mkworld/Jmakefile new file mode 100644 index 0000000000..06d7716931 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/Jmakefile @@ -0,0 +1,72 @@ +/* + * partain: from... + * + * $XConsortium: Jmakefile,v 1.7 89/12/12 12:37:28 jim Exp $ + * + * This is used to recreate jmake. Makefile.BOOT is used to generate jmake + * if there is no Makefile in this directory (i.e., the first time). + */ + +#define IHaveSubdirs + +/* just documents subdir */ +#define NoAllTargetForSubdirs +#define NoInstallTargetForSubdirs +#define NoTagTargetForSubdirs + +SUBDIRS = docs + +/* ------------------------- */ + +SRCS_C = jmake.c ccjmake.c +DEPLIBS = +HEADERS = jmakemdep.h + +JCONFIGFILES = $(HEADERS) TEMPLATE.jm \ + install-GEN.jm macros-GEN.jm \ + plat-DEF.jm plat-TRIGGERS.jm \ + plat-mipsriscos.jm plat-sun.jm plat-linux.jm plat-alpha.jm \ + site-DEF.jm site.jm \ + suffixes-GEN.jm utils-GEN.jm + +DEFINES = $(SIGNAL_DEFINES) + +all:: jmake jmkmf + +MsubNeededHere(jmkmf) + +/* override the usual rule */ +#undef JmakeNeededHere +#define JmakeNeededHere(dummy) @@\ +Makefile:: jmake + +/* BUILDING =======================================================*/ + +BuildPgmFromCFiles(jmake,jmake.o,,) + +/* modelled on X11R4's xmkmf (via DuBois) */ +MsubMakefileDependentProgramScriptTarget(PerlCmd,jmkmf,jmkmf.prl,/*no flags*/,/*Makefile*/) + +/* INSTALLATION ===================================================*/ + +INSTDATADIR_MKWORLD = $(INSTDATADIR)/mkworld + +MakeDirectories(install,$(INSTBINDIR) $(INSTSCRIPTDIR) $(INSTDATADIR_MKWORLD)) +InstallBinaryTarget(jmake,$(INSTBINDIR)) + +InstallMsubbedScriptTarget(PerlCmd,jmkmf,jmkmf.prl,$(INSTSCRIPTDIR)) + +InstallScriptTarget(jrestoredeps,$(INSTSCRIPTDIR)) + +jconfigfiles : $(JCONFIGFILES) +InstallTarget(jconfigfiles) +InstallMultNonExecTargets(jconfigfiles,$(JCONFIGFILES),$(INSTDATADIR_MKWORLD)) + +/* OTHER STUFF ===================================================*/ +ExtraStuffToClean(ccjmake) + +ExtraStuffToBeVeryClean( ccjmake $(STD_VERY_CLEAN) $(JCONFIGFILES) ) + +EtagsNeededHere(tags) /* need this to do "make tags" */ +ClearTagsFile() +CTagsTarget( $(SRCS_C) $(JCONFIGFILES) ) diff --git a/web/glasgow/lit2x-0.16/mkworld/Makefile.BOOT b/web/glasgow/lit2x-0.16/mkworld/Makefile.BOOT new file mode 100644 index 0000000000..908a5cb7ff --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/Makefile.BOOT @@ -0,0 +1,80 @@ +# +# WARNING WARNING WARNING WARNING WARNING WARNING WARNING +# +# This is NOT an automatically generated Makefile! It is hand-crafted as a +# bootstrap, may need editing for your system. The BOOTSTRAPCFLAGS variable +# may be given at the top of the build tree for systems that do not define +# any machine-specific preprocessor symbols. +# + +BOOTSTRAPCFLAGS = +PROJECTLABEL = none +SETUPLABEL = std +CDEBUGFLAGS = +CFLAGS = $(BOOTSTRAPCFLAGS) $(CDEBUGFLAGS) +SHELL = /bin/sh +RM = rm -f +MV = mv -f +MAKE = make +CLEAN_CMD = $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a tags TAGS make.log +NPROC = 1 + +TOP = .. +CURRENT_DIR = ./mkworld + +JMAKESRC = $(TOP)/mkworld +JMAKE = $(JMAKESRC)/jmake + +JMAKE_CMD = $(JMAKE) -I$(NEWTOP)$(JMAKESRC) $(BOOTSTRAPCFLAGS) -DTopDir=$(TOP) -DCurDir=$(CURRENT_DIR) $(BOOT_DEFINES) + +LIT2PGM = lit2pgm -q + +.SUFFIXES : .ljm .jm + +.ljm.jm: + $(RM) $@ + $(LIT2PGM) $(LIT2PGMFLAGS) -o $@ $< + @chmod 444 $@ + +all: jmake Makefile + +jmake:: + @echo "making jmake with BOOTSTRAPCFLAGS=$(BOOTSTRAPCFLAGS)" + +jmake:: ccjmake jmake.c + $(CC) -o jmake $(CFLAGS) jmake.c `./ccjmake` + +ccjmake: ccjmake.c + $(CC) -o ccjmake $(CFLAGS) ccjmake.c + +relink: + $(RM) jmake + $(MAKE) $(MFLAGS) jmake + +clean: + $(RM) ccjmake jmake + $(RM) \#* + +depend: + + +# for manual use + +Makefile :: + -@if [ -f Makefile ]; then \ + echo " $(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \ + $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ + else exit 0; fi + $(JMAKE_CMD) + @if cmp -s Makefile Makefile.bak; then $(RM) Makefile.bak ; fi + @chmod 444 Makefile + @echo ==== The new Makefile is for\: ==== + @$(MAKE) whoami + +tags: + +install: + +install_docs: + +Makefiles: diff --git a/web/glasgow/lit2x-0.16/mkworld/Makefile.DUMMY b/web/glasgow/lit2x-0.16/mkworld/Makefile.DUMMY new file mode 100644 index 0000000000..8bd7aa66bb --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/Makefile.DUMMY @@ -0,0 +1,21 @@ +Makefile:: + +Makefiles:: + +depend:: + +all:: + +runtests:: + +install:: + +docs:: + +install_docs:: + +clean:: + +veryclean:: + +tags:: diff --git a/web/glasgow/lit2x-0.16/mkworld/PATCHLEVEL b/web/glasgow/lit2x-0.16/mkworld/PATCHLEVEL new file mode 100644 index 0000000000..2136a5e328 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/PATCHLEVEL @@ -0,0 +1 @@ +Glasgow `make world' configuration system, version 0.16, patchlevel 0 diff --git a/web/glasgow/lit2x-0.16/mkworld/README b/web/glasgow/lit2x-0.16/mkworld/README new file mode 100644 index 0000000000..1bc06e06fc --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/README @@ -0,0 +1,26 @@ +This is the Glasgow "make world" configuration system. We always +distribute as a component of another system (e.g., the Glasgow Haskell +compiler), but it can be used separately. + +It is based on "imake" in the MIT distribution of the X Window System, +as hacked on by Paul DuBois to support "multiple projects". None of +those people would probably recognise it now. + +The instructions for using this system come with the main system (ghc, +nofib, etc.) They may, however, aim you at the documentation here: + + docs/mkworld_guide/mkw_guide.{dvi,info} + general user's guide + + docs/mkworld_ref/mkw_ref.{dvi,info} + reference guide -- actually the ``make world'' + source in literate form. + + docs/<other> documents related to X11 `imake' or Paul + DuBois's variant, the ancestors of this + system. + +Bug reports and comments would be most welcome. + +Will Partain +partain@dcs.glasgow.ac.uk diff --git a/web/glasgow/lit2x-0.16/mkworld/TEMPLATE.jm b/web/glasgow/lit2x-0.16/mkworld/TEMPLATE.jm new file mode 100644 index 0000000000..8fcd80bc73 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/TEMPLATE.jm @@ -0,0 +1,199 @@ +# line 1 "TEMPLATE.ljm" +# line 37 "TEMPLATE.ljm" +#define YES 1 +#define NO 0 + +#if __STDC__ +#define CAT2(a,b) a##b +#define CAT3(a,b,c) a##b##c +#define CAT4(a,b,c,d) a##b##c##d +#define CAT5(a,b,c,d,e) a##b##c##d##e +#else +#define CAT2(a,b) a/**/b +#define CAT3(a,b,c) a/**/b/**/c +#define CAT4(a,b,c,d) a/**/b/**/c/**/d +#define CAT5(a,b,c,d,e) a/**/b/**/c/**/d/**/e +#endif /* not STDC */ +# line 66 "TEMPLATE.ljm" +#include "plat-TRIGGERS.jm" + +/*# Platform-specific stuff was read from: PlatformFile */ +#include PlatformIncludeFile +#include <plat-DEF.jm> +# line 84 "TEMPLATE.ljm" +#if ProjectIsNone == NO +#if SetupIsStd == NO +#include SITE_SETUP_FILE /* site-specific things for a setup of a project */ +#endif +#include SITE_PROJECT_FILE /* site-specific things for a project */ +#endif /* Project != none */ + +#include <site.jm> /* project-independent site-specific things */ +#include <site-DEF.jm> /* _defaults_ for site-specific things */ +# line 106 "TEMPLATE.ljm" +#if ProjectIsNone == NO +#if SetupIsStd == NO +#include MACROS_SETUP_FILE +#endif +#include MACROS_PROJECT_FILE +#endif /* Project != none */ + +#include <macros-GEN.jm> +# line 123 "TEMPLATE.ljm" +#if ProjectIsNone == NO +#if SetupIsStd == NO +#include ONLY4_SETUP_FILE +#endif +#include ONLY4_PROJECT_FILE +#endif /* Project != none */ +# line 132 "TEMPLATE.ljm" +/*# Project identification -- name, version, and stuff */ +#ifndef ProjectName +#define ProjectName NO_SPECIFIC_PROJECT +#endif +#ifndef ProjectVersion +#define ProjectVersion NO_SPECIFIC_VERSION +#endif +PROJECTNAME = ProjectName +PROJECTVERSION = ProjectVersion +PROJECTLABEL = ProjectLabel +SETUPLABEL = SetupLabel +#ifdef HaveProjectMkworldDir +PROJ_MKWORLD_DIR = ProjectMkworldDir +#else +PROJ_MKWORLD_DIR = +#endif +HOSTPLATFORM = HostPlatform +/* HOSTPLATFORM: the platform we expect the thing we are building will run on. */ + +/* BUILDPLATFORM: the platform we are building on NOW (if we can figure it out) + set by the platform-specific files +*/ +# line 163 "TEMPLATE.ljm" +#if ProjectIsNone == NO +#if SetupIsStd == NO +#include SUFFIXES_SETUP_FILE +#endif +#include SUFFIXES_PROJECT_FILE +#endif /* Project != none */ + +#include <suffixes-GEN.jm> +# line 180 "TEMPLATE.ljm" +#if ProjectIsNone == NO +#if SetupIsStd == NO +#include UTILS_SETUP_FILE +#endif +#include UTILS_PROJECT_FILE +#endif /* Project != none */ + +#include <utils-GEN.jm> +# line 197 "TEMPLATE.ljm" +#if ProjectIsNone == NO +#if SetupIsStd == NO +#include INSTALLATION_SETUP_FILE +#endif +#include INSTALLATION_PROJECT_FILE +#endif /* Project != none */ + +#include <install-GEN.jm> +# line 214 "TEMPLATE.ljm" +/* something so "all" is the first target... */ +all :: + +#include INCLUDE_JMAKEFILE +# line 227 "TEMPLATE.ljm" +/*# end of stuff from Jmakefile */ +/*# --------------------------- */ +/*# common end-of-Makefile rules -- (still) DO NOT EDIT !!! */ +/* + * These need to be here so that rules in Jmakefile occur first; the blank + * all is to make sure that an empty Jmakefile doesn't default to make clean. + */ +emptyrule:: + +CleanTarget() + +VeryCleanTarget() + +#ifndef IHaveSpecialMakefileTarget +MakefileTarget() +#endif + +/* tags not in by default: you have to ask: TagsTarget() */ +tags:: + +#ifdef MakefileAdditions +MakefileAdditions() +#endif + + +#ifdef IHaveSubdirs +/*########################################################################### + # rules for building in SUBDIRS - DO NOT EDIT !!! +*/ +#ifndef NoAllTargetForSubdirs +DoAllinSubdirs($(SUBDIRS)) +#endif +#ifndef NoDocsTargetForSubdirs +DoDocsinSubdirs($(SUBDIRS)) +#else +docs:: /* nothing */ +#endif +#ifndef NoRunTestsTargetForSubdirs +RunTestsSubdirs($(SUBDIRS)) +#else +runtests:: + @echo "runtests in $(CURRENT_DIR) done" +#endif +#ifndef NoInstallTargetForSubdirs +InstallSubdirs($(SUBDIRS)) +#else +install:: + @echo "install in $(CURRENT_DIR) done" +#endif +#ifndef NoInstallDocsTargetForSubdirs +InstallDocsSubdirs($(SUBDIRS)) +#else +install_docs:: + @echo "install_docs in $(CURRENT_DIR) done" +#endif +#ifndef NoDependTargetForSubdirs +DependSubdirs($(SUBDIRS)) +#else +depend:: + @echo "depend in $(CURRENT_DIR) done" +#endif +#ifndef NoTagTargetForSubdirs +TagSubdirs($(SUBDIRS)) +#endif + +CleanSubdirs($(SUBDIRS)) +VeryCleanSubdirs($(SUBDIRS)) +MakefileSubdirs($(SUBDIRS)) + +#else +/*########################################################################### + # empty rules for directories that do not have SUBDIRS - DO NOT EDIT !!! +*/ +/* clean and veryclean rules not given here because they're added above... */ + +docs:: + +tags:: + @echo "tags in $(CURRENT_DIR) done" + +runtests:: + @echo "runtests in $(CURRENT_DIR) done" + +install:: + @echo "install in $(CURRENT_DIR) done" + +install_docs:: + @echo "install_docs in $(CURRENT_DIR) done" + +Makefiles:: + +depend:: + @echo "depend in $(CURRENT_DIR) done" + +#endif /* if subdirectory rules are needed */ diff --git a/web/glasgow/lit2x-0.16/mkworld/TEMPLATE.ljm b/web/glasgow/lit2x-0.16/mkworld/TEMPLATE.ljm new file mode 100644 index 0000000000..43fd2a404b --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/TEMPLATE.ljm @@ -0,0 +1,322 @@ +%************************************************************************ +%* * +\section[mkworld-TEMPLATE]{Main ``mkworld'' template; slurps in ...} +%* * +%************************************************************************ + +\begin{pseudocode} +#define JMAKE_TEMPLATE "TEMPLATE.jm" +#define INCLUDE_JMAKEFILE <Jmakefile> +#define SetupLabel std +#define SetupIsStd 1 +#define ProjectLabel none +#define ProjectIsNone 1 +#define SITE_SETUP_FILE <site-none-std.jm> +#define SITE_PROJECT_FILE <site-none.jm> +#define ONLY4_SETUP_FILE <only4-none-std.jm> +#define ONLY4_PROJECT_FILE <only4-none.jm> +#define SUFFIXES_SETUP_FILE <suffixes-none-std.jm> +#define SUFFIXES_PROJECT_FILE <suffixes-none.jm> +#define MACROS_SETUP_FILE <macros-none-std.jm> +#define MACROS_PROJECT_FILE <macros-none.jm> +#define UTILS_SETUP_FILE <utils-none-std.jm> +#define UTILS_PROJECT_FILE <utils-none.jm> +#define INSTALLATION_SETUP_FILE <install-none-std.jm> +#define INSTALLATION_PROJECT_FILE <install-none.jm> +\end{pseudocode} + + +This is the main template that is ``filled in'' by the @mkworld@ +configuration system, to create a Makefile. + +This whole scheme is derived from the fine work on a ``multi-project +Imake'' by Paul DuBois at the Wisconsin Regional Primate Research Center. + +First some pervasive, needed-everywhere definitions: +\begin{code} +#define YES 1 +#define NO 0 + +#if __STDC__ +#define CAT2(a,b) a##b +#define CAT3(a,b,c) a##b##c +#define CAT4(a,b,c,d) a##b##c##d +#define CAT5(a,b,c,d,e) a##b##c##d##e +#else +#define CAT2(a,b) a/**/b +#define CAT3(a,b,c) a/**/b/**/c +#define CAT4(a,b,c,d) a/**/b/**/c/**/d +#define CAT5(a,b,c,d,e) a/**/b/**/c/**/d/**/e +#endif /* not STDC */ +\end{code} + +%************************************************************************ +%* * +\subsection[mkworld-template-platform]{Platform-specific things} +%* * +%************************************************************************ + +@plat-TRIGGERS.jm@ uses the ``trigger'' symbols to decide what +platform-specific stuff to drag in; then it is so dragged. + +Defaults for any platform-ish things can be defined in @plat-GEN.jm@, +with overrides in the individual platform-configuration files. + +\begin{code} +#include "plat-TRIGGERS.jm" + +/*# Platform-specific stuff was read from: PlatformFile */ +#include PlatformIncludeFile +#include <plat-DEF.jm> +\end{code} + +%************************************************************************ +%* * +\subsection[mkworld-template-site]{Site-specific things} +%* * +%************************************************************************ + +Site-specific configuration stuff is, by definition, to override +default definitions to satisfy the needs of a particular ((setup of a) +project at a) site. + +\begin{code} +#if ProjectIsNone == NO +#if SetupIsStd == NO +#include SITE_SETUP_FILE /* site-specific things for a setup of a project */ +#endif +#include SITE_PROJECT_FILE /* site-specific things for a project */ +#endif /* Project != none */ + +#include <site.jm> /* project-independent site-specific things */ +#include <site-DEF.jm> /* _defaults_ for site-specific things */ +\end{code} + + +%************************************************************************ +%* * +\subsection[mkworld-template-macros]{Main mkworld CPP macros} +%* * +%************************************************************************ + +These don't generate any Makefile text, just define macros to be used +later. They have to come early, notably before the ONLY4 stuff. + +\begin{code} +#if ProjectIsNone == NO +#if SetupIsStd == NO +#include MACROS_SETUP_FILE +#endif +#include MACROS_PROJECT_FILE +#endif /* Project != none */ + +#include <macros-GEN.jm> +\end{code} + +%************************************************************************ +%* * +\subsection[mkworld-template-only4]{Extra things ``only for'' a specific project} +%* * +%************************************************************************ + +\begin{code} +#if ProjectIsNone == NO +#if SetupIsStd == NO +#include ONLY4_SETUP_FILE +#endif +#include ONLY4_PROJECT_FILE +#endif /* Project != none */ +\end{code} + +\begin{code} +/*# Project identification -- name, version, and stuff */ +#ifndef ProjectName +#define ProjectName NO_SPECIFIC_PROJECT +#endif +#ifndef ProjectVersion +#define ProjectVersion NO_SPECIFIC_VERSION +#endif +PROJECTNAME = ProjectName +PROJECTVERSION = ProjectVersion +PROJECTLABEL = ProjectLabel +SETUPLABEL = SetupLabel +#ifdef HaveProjectMkworldDir +PROJ_MKWORLD_DIR = ProjectMkworldDir +#else +PROJ_MKWORLD_DIR = +#endif +HOSTPLATFORM = HostPlatform +/* HOSTPLATFORM: the platform we expect the thing we are building will run on. */ + +/* BUILDPLATFORM: the platform we are building on NOW (if we can figure it out) + set by the platform-specific files +*/ +\end{code} + +%************************************************************************ +%* * +\subsection[mkworld-template-suffixes]{Suffix rules} +%* * +%************************************************************************ + +\begin{code} +#if ProjectIsNone == NO +#if SetupIsStd == NO +#include SUFFIXES_SETUP_FILE +#endif +#include SUFFIXES_PROJECT_FILE +#endif /* Project != none */ + +#include <suffixes-GEN.jm> +\end{code} + +%************************************************************************ +%* * +\subsection[mkworld-template-utils]{``Utilities''} +%* * +%************************************************************************ + +\begin{code} +#if ProjectIsNone == NO +#if SetupIsStd == NO +#include UTILS_SETUP_FILE +#endif +#include UTILS_PROJECT_FILE +#endif /* Project != none */ + +#include <utils-GEN.jm> +\end{code} + +%************************************************************************ +%* * +\subsection[mkworld-template-installation]{Installation stuff} +%* * +%************************************************************************ + +\begin{code} +#if ProjectIsNone == NO +#if SetupIsStd == NO +#include INSTALLATION_SETUP_FILE +#endif +#include INSTALLATION_PROJECT_FILE +#endif /* Project != none */ + +#include <install-GEN.jm> +\end{code} + +%************************************************************************ +%* * +\subsection[mkworld-template-dir-specific]{Bring in directory-specific stuff (@Jmakefile@)} +%* * +%************************************************************************ + +\begin{code} +/* something so "all" is the first target... */ +all :: + +#include INCLUDE_JMAKEFILE +\end{code} + +%************************************************************************ +%* * +\subsection[mkworld-template-end-Makefile]{Common end-of-Makefile stuff} +%* * +%************************************************************************ + +\begin{code} +/*# end of stuff from Jmakefile */ +/*# --------------------------- */ +/*# common end-of-Makefile rules -- (still) DO NOT EDIT !!! */ +/* + * These need to be here so that rules in Jmakefile occur first; the blank + * all is to make sure that an empty Jmakefile doesn't default to make clean. + */ +emptyrule:: + +CleanTarget() + +VeryCleanTarget() + +#ifndef IHaveSpecialMakefileTarget +MakefileTarget() +#endif + +/* tags not in by default: you have to ask: TagsTarget() */ +tags:: + +#ifdef MakefileAdditions +MakefileAdditions() +#endif + + +#ifdef IHaveSubdirs +/*########################################################################### + # rules for building in SUBDIRS - DO NOT EDIT !!! +*/ +#ifndef NoAllTargetForSubdirs +DoAllinSubdirs($(SUBDIRS)) +#endif +#ifndef NoDocsTargetForSubdirs +DoDocsinSubdirs($(SUBDIRS)) +#else +docs:: /* nothing */ +#endif +#ifndef NoRunTestsTargetForSubdirs +RunTestsSubdirs($(SUBDIRS)) +#else +runtests:: + @echo "runtests in $(CURRENT_DIR) done" +#endif +#ifndef NoInstallTargetForSubdirs +InstallSubdirs($(SUBDIRS)) +#else +install:: + @echo "install in $(CURRENT_DIR) done" +#endif +#ifndef NoInstallDocsTargetForSubdirs +InstallDocsSubdirs($(SUBDIRS)) +#else +install_docs:: + @echo "install_docs in $(CURRENT_DIR) done" +#endif +#ifndef NoDependTargetForSubdirs +DependSubdirs($(SUBDIRS)) +#else +depend:: + @echo "depend in $(CURRENT_DIR) done" +#endif +#ifndef NoTagTargetForSubdirs +TagSubdirs($(SUBDIRS)) +#endif + +CleanSubdirs($(SUBDIRS)) +VeryCleanSubdirs($(SUBDIRS)) +MakefileSubdirs($(SUBDIRS)) + +#else +/*########################################################################### + # empty rules for directories that do not have SUBDIRS - DO NOT EDIT !!! +*/ +/* clean and veryclean rules not given here because they're added above... */ + +docs:: + +tags:: + @echo "tags in $(CURRENT_DIR) done" + +runtests:: + @echo "runtests in $(CURRENT_DIR) done" + +install:: + @echo "install in $(CURRENT_DIR) done" + +install_docs:: + @echo "install_docs in $(CURRENT_DIR) done" + +Makefiles:: + +depend:: + @echo "depend in $(CURRENT_DIR) done" + +#endif /* if subdirectory rules are needed */ +\end{code} diff --git a/web/glasgow/lit2x-0.16/mkworld/ccjmake.c b/web/glasgow/lit2x-0.16/mkworld/ccjmake.c new file mode 100644 index 0000000000..08909fa70a --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/ccjmake.c @@ -0,0 +1,21 @@ +/* + * $XConsortium: ccjmake.c,v 1.12 89/10/16 12:09:23 jim Exp $ + * + * Warning: This file must be kept as simple as posible so that it can + * compile without any special flags on all systems. Do not touch it unless + * you *really* know what you're doing. Make changes in jmakemdep.h, not here. + */ + +#define CCJMAKE /* only get jmake_ccflags definitions */ +#include "jmakemdep.h" /* things to set when porting jmake */ + +#ifndef jmake_ccflags +#define jmake_ccflags "-O" +#endif + +main() +{ + write(1, jmake_ccflags, sizeof(jmake_ccflags) - 1); + exit(0); +} + diff --git a/web/glasgow/lit2x-0.16/mkworld/docs/Jmakefile b/web/glasgow/lit2x-0.16/mkworld/docs/Jmakefile new file mode 100644 index 0000000000..1158494761 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/docs/Jmakefile @@ -0,0 +1,9 @@ +#define IHaveSubdirs + +/* just documents here */ +#define NoAllTargetForSubdirs +#define NoInstallTargetForSubdirs +#define NoTagTargetForSubdirs + +SUBDIRS = mkworld_guide \ + mkworld_ref diff --git a/web/glasgow/lit2x-0.16/mkworld/docs/appendix-X11R4.ms b/web/glasgow/lit2x-0.16/mkworld/docs/appendix-X11R4.ms new file mode 100644 index 0000000000..112722b468 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/docs/appendix-X11R4.ms @@ -0,0 +1,2413 @@ +.\" format with +.\" tbl % | xroff -ms | lpr +.\" +.\" revision date - change whenever this file is edited +.ds Rd 28 January 1991 +.\" document revision number - change each time document is released +.ds Rn 1.01 +.\" +.nr PO 1.2i \" page offset 1.2 inches +.nr PD .7v \" inter-paragraph distance +.\" +.EH 'Imake in X11R4'- % -'' +.OH ''- % -'Imake in X11R4' +.OF 'Revision date:\0\0\*(Rd'\s+1\*-MORE DRAFT SCRIBBLINGS\*-\s-1'Printed:\0\0\n(dy \*(MO 19\n(yr' +.EF 'Revision date:\0\0\*(Rd'\s+1\*-MORE DRAFT SCRIBBLINGS\*-\s-1'Printed:\0\0\n(dy \*(MO 19\n(yr' +.\" +.\" +.\" I - italic font (taken from -ms and changed) +.de I +.nr PQ \\n(.f +.if t \&\\$3\\f2\\$1\\fP\&\\$2 +.if n .if \\n(.$=1 \&\\$1 +.if n .if \\n(.$>1 \&\\$1\c +.if n .if \\n(.$>1 \&\\$2 +.. +.\" start block. LP gives a bit extra space. Can say .Ds .IP C, etc. +.de Ds +.if \\n(.$<1 .LP +.if \\n(.$>=1 \\$1 +.if \\n(.$<2 .DS +.if \\n(.$>=2 .DS \\$2 \\$3 \\$4 \\$5 +.. +.\" end block. If arg is given, it replaces the .LP (e.g., .De .IP). +.de De +.DE +.if \\n(.$<1 .LP +.if \\n(.$>=1 \\$1 \\$2 \\$3 \\$4 \\$5 +.. +.\" if the Sy definition changes, there are four symbols which had to be +.\" manually formatted and which need to be changed manually, +.\" UNCOMPRESSFILT, BDFTOSNFFILT, SHELLPATH, ZBDFTOSNFFILT +.de Sy \" symbol definition +.br +.ta 6iR +\fB\\$1\fR \\$3 +.br +\0\0default: \\$2 +.. +.de Ru \" imake rule +.br +.ne 3v +.B \\$1 +.. +.NH +Appendix +.LP +.I cpp +symbols and +.I make +variables defined in the X configuration files are listed and described here. +Much of this information can be found in those files and in +.I mit/config/README . +.LP +There are a number of places where I confess ignorance. +If you fill me in on the missing pieces, I'll revise this document. +.LP +Besides symbols used for rule macros, symbols may be classed in +three categories. +Some are used as booleans and are defined as YES or NO. +Some are simply defined as nothing or left undefined. +Boolean and defined/not-defined symbols are rarely if ever +associated with variables appearing in +.I Makefiles ; +rather, they are used for control purposes to modify the configuration +and build process. +.LP +The other symbols are general-purpose, usually (but not always) +having a value that is assigned to some +.I Makefile +variable. +The value may be empty (that is, the symbol may be defined as nothing): +.Ds +.ta 1i 2i +#define \fIsymbol\fR /* as nothing */ +.De +The descriptions below give symbol names, and their defaults and +symbol class where applicable. +A default of ``nothing'' means the empty definition. +.LP +.B Note: +The symbol UseInstalled is not defined in any of the configuration +files. +It should be defined (by you, as nothing) in +.I site.def +if you want to use installed versions of +.I imake , +.I makedepend +and the configuration files. +It can be defined in +.I site.def , +but you must leave it undefined on the initial build, +obviously, since the configuration programs +and files will not have been installed yet. +.NH +Imake.tmpl +.NH 2 +Global Constant Definitions +.LP +This section defines the two symbols YES and NO: +.Ds +.ta 1i 2i +#define YES 1 +#define NO 0 +.De +These are heavily used to define boolean symbols. +.NH 2 +Header Blocks +.LP +Every header block in this section of +.I Imake.tmpl +defines two symbols: +.LP +.Sy MacroIncludeFile <generic.cf> general +.Sy MacroFile generic.cf general +.IP +Both of these name the platform-specific file to be included by the +template after the header block section. +The defaults are deliberately rebarbative and are selected only if the +correct header block for your system was not triggered. +Otherwise these symbols will have values like +.I platform .cf> < +and +.I platform .cf, +where +.I platform +is ``ultrix'', ``sun'', ``hp'', ``apollo'', etc. +.IP +There are two symbols associated with this name because it is used two +different ways. +MacroIncludeFile is used by +.I cpp +to include the platform file. +MacroFile is used to generate file names. +.IP +In addition to the above two symbols, header blocks may define one or more +of the following symbols to indicate the software and/or hardware platform. +.Ds .IP +.ta 3i +AIXArchitecture PS2Architecture +ATTArchitecture PegasusArchitecture +ApolloArchitecture RtArchitecture +CrayArchitecture SGIArchitecture +HPArchitecture SonyArchitecture +IBMArchitecture StellarArchitecture +M4330Architecture SunArchitecture +MacIIArchitecture UltrixArchitecture +MipsArchitecture VaxArchitecture +.De .IP +Some of these symbols may be defined in more than one header block. +The platform file may also define other \fIxxx\fRArchitecture symbols +.I sun.cf ( +does so, for instance, to allow SPARC- or i386-dependencies to be selected.) +.NH +System/Build Definitions +.NH 2 +Preprocessor Symbols +.LP +Symbols are listed in order of their appearance in +.I Imake.tmpl . +The default value of some symbols is determined based +on whether SystemV is YES or NO. +For these symbols both defaults are listed, with the SystemV=YES case first. +.LP +.Sy SystemV varies boolean +.IP +SystemV indicates whether your system is System V based (YES) or not +(NO). +If not, that usually means BSD based. +The default value of many other symbols depends on SystemV, so it is +usually set explicitly early +in the platform-specific file to make sure it's correct. +.LP +.Sy OSMajorVersion "0" general +.Sy OSMinorVersion "0" general +.IP +These two symbols indicate the major and minor version numbers of the +operating system. +They are often used as control symbols in the platform files +to select symbol values that vary depending on the OS version. +For this reason, they are usually set in the platform file. +.IP +Example: if some feature of your OS didn't appear until version 5.7, +you could test for that with: +.Ds .IP +/**/# these definitions would go in the platform file +# ifndef OSMajorVersion +# define OSMajorVersion 5 +# endif +# ifndef OSMinorVersion +# define OSMinorVersion 7 +# endif + +/**/# this test would go wherever you need to test for 5.7 and up +# if OSMajorVersion >= 5 && OSMinorVersion >= 7 + /**/# 5.7-and-up specific stuff here +# endif +.De +.LP +.Sy UnalignedReferencesAllowed "NO" boolean +.IP +Some processors can dereference pointers to arbitrary addresses. +Others cannot\*-inability to dereference odd addresses is a typical problem +for such processors. +If your pointers must be specifically aligned (e.g., on word +boundaries), define UnalignedReferencesAllowed as NO. +The default reflects a conservative approach. +.LP +.Sy ExecableScripts "NO/YES" boolean +.IP +Whether the kernel +.I exec () +system call correctly executes scripts beginning with ``#!''. +ExecableScripts determines the way the CppScriptTarget() rule macro is +expanded and thus the way shell scripts are built. +.IP +Script prototypes begin with a line that says ``#!/bin/sh''. +If ExecableScripts is NO, that line is stripped out and replaced with +one that says ``:''.\** +.FS +I would say that a better way to do it might be to explicitly write +a line into the script using the value of ${SHELL} if ExecableScripts +is YES and ``:'' otherwise. +This would allow the value of SHELL to propagate into scripts were it +defined as something other than +.I /bin/sh . +.FE +.LP +.Sy BourneShell "/bin/sh" general +.IP +Path name of Bourne shell. +This is used to set the value of SHELL, and in construction of some +commands that run shell scripts. +.LP +.Sy ConstructMFLAGS "YES/NO" boolean +.IP +Whether to construct MFLAGS +.I make +variable from MAKEFLAGS. +This is used (I think) for compatibility with versions of +.I make +that use MFLAGS instead of MAKEFLAGS. +.LP +.Sy HasLargeTmp "NO" boolean +.IP +Whether the file system on which +.I /tmp +resides has lots of free space. +The meaning of ``lots'' is roughly 1MB, although that may need to be revised +upward for future releases. +This symbol determines the default value of ArCmd. +.LP +.Sy HasSockets "NO/YES" boolean +.IP +Whether the system has BSD socket support. +.LP +.Sy HasVFork "NO/YES" boolean +.IP +Whether the +.I vfork () +system call is supported. +Presumably this causes +.I fork() +to be used instead of +.I vfork() +if HaveVFork is NO. +.LP +.Sy HasPutenv "NO" boolean +.IP +Whether the +.I putenv () +C library call is supported. +.LP +.Sy HasVoidSignalReturn "YES/NO" boolean +.IP +Whether the +.I signal () +C library call returns +.I void * +(YES) +or +.I int * +(NO). +The default is YES for System V platforms, but +if you have a BSD platform, you should not assume NO. +Some BSD-based systems (e.g., Ultrix and Sun) have changed from +.I int * +to +.I void * +in new OS releases. +Some machines try to support both sets of semantics. +.LP +.Sy HasBsearch "YES/NO" boolean +.IP +Whether the +.I bsearch () +C library call is supported. +.LP +.Sy HasSaberC "NO" boolean +.IP +Whether the system has the Saber C development environment. +The default value of this symbol will usually be overridden in the +platform file. +.B Warning: +some of the platform files define HasSaberC as YES, so be sure to +check this and change it if necessary. +.LP +.Sy HasFortran "NO" boolean +.IP +Whether the system has a FORTRAN compiler. +Needed for GKS support. +.LP +.Sy HasNdbm "NO" boolean +.IP +Whether the system has the NDBM database manager (supercedes DBM). +.LP +.Sy HasDESLibrary "NO" boolean +.IP +Whether the system has a DES (digital encryption standard) library. +.LP +.Sy NeedFunctionPrototypes "NO" boolean +.Sy NeedWidePrototypes "YES" boolean +.IP +These are used to support use of function prototypes. +Apparently they are not well-liked judging from the deprecatory comments +in the latter part of +.I Imake.tmpl . +.LP +.Sy HasSunOSSharedLibraries "NO" boolean +.IP +Whether SunOS shared libraries are supported. +.LP +.Sy SharedCodeDef "varies" general +.IP +Flags to compile sharable library code. +.LP +.Sy SharedLibraryDef "varies" general +.IP +Flags to turn on use of shared libraries. +.LP +.Sy HasSharedLibraries "varies" boolean +.IP +Whether shared libraries are supported. +.B Note: +This symbol is defined +.I inside +the (convoluted) definition of SharedLibraryDef. +.LP +.Sy StripInstalledPrograms "NO" boolean +.IP +If YES, strip symbol table from installed programs, otherwise leave intact. +Setting to YES can save lots of disk space on some machines, but +leaving it as NO can help during debugging. +This symbol affects use of InstPgmFlags. +.LP +.Sy DestDir nothing general +.IP +Prefix to prepend to installation directory pathnames. +Normally this is left empty. +If you want to install under an alternate root, the X folks recommend that +you compile with the default value, then install with +.Ds .IP +make install DESTDIR=/alt/root +.De .LP +.Sy UsrLibDir "$(DESTDIR)/usr/lib" general +.IP +Directory under which to install system libraries (e.g., +.I lint +libraries; see description of LintlibDir under +.I Project.tmpl ). +This is also used as the basis for the default value of LibDir (in +.i Project.tmpl ), which is used for installation of libraries for +.I xdm , +.I awm , +.I twm ... +.LP +.Sy IncRoot "$(DESTDIR)/usr/include" general +.IP +Path to root of system header file hierarchy. +X11 header files are installed under this. +(A default for this symbol is also included in +.I Project.tmpl ; +you can ignore it because the definition in +.I Imake.tmpl +occurs first and will override it.) +.LP +.Sy UNCOMPRESSPATH "/usr/ucb/uncompress" general +.IP +Command to run the +.I uncompress +program. +I think this is used to uncompress compressed font files. +If you override this symbol, the definition should probably be a full +path name. +.LP +.Sy OptimizedCDebugFlags "\-O" general +.IP +C compiler flags to turn on optimization. +.LP +.Sy DebuggableCDebugFlags "\-g" general +.IP +C compiler flags to turn on debugging information. +.LP +.Sy NoOpCDebugFlags nothing general +.IP +C compiler flags to not turn on optimization or debugging. +.LP +.Sy DefaultCDebugFlags "OptimizedCDebugFlags" general +.IP +C compiler flags to turn on optimization for programs. +.LP +.Sy LibraryCDebugFlags "OptimizedCDebugFlags" general +.IP +C compiler flags to turn on optimization for libraries. +.LP +.Sy DefaultCCOptions nothing general +.IP +Special C compiler flags (other than \-I's and \-D's? +See StandardDefines, StandardCppDefines). +Useful, e.g., for turning on floating point options. +.LP +.Sy LibraryCCOptions "DefaultCCOptions" general +.IP +Special C compiler flags for compiling libraries. +.LP +.Sy ServerCCOptions "DefaultCCOptions" general +.IP +Special C compiler flags for compiling the server. +(This is X-specific and should be in +.I Project.tmpl , +perhaps?) +.LP +.Sy PexCDebugFlags "\-g" general +.IP +C compiler flags to turn on debugging information for PEX. +(This is X-specific and should be in +.I Project.tmpl , +perhaps?) +.LP +.Sy InstPgmFlags "\-s" general +.IP +Flags for installing programs. +The default strips symbol tables. +This symbol is used in conjunction with StripInstalledPrograms to set +the +.I make +variable INSTPGMFLAGS. +Note that INSTPGMFLAGS applies to installs of +binary programs and also shell +scripts; some systems give a warning when you try to strip a script +because they have no symbol table (such warnings can be ignored). +.LP +.Sy InstBinFlags "\-m 0755" general +.IP +Flags for setting the mode of installed executable files. +.LP +.Sy InstUidFlags "\-m 4755" general +.IP +Flags for setting the mode of installed set-user-id files (e.g., +.I xterm +needs to +.I chown +pty's). +.LP +.Sy InstLibFlags "\-m 0664" general +.IP +Flags for setting the mode of installed libraries. +.LP +.Sy InstIncFlags "\-m 0444" general +.IP +Flags for setting the mode of installed header files. +.LP +.Sy InstManFlags "\-m 0444" general +.IP +Flags for setting the mode of installed manual pages. +.LP +.Sy InstDatFlags "\-m 0444" general +.IP +Flags for setting the mode of installed data (non-executable) files. +.LP +.Sy InstKmemFlags "InstUidFlags" general +.IP +Flags for installing programs that need to read +.I /dev/kmem , +e.g., +.I xload . +The default makes such programs setuid, which is overkill, since +typically all that's needed is setgid to the group having access to +.I /dev/kmem . +InstKmemFlags +is a good symbol to define in +.I site.def . +Be sure to include the correct group, e.g., ``\-g kmem \-m 2755''. +The group is not set in the default value of this symbol because +it's difficult to determine a good default group. +.LP +.Sy ArCmd "varies" general +.IP +Command to create archive files. +If HasLargeTmp is YES, +.I /tmp +is used for temp file space, otherwise the current directory is used. +.LP +.Sy BootstrapCFlags nothing general +.IP +Defines needed to get +.I ccimake +compiled and by +.I imake +to get +.I cpp +to select the correct header block in +.I Imake.tmpl . +.LP +.Sy CcCmd "cc" general +.IP +Command to run the C compiler. +.LP +.Sy HasGcc "NO" boolean +.IP +Whether GNU CC, +.I gcc , +is available. +.LP +.Sy ServerCcCmd "CcCmd" general +.IP +Command to run the C compiler to compile the server. +(This is X-specific and should be in +.I Project.tmpl , +perhaps?) +.LP +.Sy LibraryCcCmd "CcCmd" general +.IP +Command to run the C compiler to compile libraries. +.LP +.Sy FortranCmd "f77" general +.IP +Command to run the FORTRAN compiler. +.LP +.Sy FortranFlags nothing general +.IP +General flags for FORTRAN compiler. +.LP +.Sy FortranDebugFlags nothing general +.IP +Flags for FORTRAN compiler to turn on debugging information. +.LP +.Sy AsCmd "as" general +.IP +Command to run the assembler. +.LP +.Sy CompressCmd "compress" general +.IP +Command to run +.I compress . +.LP +.Sy CppCmd "/lib/cpp" general +.IP +Command to run C preprocessor. +.LP +.Sy PreProcessCmd "CcCmd \-E" general +.IP +Command to preprocess input. +This is used by the script version of +.I makedepend . +.LP +.Sy InstallCmd "$(SCRIPTSRC)/bsdinst.sh / install" general +.IP +Command to install files. +It should be compatible with the BSD version of +.I install . +.LP +.Sy LdCmd "ld" general +.IP +Command to run the loader. +.LP +.Sy LintCmd "lint" general +.IP +Command to run +.I lint . +.LP +.Sy LintLibFlag "\-o/\-C" general +.IP +Flags to build +.I lint +libraries. +.LP +.Sy LintOpts "\-ax/\-axz" general +.IP +Flags to tell +.I lint +how picky to be. +.LP +.Sy CpCmd "cp" general +.IP +Command to copy files. +.LP +.Sy LnCmd "ln/ln \-s" general +.IP +Command to link files. +Symbolic links are used if available (not System V). +.LP +.Sy MakeCmd "make" general +.IP +Command to run +.I make . +.LP +.Sy MvCmd "mv" general +.IP +Command to rename files. +.LP +.Sy RanlibCmd "/bin/true / ranlib" general +.IP +Command to run +.I ranlib . +On System V platforms this command is missing. +.I /bin/true , +a nop, is used instead. +.I /bin/true "" ( +always succeeds, which is important for +.I make .) +.LP +.Sy RanlibInstFlags nothing general +.IP +Flags to pass to +.I ranlib +when run on libraries that have already been installed. +``\-t'' is a good option here, if you have it. +.LP +.Sy RmCmd "rm \-f" general +.IP +Command to remove files. +.LP +.Sy StandardCppDefines "\-DSYSV/nothing" general +.IP +\-D's for C preprocessor. +.LP +.Sy StandardIncludes nothing general +.IP +\-I's for C compiler. +.LP +.Sy StandardDefines "\-DSYSV/nothing" general +.IP +\-D's for C compiler. +.LP +.Sy NdbmDefines "varies" general +.IP +Flags to turn on NDBM support. +Affected by HasNdbm. +.LP +.Sy ExtraLibraries nothing general +.IP +Extra libraries needed to get programs to compile. +.LP +.Sy ExtraLoadFlags nothing general +.IP +Extra flags needed to get loader to work. +.LP +.Sy LdCombineFlags "\-X \-r" general +.IP +Flags for incremental loader support. +.LP +.Sy CompatibilityFlags nothing general +.IP +Flags to turn on R3 backward compatibility support. +.LP +.Sy TagsCmd "ctags" general +.IP +Command to generate tags files. +.LP +.Sy LoaderLibPrefix nothing general +.IP +Flags to specify before libraries (see +.I cray.cf ). +.LP +.Sy TOPDIR "." general +.Sy CURDIR "." general +.IP +Top of source tree, and current directory. +The +.I make +variables associated with these (TOP, CURRENT_DIR) +are overridden by recursive +.I make +rules. +The defaults are correct for the top of the source tree. +TOP and CURRENT_DIR are reset for each +.I Makefile +during ``make Makefiles''. +TOP is the path to the top of the source tree, from the current +directory. +CURRENT_DIR is the path to the current directory from the top of the +source tree. +.LP +.Sy FilesToClean "*.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut" general +.IP +List of files to be removed by ``make clean''. +Note that ``*~'' is in this list, and see discussion of the +RemoveProgramTarget() rule. +If you are in the habit of using ``cp x x~'' to make a backup copy of +files you modify, ``make clean'' will remove those copies, which may +not be what you want. +.NH 2 +Make Variables +.LP +Many of the +.I make +variables in +.I Imake.tmpl +are simply set to the preprocessor variable of the same name (e.g., +INSTBINFLAGS = InstBinFlags). +.LP +Most +.I make +variables referring to commands are set to the preprocessor symbol having +the same name and a suffix ``Cmd''. +For instance, CC and MAKE are set to CcCmd and MakeCmd, respectively. +.LP +The rest of the variables are set to +preprocessor symbols with names that differ a bit from the variable +name (e.g., SHELL = BourneShell), or are defined in terms of other +.I make +variables (e.g., MFLAGS = -$(MAKEFLAGS)), or a combination of +preprocessor symbols and +.I make +variables (e.g., RM_CMD = $(RM) FilesToClean). +.NH +platform.cf +.LP +Symbols which definitely should be set here are +BuildServer (and X\fIxxx\fRServer if BuildServer is YES), +OSName, OSMajorVersion, and OSMinorVersion. +Some other symbols you should think about setting are +CCompilerMajorVersion, +CCompilerMinorVersion, +BootstrapCFlags, +SystemV, +UnalignedReferencesAllowed, +SetTtyGroup, +ExecableScripts, +and +ConstructMFLAGS. +.NH +site.def +.LP +You should read through the +.I site.def +file and follow the comments there which tell whether you should +supply +override definitions for a number of symbols. +This is the place to indicate whether you have a large temp area +(HasLargeTmp), whether you have GNU +.I cc +(HasGcc), whether you want to compile in R3 backward compatibility +(CompatibilityFlags), etc. +It's also a good place to set symbols such as InstKmemFlags and +BuildExamples. +.NH +Project.tmpl +.NH 2 +Preprocessor Symbols +.LP +Symbols are listed in order of their appearance in +.I Project.tmpl . +.LP +.Sy ProjectX 4 general +.IP +X11 Release number. +The +.I README +says this is a boolean, which is incorrect. +.LP +.Sy BuildServer YES boolean +.IP +Whether to build the server. +This should be defined as NO in +.I site.def +on client-only systems. +On platforms which have no server implementation, the value of +BuildServer may already be set to NO in the platform file. +.LP +.Sy BuildExamples YES boolean +.IP +Whether to build the example programs. +It will speed up your builds to override this as NO, and less disk +space will be used. +.IP +It is probably possible to build selected examples only. +Define BuildExamples as YES, then build all the Makefiles from the +source root. +Then build the ``clean'' and ``depend'' targets. +Define BuildExamples as NO and rebuild the Makefiles. +The examples directories should be left alone since BuildExamples +is NO, but you can then go into an example directory and build the +program since its +.I Makefile +should be correct. +(This is all conjecture.) +.LP +.Sy BuildXawBC NO boolean +.IP +Whether to build backward-compatible X Athena Widgets (I think). +.LP +.Sy InstallXinitConfig NO boolean +.IP +Whether to install sample +.I xinit +configuration files. +.LP +.Sy InstallXdmConfig NO boolean +.IP +Whether to install sample +.I xdm +configuration files. +.LP +.Sy InstallAppDefFiles YES boolean +.IP +Whether to install application defaults +files. +.LP +.Sy InstallOldHeaderFiles NO boolean +.IP +Whether to install R3 header files. +.LP +.Sy DebugLibX NO boolean +.IP +Whether to build debugging into the X library. +.LP +.Sy DebugLibXArchive NO boolean +.IP +Whether to build debugging into the archive file version of the X library. +.LP +.Sy ProfileLibX NO boolean +.IP +Whether to build profiling into the X library. +.LP +.Sy ProfileLibXArchive NO boolean +.IP +Whether to build profiling into the archive file version of the X library. +.LP +.Sy DebugOldLibX NO boolean +.Sy ProfileOldLibX NO boolean +.Sy DebugLibXt NO boolean +.Sy ProfileLibXt NO boolean +.Sy DebugLibXaw NO boolean +.Sy ProfileLibXaw NO boolean +.Sy DebugLibXext NO boolean +.Sy ProfileLibXext NO boolean +.Sy DebugLibXmu NO boolean +.Sy ProfileLibXmu NO boolean +.IP +Whether to build debugging and/or profiling into the old X library, X +Toolkit library, X Athena Widget library, X Extension library or the +X mu library. +.LP +.Sy NeedBerklibInXlib NO boolean +.IP +Whether BSD emulation is needed in Xlib. +If YES, then BandAidLibrary is set to YES, some other related symbols +are defined, and the BandAidLibraryMake() rule macro is defined. +.LP +.Sy ManDirectoryRoot /usr/man general +.IP +Path to the top of the manual page hierarchy relative to the default root +directory. +See also ManPath. +.LP +.Sy ManSuffix n general +.IP +Suffix for program manual pages. +See ManSourcePath, ManDir. +.LP +.Sy LibManSuffix 3 general +.IP +Suffix for library manual pages. +See ManSourcePath, LibmanDir. +.LP +.br +.ta 6iR +\fBUNCOMPRESSFILT\fR general +.br +\0\0default: \-DUNCOMPRESSFILT=\e"UNCOMPRESSPATH\e" +.IP +\-D's to run +.I uncompress . +.LP +.br +.ta 6iR +\fBBDFTOSNFFILT\fR (default: general +.br +\0\0default: \-DBDFTOSNFFILT=\e"$(BINDIR)/bdftosnf\e" +.IP +\-D's to run +.I bdftosnf +to convert fonts from binary distribution format to server natural +format. +.LP +.br +.ta 6iR +\fBSHELLPATH\fR general +.br +\0\0default: \-DSHELLPATH=\e"/bin/sh\e" +.IP +\-D's for command to run the shell. +.LP +.br +.ta 6iR +\fBZBDFTOSNFFILT\fR general +.br +\0\0default: \-DZBDFTOSNFFILT=\e"UNCOMPRESSPATH" | $(BINDIR)/bdftosnf $(FONTCFLAGS)\e"" +.IP +\-D's to run +.I uncompress +and +.I bdftosnf +to convert compressed binary distribution format font files to server natural +format. +.LP +.Sy FontFilters "UNCOMPRESSFILT BDFTOSNFFILT SHELLPATH ZBDFTOSNFFILT" general +.IP +\-D's for font conversion filters. +.LP +.Sy PrimaryScreenResolution 72 general +.IP +Resolution of default server screen, in dots per inch (dpi). +This number applies both to horizontal and to vertical resolution; X +assumes square pixels. +.LP +.Sy DefaultFontPath varies general +.IP +Path to font directory. +If not set somewhere else, a default is guessed, based +on PrimaryScreenResolution, to select between 75 dpi and 100 dpi fonts. +.LP +.Sy DefaultRGBDatabase $(LIBDIR)/rgb general +.IP +Path to RGB color database. +.LP +.Sy FontCompilerFlags \-t general +.IP +Flags for +.I bdftosnf . +.LP +.Sy ConnectionFlags "\-DTCPCONN \-DUNIXCONN" general +.IP +What kinds of connections the server will accept. +Common values are \-DTCPCONN, \-DUNIXCONN, \-DSTREAMSCONN. +More than one can be specified. +If the server is built, at least one must be specified. +.LP +.Sy FontDefines "\-DFONT_SNF \-DFONT_BDF \-DCOMPRESSED_FONTS" general +.IP +\-D's for font options. +.LP +.Sy ExtensionDefines nothing general +.IP +\-D's for server extensions. +Default is nothing, for ``no extensions''. +This is typically overridden in the platform file for servers that +know about particular extensions, or in +.I site.def . +.LP +.Sy ServerCDebugFlags OptimizedCDebugFlags general +.IP +C compiler flags to turn on optimization/debugging in server. +.LP +.Sy LibraryDefines StandardDefines general +.IP +\-D's for compiling libraries. +.LP +.Sy ServerDefines "StandardDefines ExtensionDefines" general +.IP +\-D's for compiling the server. +.LP +.Sy CppSourcesPresent NO boolean +.IP +Whether you have BSD +.I cpp +sources. +.LP +.Sy CppSources /usr/src/lib/cpp general +.IP +Path to BSD +.I cpp +sources. +Not used if CppSourcesPresent is NO. +.LP +.Sy BinDir $(DESTDIR)/usr/bin/X11 general +.IP +Where to install programs. +.LP +.Sy IncRoot $(DESTDIR)/usr/include general +.IP +IGNORE this symbol in +.I Project.tmpl ; +it's redundant. +See its definition in the system/build section of +.I Imake.tmpl . +.LP +.Sy BuildIncRoot $(TOP) general +.IP +Relative path to (parent of) top of header file tree within source tree. +.LP +.Sy BuildIncTop .. general +.IP +Top of header file tree within source tree, relative to $(TOP)/X11. +.LP +.Sy LibDir $(USRLIBDIR)/X11 general +.IP +X library installation directory (other directories are installed under +this, e.g., FontDir, XinitDir). +.LP +.Sy ConfigDir $(LIBDIR)/config general +.IP +Where to install configuration files. +.LP +.Sy LintlibDir $(USRLIBDIR)/lint general +.IP +Where to install lint libraries. +Note that the default uses USRLIBDIR, not LIBDIR. +Also note that the name of this symbol is LintlibDir, not LintLibDir. +.LP +.Sy FontDir $(LIBDIR)/fonts general +.IP +Where to install fonts. +.LP +.Sy AdmDir $(DESTDIR)/usr/adm general +.IP +Where system log files are found. +.LP +.Sy XinitDir $(LIBDIR)/xinit general +.IP +Where to install +.I xinit +files. +.LP +.Sy XdmDir $(LIBDIR)/xdm general +.IP +Where to install +.I xdm +files. +.LP +.Sy XdmConfigurationSubdirectory config/default general +.IP +Default +.I xdm +configuration directory. +.LP +.Sy AwmDir $(LIBDIR)/awm general +.IP +Where to install +.I awm +files. +.LP +.Sy TwmDir $(LIBDIR)/twm general +.IP +Where to install +.I twm +files. +.LP +.Sy GwmDir $(LIBDIR)/gwm general +.IP +Where to install +.I gwm +files. +.LP +.Sy ManPath $(DESTDIR)ManDirectoryRoot general +.IP +Full path to top of manual page hierarchy. +.LP +.Sy ManSourcePath $(MANPATH)/man general +.IP +Path to top of manual page hierarchy, plus common suffix of manual page +directories there. +.LP +.Sy ManDir $(MANSOURCEPATH)ManSuffix general +.IP +Where to install program manual pages. +.LP +.Sy LibmanDir $(MANSOURCEPATH)LibManSuffix general +.IP +Where to install library manual pages. +.LP +.Sy XAppLoadDir $(LIBDIR)/app-defaults general +.IP +Where to install application defaults files. +.LP +.Sy OsNameDefines nothing general +.IP +I don't know what this is used for. +It's referenced in +.I lib/Xdmcp/Imakefile +and +.I lib/Xmu/Imakefile . +.LP +.Sy DefaultUserPath :/bin:/usr/bin:$(BINDIR):/usr/ucb general +.IP +Default +.I xdm +user PATH environment variable. +.LP +.Sy DefaultSystemPath /etc:/bin:/usr/bin:$(BINDIR):/usr/ucb general +.IP +Default +.I xdm +system PATH environment variable. +.LP +.Sy DefaultSystemShell BourneShell general +.IP +Default shell. +.LP +.Sy UseCCMakeDepend NO boolean +.IP +Whether to use the slow shell script version of +.I makedepend +(uses +.I "cc \-E" ). +It's best to use the compiled version if it works on your system. +If the compiled version does not work as supplied with the distribution, +it's probably +worth a little effort to see if you can get it to work +(particularly if you can't get the shell script version to work, +either, which sometimes happens!). +Possible problems: +.I /usr/include +is hardwired into the code; if you use +.I gcc , +the library path is hardwired, too. +.LP +.Sy DependDir "varies" general +.IP +Path to +.I makedepend +sources. +The default is dependent on UseCCMakeDepend. +.LP +.Sy ContribDir $(TOP)/../contrib general +.IP +Top of user-contributed source tree. +.LP +.Sy DependCmd $(DEPENDSRC)/makedepend general +.IP +Command to run +.I makedepend. +.LP +.Sy RemoveTargetProgramByMoving NO boolean +.IP +This symbol affects expansion of the RemoveProgramTarget() rule. +``Program'' in that rule's name is misleading; it can be used to remove any +file, not just programs. +.LP +.Sy AllocateLocalDefines nothing general +.IP +\-D's to turn on +.I alloca (). +.LP +.Sy SharedLibX varies boolean +.Sy SharedOldLibX varies boolean +.Sy SharedLibXt varies boolean +.Sy SharedLibXaw varies boolean +.Sy SharedLibXmu varies boolean +.Sy SharedLibXext varies boolean +.IP +Whether to build shared versions of the X, old X, X Toolkit, X Athena +Widget, X mu or X Extension libraries. +The defaults are YES if HasSunOSSharedLibraries is YES, NO otherwise. +.LP +.Sy SharedXlibRev 4.2 general +.Sy SharedOldXRev 4.0 general +.Sy SharedXtRev 4.0 general +.Sy SharedXawRev 4.0 general +.Sy SharedXmuRev 4.0 general +.Sy SharedXextRev 4.0 general +.IP +Version (revision) numbers of shared libraries. +.LP +.Sy HasInputExtension YES boolean +.IP +Whether there are any input extensions. +.LP +.Sy DoInstallExtensionsIntoXlib NO boolean +.IP +Whether the extension library should be merged into the X library. +.LP +.Sy BandAidLibraryNeeded YES boolean +.Sy BandAidLibrarySources Berklib.c general +.Sy BandAidLibraryObjects Berklib.o general +.LP +.LP +.Sy BandAidLibraryMake() "take a look" general +.LP +.LP +.Sy BandAidLibraryNeeded NO boolean +.IP +Whether a band-aid library is needed. +This will be YES if NeedBerklibInXlib is YES. +.IP +I'm not sure what all the band-aid stuff is for. +Perhaps for BSD socket emulation on System V platforms. +.LP +.Sy XawClientDepLibs "$(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB)" general +.IP +Library dependencies for clients using the Athena Widgets (DEPLIBS). +.LP +.Sy XawClientLibs "$(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)" general +.IP +Library needed by clients using the Athena Widgets (LOCAL_LIBRARIES). +.LP +.Sy NeedDefaultDepLibs YES boolean +.LP +Affects the definitions of DEPLIBS, DEPLIBS1, DEPLIBS1, DEPLIBS3. +.LP +.NH 2 +Make Variables +.LP +Many of the +.I make +variables in +.I Project.tmpl , +like those in +.I Imake.tmpl , +bear a direct name relationship to proprocessor symbols with which they are +associated. +.LP +Since much of the project source and installation directory layout +is specified in this file, the number of variables defined in terms of other +.I make +variables (e.g., XMUSRC = $(LIBSRC)Xmu, DEMOSRC = $(TOP)/demos) is quite large. +.NH +Imake.rules +.LP +The X +.I Imake.rules +file rule definitions make heavy use of the following techniques: +.IP (1) +Use of the ``::'' construct is quite prevalent. +In a +.I make +rule, if a target name is followed by ``:'', it's assumed to be the +only rule for that target. +If another rule with the same target is found, it's an error. +If target names are followed by ``::'', there may be multiple rules +for the targets. +The X configuration files rely on this property of ``::'' in the +following ways: +.RS +.IP (a) +To make sure that certain targets are always present in the +.I Makefile , +even if they are not otherwise generated from expansion of the macros +in +.I Imakefile . +This way, subdirectory-traversing +.I make +operations can rely on those targets being present. +For instance, many rules that build programs automatically generate a +``clean'' target to remove the program. +But if no such rule is used in the +.I Imakefile , +there might be no ``clean'' target in the +.I Makefile , +and ``make clean'' fails. +That's not a disaster, but a ``make clean'' from the root of the +source tree can result in a lot of apparent errors. +To avoid this, an empty ``clean'' target is written to the +.I Makefile , +using ``clean::''. +If there is another ``clean'' target, the empty one doesn't hurt anything. +If there isn't, the empty one prevents error messages. +.IP +Other default targets generated are ``tags'', ``install'', +``install.man'', ``Makefile'', ``Makefiles'' and ``includes''. +.IP (b) +To allow commands like ``make all'' to trigger builds of an arbitrary +number of targets. +Without the ``::'' construct, the configuration process would need to +be able to determine exactly which targets ``make all'' should +generate, and produce a single ``all: target1 target2 ...'' rule. +This would be a difficult task. +Using ``::'', each program-building rule can generate its own ``all:: +target'' and they are all triggered. +.RE +.IP (2) +Definitions are allowed to be overridden. +All rules are defined using the following construct: +.Ds .IP +# ifndef \fIrulename\fR +# define \fIrulename(arguments)\fR ... +# endif +.De .IP +This should look familiar because it's the same construct used +in the other configuration files to allow symbol values to be overridden. +Since +.I Imake.rules +is the last configuration file read during a +.I Makefile +build, +.I any +of its rules may be redefined. +Doing so can have far-reaching consequences, of course, so that's not +something you want to do without thinking it through first. +Nevertheless, it's sometimes useful, or even necessary. +.IP +The likely places for such overriding to occur are: +.IP +.I platform.cf \*-if +a system does things in some strange way that's +not easy to compensate for by defining the usual configuration symbols +properly. +For example, the file +.I sgi.cf +redefines a couple of rules, to account for non-standard file +extensions. +.IP +.I site.def \*-if +a rule just isn't right for your site, for some reason. +.IP +.I Imakefile \*-it's +sometimes useful to override a rule in a particular directory, which +can be done by defining the rule in that directory's +.I Imakefile . +The file +.I config/Imakefile +does this, for instance. +Such redefinitions do +.I not +carry down through subdirectories. +Also, since +.I Imake.rules +is seen before +.I Imakefile , +you need to #undef the macro before redefining it. +.IP (3) +If a directory has subdirectories, and +.I make +operations in that directory should recurse down through the +subdirectories, there should be a line that says +.Ds .IP +# define IHaveSubdirs +.De .IP +at the top of the +.I Imakefile . +This causes recursive ``install'', ``install.man'', +``clean'', ``tags'', ``Makefile'' and ``includes'' target rules to be +written into the +.I Makefile +(see end of +.I Imake.tmpl ; +the +.I make +variable SUBDIRS should set to the names of the subdirectories involved, as +well). +If you want CDEBUGFLAGS passed along to subdirectories, put another +line at the top of the +.I Imakefile +that says +.Ds .IP +# define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' +.De .IP (4) +As you scan through the rules, you'll notice that +.I if +constructs are not written like this: +.Ds .IP +if \fIcondition\fR then; \fIaction\fR; fi +.De .IP +Instead, they're written like this: +.Ds .IP +if \fIcondition\fR then; \fIaction\fR; else exit 0; fi +.De .IP +The reason for this is to deal with differing behaviors of +.I if +on various systems. +On some systems, if you write ``if \fIcondition\fR; then \fIaction\fR; fi'' +and +.I condition +is false, the value of the statement is zero (on the grounds that the +test executed to completion without error). +On other systems, the value of the statement is non-zero (on the grounds +that the test failed). +The latter behavior is broken behavior; Ultrix in particular is guilty +of it. +.IP +In the X rules, +.I if +tests are usually used to check whether some preliminary action needs to be +performed before proceeding to the next step. +Systems that return false when the +.I if +test fails cause +.I make +to exit early if the preliminary action does not need to be done, and +the next step is\*-incorrectly\*-never executed. +.IP +In order to get around this, all +.I if +statements explicitly include an +.I else +clause to return zero when the condition fails, so that +.I make +will continue whether the condition is true or not. +.NH 2 +Commonly Used Rules +.LP +Rules for building programs: +.Ds +NormalProgramTarget() +SimpleProgramTarget() +ComplexProgramTarget() +ComplexProgramTarget_1() +ComplexProgramTarget_2() +ComplexProgramTarget_3() +.De +Rules for building shell scripts: +.Ds +CppScriptTarget() +MakeScriptFromCpp() +.De +Rules for building libraries: +.Ds +NormalLibraryObjectRule() +NormalLibraryTarget() +.De +Rules for installing files: +.Ds +InstallProgram() +InstallLibrary() +InstallManPage() +InstallNonExec() +InstallSubdirs() +.De +Rules for cleaning up: +.Ds +RemoveTargetProgram() +CleanTarget() +CleanSubdirs() +.De +Rules for generating Makefiles and dependencies: +.Ds +MakefileTarget() +MakefileSubdirs() +DependTarget() +DependSubdirs() +.De +Many rules that compile programs also generate ``clean'' and ``all'' +targets. +.NH 2 +Rule Descriptions +.LP +Each rule-generating macro in +.I Imake.rules +is described below, in the order in which they appear in that file. +You should still read through the text of a rule before you use it +to write your own +.I Imakefile . +.LP +.B Disclaimer: +I myself do not, for the most part, use the X rules, except in +modified form for my own projects. +There are likely to be a number of errors of understanding here. +.LP +.Ru SaberProgramTarget(program,srclist,objlist,locallibs,syslibs) +.IP +If HasSaberC is NO, this is a nop, otherwise it expands to a rule for +``saber-\fIprogram\fR'' and causes Saber C to load source and object +files for the program. +Odd that ``#'' is in front of the rules, though. +.LP +.Ru RemoveTargetProgram(program) +.IP +Removes +.I program +(actually this symbol is misnamed because it can be used to remove any +file, not just programs). +If RemoveTargetProgramByMoving (from +.I Project.tmpl ) +is YES, +.I program +is moved to +.I program~ +instead. +This allows you to keep the previous version around. +Note that ``*~'' is in the list of files removed by CleanTarget(), so +unless you override FilesToClean, ``make clean'' will remove these +previous target versions. +.LP +.Ru BuildIncludes(srclist,dstsubdir,dstupdir) +.IP +Builds the header file directories in the source tree, +and populates them. +.LP +.Ru NormalProgramTarget(program,objects,deplibs,locallibs,syslibs) +.IP +Builds one program. +All object files and libraries are explicitly listed in the macro invocation. +.I program +is the program to be built. +.I objects +names the object files needed to build it from, e.g., +.I junk.o . +.I deplibs +names the libraries that must exist before linking is done. +.I locallibs +names the libraries in the source tree that should be linked in. +.I syslibs +names the system libraries (e.g., in +.I /usr/lib ) +that should be linked in. +These are named with +.I \-l , +e.g., +.I \-lm . +.IP +A ``clean'' rule is also generated to remove the program (but not the +objects). +.IP +Since this rule does not assume any default sources, you can use it +several times in an +.I Imakefile +to build multiple programs. +You should also set SRCS to the names of all the programs' +source files and invoke DependTarget() in the +.I Imakefile . +Also invoke AllTarget(), giving it the names +of all programs to build, and you'll need to include a rule to +generate +an ``install'' target for each program and an ``install.man'' target if +there is a manual page. +If you're a lint kind of person, you'll also want +LintTarget(). +.LP +.Ru SingleProgramTarget(program,objects,locallibs,syslibs) +.IP +This rule is deprecated. +Don't use it. +.LP +.Ru SimpleProgramTarget(program) +.IP +This macro is used when the +.I Imakefile +is supposed to build a single program, and that program consists of a single +source file. +The macro sets SRCS to +.I program.c , +OBJS to +.I program.o +and calls ComplexProgramTarget(). +The effect is to set up everything to generate rules to build the program, +install it and its man page, clean the program, generate dependencies, +and lint the program. +A real whiz bang. +See description of ComplexProgramTarget(). +.LP +.Ru ComplexProgramTarget(program) +.IP +This macro is used in an +.I Imakefile +that builds a single program. +Given the name of the program, rules are generated to build it, as well as +generate ``all'', ``install'', ``install.man'', ``depend'' and ``lint'' +targets, and to remove the program. +Several assumptions are made by this macro: +.RS +.IP (1) +SRCS has been set to the list of source files (so the ``depend'' target works). +.IP (2) +OBJS has been set to the list of object files (so the program build works). +.IP (3) +The +.I deplibs , +.I locallibs +and +.I syslibs +arguments as used in NormalProgramTarget() are assumed to be DEPLIBS, +LOCAL_LIBRARIES and LDLIBS. +.RE +.LP +.Ru ComplexProgramTarget_1(program,locallib,syslib) +.br +.Ru ComplexProgramTarget_2(program,locallib,syslib) +.br +.Ru ComplexProgramTarget_3(program,locallib,syslib) +.IP +These rules are use in an +.I Imakefile +that builds 1, 2 or 3 programs. +Actually, just 2 or 3 programs. +If you were building a single program, you'd use ComplexProgramTarget(). +Each macro takes 3 arguments. +.I program +is the name of the program to build. +.I locallib +names libraries built in the source tree that should be linked in +(e.g., XMULIB). +.I syslib +names system libraries to be linked in (e.g., +.I \-lm ). +.IP +The values of certain +.I make +variables are assumed to be set (by you). +SRCS1, SRCS2 and SRCS3 name the sources for each program. +(These are used to set SRCS so the ``depend'' target works.) +OBJS1, OBJS2 and OBJS3 name the objects for each program. +DEPLIBS1, DEPLIBS2 and DEPLIBS3 name the library dependencies for each program. +PROGRAMS names the programs to be built. +.IP +If you're only building 2 programs, then SRCS3, OBJS3, etc., do not +need to be set and will be assumed to have the empty value. +PROGRAMS should be the names of 2 programs, not 3. +.LP +.Ru ServerTarget(server,subdirs,objects,libs,syslibs) +.IP +Generates rules to build a server. +.I libs +doubles as +.I deplibs +and +.I locallibs +as those are used in NormalProgramTarget(). +The directories named by +.I subdirs +are used as dependencies and must exist before the target can be built. +.LP +.Ru InstallLibrary(libname,dest) +.IP +Installs +.I liblibname.a +into +.I dest/liblibname.a +and runs the command named by RANLIB on it. +The installation flags INSTLIBFLAGS are used. +.LP +.Ru MergeIntoInstalledLibrary(tolib,fromlib) +.IP +Merges +.I fromlib +into +.I tolib +using the +.I mergelib +script in the SCRIPTSRC directory. +.LP +.Ru InstallSharedLibrary(libname,rev,dest) +.IP +Installs +.I liblibname.so.rev +into +.I dest/liblibname.so.rev , +using INSTLIBFLAGS. +.LP +.Ru InstallSharedLibraryData(libname,rev,dest) +.IP +Installs +.I liblibname.sa.rev +into +.I dest/liblibname.sa.rev , +using INSTLIBFLAGS. +.LP +.Ru InstallLibraryAlias(libname,alias,dest) +.IP +In +.I dest , +makes +.I libalias.a +an alias for +.I liblibname.a +by generating a link. +.LP +.Ru InstallLintLibrary(libname,dest) +.IP +Installs +.I llib-llibname.ln +into the +.I dest +directory using library installation flags INSTLIBFLAGS. +.LP +.Ru InstallManPageLong(file,destdir,dest) +.IP +Generate rule to install a manual page and rename it. +The source manual page is +.I file.man +and is installed in +.I destdir/dest. ManSuffix +using installation flags INSTMANFLAGS. +This is used to install pages whose names are long enough to tickle +brain damage on systems that don't understand long file names. +.LP +.Ru InstallManPage(file,dest) +.IP +Generate rule to install the manual page +.I file.man +in +.I dest/file. ManSuffix +using installation flags INSTMANFLAGS. +.LP +.Ru InstallNonExec(file,dest) +.IP +Generate rules to install a non-executable file using installation +flags INSTDATFLAGS. +.LP +.Ru InstallProgramWithFlags(program,dest,flags) +.IP +Generate rules to install an executable program using the specified +flags. +.LP +.Ru InstallProgram(program,dest) +.IP +Generate rules to install an executable program. +The comments in +.I Imake.rules +for this macro say something about INSTALLFLAGS, but that variable +isn't actually used in the expansion of this macro, so I claim the +flags used are +simply INSTPGMFLAGS until someone demonstrates otherwise. +.LP +.Ru InstallScript(program,dest) +.IP +Generate rules to install +.I program.script +into +.I dest/program +using installation flags INSTPGMFLAGS. +.IP +This rule is obsolete. +Use CppScriptTarget() and InstallProgram(). +.LP +.Ru LinkFileList(step,list,dir,sub) +.IP +Generates rules for a target +.I step +to make links to all files in +.I list +in directory +.I dir . +The links are created in directory +.I sub . +Judging from the definition of this macro, +.I sub +is presumably so named because the rule changes directories into +.I dir +first and appears to expect +.I sub +to be a subdirectory. +(Strictly speaking, that need not be true, since +(i) +.I sub +could legally be an absolute path; +(ii) +.I sub +could have a value such as ``../..''. +But both those possibilities probably subvert the intent of the +macro.) +.LP +.Ru InstallMultipleDestFlags(step,list,dest,flags) +.IP +Generates rules for a target +.I step +(e.g., ``install'') to install all the files in +.I list +into the directory +.I dir +using installation flags +.I flags . +The files in +.I list +are made the rule dependencies. +.LP +.Ru InstallMultipleDest(step,list,dest) +.IP +Like InstallMultipleDestFlags(), but assuming INSTALLFLAGS as the +installation flags. +Note: INSTALLFLAGS is not set by the X configuration files; +you must give it a value in your +.I Imakefile . +.LP +.Ru InstallMultiple(list,dest) +.IP +Like InstallMultipleDest(), but assuming ``install'' as the +.I step +argument. +.LP +.Ru InstallMultipleFlags(list,dest,flags) +.IP +Like InstallMultipleDestFlags(), but assuming ``install'' as the +.I step +argument. +.LP +.Ru InstallMultipleMan(list,dest) +.IP +Like InstallMultipleDest(), but assuming ``install.man'' as the +.I step +argument. +.LP +.Ru InstallAppDefaults(class) +.IP +If InstallAppDefFiles (from +.I Project.tmpl ) +is #define'd, generates an ``install'' target to install +.I class.ad +into +.I $(XAPPLOADDIR)/class +using installation flags INSTAPPFLAGS. +.IP +INSTAPPFLAGS appears to be deprecated in +.I Project.tmpl . +.LP +.Ru DependDependency() +.IP +If UseInstalled is not #define'd, this macro generates rules to check for the +existence of +.I makedepend +in the source tree and build it if it's missing. +This differs from the R3 rules, which failed if +.I makedepend +was missing. +.LP +.Ru DependTarget() +.IP +Generate rule to determine dependencies for source files named by SRCS. +You have to define the value of SRCS yourself, unless you are using +rules such as +SimpleProgramTarget() or ComplexProgramTarget_{1,2,3}(), which do it +for you. +In the latter case, you need to define SRCS1, SRCS2 and SRCS3. +.IP +This macro uses DependDependency() to check for the existence of +.I makedepend +and build it if necessary. +.LP +.Ru CleanTarget() +.IP +Removes all the files named by FilesToClean and files whose names +begin with ``#''. +.IP +To understand how this rule works, see how RM_CMD is defined in +.I Imake.tmpl . +.LP +.Ru TagsTarget() +.IP +Generate rule to build a +.I TAGS +file from all +.I *.c +and +.I *.h +files. +.LP +.Ru ImakeDependency(target) +.IP +If UseInstalled is not #define'd, this macro generates rules to check for the +existence of +.I imake +in the source tree and build it if it's missing. +This differs from the R3 rules, which failed if +.I imake +was missing. +.LP +.Ru BuildMakefileTarget(imakefile,imakeflags) +.IP +Generate rules to build +.I Makefile . +The +.I imakefile +argument is superfluous (a bug?). +Since it's ignored, +.I Imakefile +is assumed as the source from which to build +.I Makefile . +.I imakeflags +is any special flags you want passed to the +.I imake +command. +.IP +This macro uses ImakeDependency() to check for the existence of +.I imake +and build it if necessary. +.IP +You don't use this rule explicitly unless you've #define'd +IHaveSpecialMakefileTarget in your +.I Imakefile . +.LP +.Ru MakefileTarget() +.IP +Generate rules to build a +.I Makefile +target from +.I Imakefile , +so you can say ``make Makefile''. +This target is automatically included in your +.I Makefile +when it is rebuilt by +.I imake , +unless ``#define IHaveSpecialMakefileTarget'' is present +in your +.I Imakefile , +in which case you should include an invocation of +BuildMakefileTarget() to build +.I Makefile . +.LP +.Ru NormalLibraryObjectRule() +.IP +Generate rule to turn a +.I .c +file into a +.I .o +file. +Include this macro (once) in your +.I Imakefile +if you're building a library from C source. +.LP +.Ru NormalFortranObjectRule() +.IP +Generate rule to turn a +.I .f +file into a +.I .o +file. +Include this macro (once) in your +.I Imakefile +if you're building a library from FORTRAN source. +(FORTRAN? +Isn't that something used to build COBOL compilers?) +.LP +.Ru ProfiledLibraryObjectRule() +.IP +Like NormalLibraryObjectRule(), but in addition to building the normal +target, a profiled target is built in the +.I profiled +subdirectory of the current directory. +.I profiled +is created if necessary. +A ``clean'' target to remove profiled objects is also generated. +.LP +.Ru DebuggedLibraryObjectRule() +.IP +Like ProfiledLibraryObjectRule(), but instead of profiled targets in +.I profiled , +debuggable targets are built in the +.I debugger +subdirectory. +.LP +.Ru DebuggedAndProfiledLibraryObjectRule() +.IP +A combination of ProfiledLibraryObjectRule() and DebuggedLibraryObjectRule(). +.LP +.Ru SharedLibraryObjectRule() +.IP +Like ProfiledLibraryObjectRule(), but instead of profiled targets in +.I profiled , +sharable targets are built in the +.I shared +subdirectory. +.LP +.Ru SharedAndDebuggedLibraryObjectRule() +.IP +A combination of SharedLibraryObjectRule() and DebuggedLibraryObjectRule(). +.LP +.Ru SpecialSharedAndDebuggedObjectRule(objs,depends,options) +.IP +Like SharedAndDebuggedLibraryObjectRule(), but allows targets +.I objs ), ( +dependencies and special compiler flags to be specified. +.LP +.Ru SpecialSharedObjectRule(objs,depends,options) +.IP +Like SharedLibraryObjectRule(), but allows targets +.I objs ), ( +dependencies and special compiler flags to be specified. +.LP +.Ru SpecialObjectRule(objs,depends,options) +.IP +Like NormalLibraryObjectRule(), but allows targets +.I objs ), ( +dependencies and special compiler flags to be specified. +.LP +.Ru SpecialProfiledObjectRule(objs,depends,options) +.IP +Like ProfiledLibraryObjectRule(), but allows targets +.I objs ), ( +dependencies and special compiler flags to be specified. +.LP +.Ru SpecialDebuggedObjectRule(objs,depends,options) +.IP +Like DebuggedLibraryObjectRule(), but allows targets +.I objs ), ( +dependencies and special compiler flags to be specified. +.LP +.Ru SpecialDebuggedAndProfiledObjectRule(objs,depends,options) +.IP +Like DebuggedAndProfiledLibraryObjectRule(), but allows targets +.I objs ), ( +dependencies and special compiler flags to be specified. +.LP +.Ru NormalLibraryTarget(libname,objlist) +.IP +Generate rules to create the library +.I liblibname.a +from the object files named by +.I objlist . +The library is RANLIB'd after being created. +.LP +.Ru NormalSharedLibraryTarget(libname,rev,solist) +.IP +Generate rules to create a shared library +.I liblibname.so.rev . +The library is created under a different name and then moved onto the +target name to maximize availability of any existing version. +.LP +.Ru NormalSharedLibraryDataTarget(libname,rev,salist) +.IP +Like NormalSharedLibraryTarget(), but for shared data +.I liblibname.sa.rev . +The comments claim +the library is created under a different name and then moved onto the +target name as for NormalSharedLibraryTarget() but that doesn't appear +to be true from the text of the macro. +.LP +.Ru NormalLibraryTarget2(libname,objlist1,objlist2) +.IP +Like NormalLibraryTarget(), but adds two lists of files to the +library, in two steps. +Used to create libraries with large numbers of files. +.LP +.Ru ProfiledLibraryTarget(libname,objlist) +.IP +Generate rules to create the library +.I liblibname_p.a +from the profiled objects in the +.I profiled +subdirectory. +.LP +.Ru DebuggedLibraryTarget(libname,objlist) +.IP +Generate rules to create the library +.I liblibname_d.a +from the debuggable objects in the +.I debugger +subdirectory. +.LP +.Ru AliasedLibraryTarget(libname,alias) +.IP +Generate rules to make +.I libalias.a +a link to +.I liblibname.a . +.LP +.Ru NormalRelocatableTarget(objname,objlist) +.IP +Generate rules to produce a relocatable object file +.I objname.o +from the object files named in +.I objlist . +This is built using the loader LD, called with flags LDCOMBINEFLAGS. +.LP +.Ru ProfiledRelocatableTarget(objname,objlist) +.IP +Like NormalRelocatableTarget(), but builds +.I objname_p.o +and uses loader flag +\-X instead of LDCOMBINEFLAGS, to produce a profiled relocatable +object file. +.LP +.Ru DebuggedRelocatableTarget(objname,objlist) +.IP +Like NormalRelocatableTarget(), but builds +.I objname_d.o +and uses loader flag +\-X instead of LDCOMBINEFLAGS, to produce a debuggable relocatable +object file. +.LP +.Ru LintLibraryTarget(libname,srclist) +.IP +Generate rules for a ``lintlib'' target that builds +.I llib-llibname.ln +from the source files named by +.I srclist . +.LP +.Ru NormalLintTarget(srclist) +.IP +Generate rules for a ``lint'' target that lints the source files named +by +.I srclist , +and for a ``lint1'' target that lints the file named by the +.I make +variable FILE (which you must set in +.I Imakefile ). +.LP +.Ru LintTarget() +.IP +Generate rules to lint files named by SRCS. +SRCS might be set by you in +.I Imakefile , +or, if you invoke macros such as SimpleProgramTarget() or +ComplexProgramTarget_{1,2,3}(), it will be done for you +automatically. +.LP +.Ru LinkSourceFile(src,dir) +.IP +Generate rule to make a link to a file in another directory. +The macro can be used to create links +to non-source files, too, of course. +.LP +.Ru MakeSubincludesForBuild(step,dir,srclist) +.IP +Generate rules for target +.I step +to ... to ... uh, I don't know! +.LP +.Ru NamedTargetSubdirs(name,dirs,verb,flags,subname) +.IP +Generate rules for a target +.I name +(e.g., ``depend'', ``install'') that causes the target +.I subname +to be built in the subdirectories named by +.I dirs . +This is done by changing into each subdirectory in turn and invoking +.I make +for the +.I subname +target. +.I flags +is any extra flags that should be passed to those +.I make +processes. +.I verb +is the -ing form of +.I name , +e.g., if +.i name +is ``make'', then +.I verb +is ``making''. +This is used to echo an indication of what +.I make +is doing in each directory as it proceeds. +.IP +This macro is used by virtually all other macros that have names like +XXXSubdirs(). +.LP +.Ru NamedMakeSubdirs(name,dirs) +.IP +Invokes NamedTargetSubdirs() to generate rules for a target +.I name +that causes the ``all'' target to be built in the +subdirectories named by +.I dirs . +.IP +If you want CDEBUGFLAGS passed to the +.I make +processes forked in each subdirectory, the +.I Imakefile +should have a line at the top that says: +.RS +.Ds +# define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' +.De +.RE +.LP +.Ru MakeSubdirs(dirs) +.IP +Equivalent to NamedMakeSubdirs(all,dirs). +.LP +.Ru DependSubdirs(dirs) +.IP +Invokes NamedTargetSubdirs() to generate rules for a ``depend'' +target that causes the ``depend'' target to be built in the +subdirectories named by +.I dirs . +.LP +.Ru InstallSubdirs(dirs) +.IP +Invokes NamedTargetSubdirs() to generate rules for a ``install'' +target that causes the ``install'' target to be built in the +subdirectories named by +.I dirs . +.IP +This macro is automatically invoked if IHaveSubdirs is #define'd in +.I Imakefile , +in which case SUBDIRS should be set to the names of the subdirectories +involved. +.LP +.Ru InstallManSubdirs(dirs) +.IP +Invokes NamedTargetSubdirs() to generate rules for a ``install.man'' +target that causes the ``install.man'' target to be built in the +subdirectories named by +.I dirs . +.IP +This macro is automatically invoked if IHaveSubdirs is #define'd in +.I Imakefile , +in which case SUBDIRS should be set to the names of the subdirectories +involved. +.LP +.Ru IncludesSubdirs(dirs) +.IP +Invokes NamedTargetSubdirs() to generate rules for a ``includes'' +target that causes the ``includes'' target to be built in the +subdirectories named by +.I dirs . +.IP +This macro is automatically invoked if IHaveSubdirs is #define'd in +.I Imakefile , +in which case SUBDIRS should be set to the names of the subdirectories +involved. +.LP +.Ru NamedCleanSubdirs(name,dirs) +.IP +Invokes NamedTargetSubdirs() to generate rules for a target +.I name +that causes the ``clean'' target to be built in the +subdirectories named by +.I dirs . +.LP +.Ru CleanSubdirs(dirs) +.IP +Equivalent to NamedCleanSubdirs(clean,dirs). +.IP +This macro is automatically invoked if IHaveSubdirs is #define'd in +.I Imakefile , +in which case SUBDIRS should be set to the names of the subdirectories +involved. +.LP +.Ru NamedTagSubdirs(name,dirs) +.IP +Invokes NamedTargetSubdirs() to generate rules for a target +.I name +that causes the ``tags'' target to be built in the +subdirectories named by +.I dirs . +.LP +.Ru TagSubdirs(dirs) +.IP +Equivalent to NamedTagSubdirs(tags,dirs). +.IP +This macro is automatically invoked if IHaveSubdirs is #define'd in +.I Imakefile , +in which case SUBDIRS should be set to the names of the subdirectories +involved. +.LP +.Ru MakeLintSubdirs(dirs,target,subtarget) +.IP +Invokes NamedTargetSubdirs() to generate rules for a target +.I target +that causes the target +.I subtarget +to be built in the subdirectories named by +.I dirs . +.LP +.Ru LintSubdirs(dirs) +.IP +Equivalent to MakeLintSubdirs(dirs,lint,lint). +.IP +This macro is +.I not +automatically invoked if IHaveSubdirs is #define'd in +.I Imakefile ; +you need to do so yourself. +.LP +.Ru MakeLintLibSubdirs(dirs) +.IP +Equivalent to MakeLintSubdirs(dirs,lintlib,lintlib). +.LP +.Ru MakeMakeSubdirs(dirs,target) +.IP +Generate rules for a target +.I target +to generate a +.I Makefile +in the subdirectories named by +.I dirs . +.IP +In R4, ``Makefiles'' rules handle values of ${TOP} that are either +relative or absolute. +The R3 rule only handled relative values. +.LP +.Ru MakeNsubdirMakefiles() +.IP +Generate a set of very very very ugly but quite wonderful rules for +use by MakeMakeSubdirs(). +Automatically invoked by MakefileSubdirs(); you shouldn't need to do +so yourself. +.LP +.Ru MakefileSubdirs(dirs) +.IP +Generate rules to build ``Makefiles'' +targets in the given subdirectories. +.IP +This macro is automatically invoked if IHaveSubdirs is #define'd in +.I Imakefile , +in which case SUBDIRS should be set to the names of the subdirectories +involved. +.LP +.Ru CppScriptTarget(dst,src,defs,deplist) +.IP +Generate rules to build a shell script +.I dst +from +.I src . +It figures out how to do this correctly for the current platform +depending on the value of ExecableScripts. +.I defs +is any extra flags, such as \-D's, to pass through to the +preprocessor. +.I deplist +names any targets that must exist before +.I dst +can be built. +.LP +.Ru MakeScriptFromCpp(name,defs) +.IP +Generate rule to build a script +.I name +from +.I name.cpp . +.I defs +is as for CppScriptTarget(). +.LP +.Ru MakeDirectories(step,dirs) +.IP +Generate rules for target +.I step +to create the directories named by +.I dirs . +This is often used to make sure that installation directories exist +before trying to install files in them. +(Not all verions of +.I install +create missing directories.) +.LP +.Ru MakeFonts() +.IP +Generate rules for ``fonts.dir'' target to build font database +.I fonts.dir . +The +.I make +variable OBJS must be set to the name of the files that should exist +before the database is built. +.LP +.Ru InstallFonts(dest) +.IP +Generate rules to install the directory +.I fonts.dir +into +.I dest +using installation flags INSTDATFLAGS. +.LP +.Ru InstallFontAliases(dest) +.IP +Generate rules to install font alias database +.I fonts.alias +into +.I dest +using installation flags INSTDATFLAGS. +.LP +.Ru FontTarget(basename) +.IP +Generate rules to create a font file by converting +.I basename.bdf +to +.I basename.snf . +.LP +.Ru CompressedFontTarget(basename) +.IP +Generate rules to create a compressed font file by converting +.I basename.bdf +(to +.I basename.snf.Z , +I suppose). +.LP +.Ru AllTarget(depends) +.IP +Generate rule for an ``all'' target to build targets named by +.I depends . +.LP +.NH +Imakefile +.LP +If HasSaberC is #define'd, some special Saber-C rules are generated. +.LP +Some symbols that you may want to #define (as nothing) at the top of +.I Imakefile +are: +.LP +.Ru IHaveSpecialMakefileTarget +.IP +If not #define'd (the normal case), MakefileTarget() is automatically +invoked. +If #define'd, it's assumed that you want to explicitly invoke a +.I Makefile -building +macro yourself. +.LP +.Ru MakefileAdditions +.IP +If #define'd, MakefileAdditions() is automatically invoked. +However, MakefileAdditions() appears not to be defined +anywhere, and I have no idea what it is supposed to do. +.LP +.Ru IHaveSubdirs +.IP +If #define'd, you should set SUBDIRS to the names of the current +directory's subdirectories, and subdirectory-traversing rules for +generating ``Makefile'', ``install'', ``install.man'', ``clean'', +``tags'' and ``includes'' targets will be automatically invoked. diff --git a/web/glasgow/lit2x-0.16/mkworld/docs/config-X11R4-1.05.ms b/web/glasgow/lit2x-0.16/mkworld/docs/config-X11R4-1.05.ms new file mode 100644 index 0000000000..8d7d974ab0 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/docs/config-X11R4-1.05.ms @@ -0,0 +1,2456 @@ +.\" format with +.\" tbl % | xroff -ms | lpr +.\" +.\" revision date - change whenever this file is edited +.ds Rd 28 January 1991 +.\" document revision number - change each time document is released +.ds Rn 1.05 +.\" +.nr PO 1.2i \" page offset 1.2 inches +.nr PD .7v \" inter-paragraph distance +.\" +.EH 'Imake in X11R4'- % -'' +.OH ''- % -'Imake in X11R4' +.OF 'Revision date:\0\0\*(Rd'\s+1\*-DRAFT SCRIBBLINGS\*-\s-1'Printed:\0\0\n(dy \*(MO 19\n(yr' +.EF 'Revision date:\0\0\*(Rd'\s+1\*-DRAFT SCRIBBLINGS\*-\s-1'Printed:\0\0\n(dy \*(MO 19\n(yr' +.\" +.\" +.\" I - italic font (taken from -ms and changed) +.de I +.nr PQ \\n(.f +.if t \&\\$3\\f2\\$1\\fP\&\\$2 +.if n .if \\n(.$=1 \&\\$1 +.if n .if \\n(.$>1 \&\\$1\c +.if n .if \\n(.$>1 \&\\$2 +.. +.\" start block. LP gives a bit extra space. Can say .Ds .IP C, etc. +.de Ds +.if \\n(.$<1 .LP +.if \\n(.$>=1 \\$1 +.if \\n(.$<2 .DS +.if \\n(.$>=2 .DS \\$2 \\$3 \\$4 \\$5 +.. +.\" end block. If arg is given, it replaces the .LP (e.g., .De .IP). +.de De +.DE +.if \\n(.$<1 .LP +.if \\n(.$>=1 \\$1 \\$2 \\$3 \\$4 \\$5 +.. +.TL +Using Imake to Configure +.br +the X Window System +.br +Version 11, Release 4 +.AU +Paul DuBois +dubois@primate.wisc.edu +.AI +Wisconsin Regional Primate Research Center +Document revision:\0\0\*(Rn +Revision date:\0\0\*(Rd +.AB +The X Window System\(dg +.FS \(dg +X Window System is a trademark of the Massachusetts Institute of Technology. +.FE +is a large software project that, despite its size, +is remarkable in its portability. +Much of this is due to the method employed to configure the X +distribution for building and installation: use of a small number of +tools and isolation of machine dependencies into a small number of +files that can be easily maintained and modified. +This document discusses one of those tools, +.I imake , +and the design of the configuration files used in conjunction with it. +.AE +.NH +Introduction +.LP +This document describes how +.I imake +configuration files are set up in the X Window System. +It is assumed that you know something about what +.I imake +is supposed to be used for (in general), +and that you're reading this to find out something +about how that is accomplished in X (in particular). +The description applies to X Version 11, release 4 configuration files, which +are organized quite differently than those from previous releases. +.LP +Other documentation (from the X11R4 distribution) that you may find useful +includes: +.IP \(bu +Section 2 of ``X Window System, Version 11 Release 4 Release Notes,'' +by Jim Fulton. +.IP \(bu +.I mit/doc/config/usenixws/paper.ms : +``Configuration Management in the X Window System,'' also by Jim Fulton. +.IP \(bu +.I mit/config/README : +``X Window System Imake Configuration Guide, Release 4.'' +.IP \(bu +.I mit/config/imake.man : +manual page for +.I imake . +.IP \(bu +.I mit/util/makedepend/mkdepend.man : +manual page for +.I makedepend . +.IP \(bu +.I contrib/doc/imake/imake.tex : +``An +.I Imake +Tutorial,'' by Mark Moraes. +This was written between R3 and R4, but is worthwhile reading nonetheless. +.LP +You should also have access to the X configuration files (in +.I mit/config ). +These are not really documentation as such, +but it is expected that you have them at hand, for comparison +against the descriptions below. +.LP +.I imake +is generally conceded to have a pretty steep learning curve. +The +.I README +referred to above notes that +.I imake +``can be somewhat tricky to master,'' an observation attested to by +many who use it. +There seem to be three camps regarding +.I imake ; +those who think it's wonderful, those who think it's wretched, and those +who suspect it might be useful (else why would it be used to configure +a major publicly-available effort like X?) but are puzzled by it. +The present document was written to fill in some of the gaps in the +existing documentation, in order to try to swell the ranks of the first +group by depleting the membership of the third. +(Those who despise +.I imake \*-members +of the second group\*-have good reasons for doing so and the present +effort is not likely to sway them. +The author of +.I imake +is in this group.) +.LP +Where appropriate, the current X configuration files are compared to those +from previous releases to show how limitations of earlier configuration +architectures have been eased. +There are also occasional comments to indicate how +.I imake +and the X configuration files might be adapted for use in contexts +other than building X. +.LP +This document is independent of the efforts of the MIT X Consortium. +There are no doubt errors lurking within, both of understanding and of fact; +they are my own. +Please send corrections, criticisms and comments to the address above. +.LP +The overall organization followed here is: +.IP 1. +Introduction. +.IP 2. +X configuration tool description\*-the programs you use. +.IP 3. +X configuration file description\*-what each file is used for, how each fits +into the configuration process. +.IP 4. +How to build +.I imake . +.IP 5. +How to build X. +.IP 6. +Configuration file bugs. +.IP 7. +How to write your own +.I Imakefile . +You can read this section without reading the rest of the paper, +maybe. +.IP 8. +How to make mistakes writing an +.I Imakefile . +.IP Appendix +Listing of the symbols used in each configuration file, and +what they're used for. +.NH +The tools: imake, makedepend, xmkmf +.LP +.I imake +is a configuration tool\*-the main tool used to configure X. +It is not a replacement for the +.I make +program, but it does assume the availability of +.I make +as the tool used to direct project building and installation. +What +.I imake +provides is an alternative to writing +.I Makefiles +by hand. +The name means ``include-make''\*-\fIimake\fR +uses the C preprocessor +.I cpp , +taking advantage of its include-file and macro-processing +facilities for the purpose of generating +.I Makefiles +suitable for +.I make . +.LP +For each directory in the X distribution, +.I imake +reads a bunch of +configuration files that go to a lot of trouble to compensate for and +adjust to the individual characteristics of your system. +These are combined with an +.I Imakefile +from the current directory and the whole mess is sent through +.I cpp +to build a +.I Makefile +there. +The same configuration files are used to build every +.I Makefile ; +they are kept together in +.I mit/config , +isolating machine dependencies in one location to ease development +and maintenance. +In contrast, the +.I Imakefile +is directory-specific (it specifies the targets to be built in that directory) +and is machine-independent. +.LP +This means that when the distribution is built on a different machine, +only the configuration files need be changed. +The +.I Imakefiles +do not need to be. +If X configuration were specified directly using +.I Makefiles , +this would not be true. +Because +the configuration information in +.I Makefiles +is not portable, each one would have to be edited individually\*-bad +enough for a single +.I Makefile , +but an overwhelming prospect for a project the size of X. +.LP +The value of being able to localize machine-dependent configuration +information into one place should not be underestimated, particularly +as X becomes more sophisticated and the number of systems on which it +runs increases. +The number of +.I make +variables used to build X has increased from approximately 60 +in R1 to 100 in R3 to 150 in R4. +.LP +Another tool, +.I makedepend , +is used to generate header file dependencies for C source files in +each directory after the +.I Makefile +has been built. +Dependencies of targets upon object files can be statically listed in the +.I Imakefile , +but not those for header files. +Different systems organize these differently so dependencies on them +must be generated dynamically. +.LP +While X is being built, +.I imake +itself is located with the configuration files in +.I mit/config . +.I makedepend +lives in +.I util/makedepend +if you use the compiled version (preferred), +or in +.I util/scripts +if you use the shell script version (slower). +.LP +When X is installed, copies of +.I imake , +.I makedepend , +and a related tool, +.I xmkmf , +are placed in a public directory, and the configuration files are +copied to +.I /usr/lib/X11/config . +.I xmkmf +is used to bootstrap a +.I Makefile +from an +.I Imakefile +using the installed configuration files,\** +.FS +Normally a new +.I Makefile +is produced with ``make Makefile'', an operation that presumes you +already have a properly configured +.I Makefile +containing the rules necessary to run +.I imake . +Hence the bootstrap problem. +Obviously, if you know the proper incantation to utter, you can issue +the appropriate +.I imake +command manually, but +.I xmkmf +eliminates the need. +Besides, the only way you'd know which wand to wave is by having a +reasonable understanding of +.I imake +in the first place\*-in which case you wouldn't be reading this! +.FE +and can be used to build +programs from outside of the X source tree, such as you might write +yourself or get from comp.sources.x on Usenet. +.LP +The X configuration files make very +few assumptions about the capabilities of +.I make +itself. +Although several enhanced versions of +.I make +provide special features or extensions, any +.I Makefile +that relies on universal availability of those features +will fail on systems with less-capable versions of +.I make . +.I Makefiles +produced by +.I imake +in X do not use any of these constructs, so they should work with +even the lowest-common-denominator +.I make +program. +.LP +Since +.I imake +passes its input through +.I cpp , +the configuration file writer can take advantage of several features +not present in plain-vanilla +.I make , +such as parameterized macros (using #define), file inclusion (using +#include) and conditional testing (using #if, #ifdef, #ifndef). +This ameliorates much of the sobering effect of having to assume that a dumb +.I make +is the only one available. +.LP +Use of +.I cpp +can produce problems, too, of course: +.IP (1) +How to specify, in configuration files, comments that should end up in the +.I Makefile . +.I make +comments are introduced by a ``#'' character\*-unfortunately, +.I cpp +treats lines beginning with ``#'' as preprocessor directives. +A comment of the form +.Ds .IP +# if your system doesn't have ranlib, use /bin/true +.De .IP +is considered a symbol test by +.I cpp +(it begins with ``if'') and is gobbled up, while a comment like +.Ds .IP +# The next rule is a workaround for a broken compiler +.De .IP +is not understood by +.I cpp +and generates a syntax error. +To get around this, comments +should be preceded by ``/**/#'' instead of just ``#''. +.I cpp +will strip off the ``/**/'' (the empty C comment) +and won't treat the line as a directive (though it's +still liable to symbol substitution). +.IP +The exception to this ``comment-commenting'' convention is in the +.I Imakefile +itself, where +.I imake +automatically adds ``/**/'' onto lines beginning with ``#'' that are not +preprocessor directives. +The reason for this is to insulate the end user of +.I imake +(who simply writes the +.I Imakefile +and not the underlying configuration files) from the need to be aware +of, or abide by, the commenting convention. +I would hazard a guess that many people are not aware of this +exception, given the high incidence of +.I Imakefiles +containing ``/**/#''. +.IP +Comments that are not to be passed through to the +.I Makefile +can be written as normal C comments (text surrounded by ``/*'' and ``*/'') +and will be deleted by +.I cpp . +.IP (2) +Sometimes the values of +.I cpp +symbols are to be concatenated. +The symbol names cannot be concatenated in the configuration files, +because that results in a different symbol name, so they must be kept +apart somehow. +The empty C comment is useful here, too. +For instance, if Prefix, LibName and Suffix are defined as +.I lib , +.I mylib +and +.I .a , +respectively, then to obtain the concatentation value +.I libmylib.a , +one writes Prefix/**/LibName/**/Suffix, not PrefixLibNameSuffix. +.IP (3) +The configuration files define several multiple-line macros that are +intended to produce multiple lines of output. +.I cpp +joins multi-line macros into a single line, so some post-processing is +necessary. +.NH +Configuration file architecture +.LP +To produce a +.I Makefile +from an +.I Imakefile , +the following configuration files are used: +.Ds +.ta 1.5i +Imake.tmpl master template +\fIplatform\fR.cf platform-specific definitions (the filename varies) +site.def site-specific definitions +Project.tmpl X-specific default definitions +Imake.rules \fIcpp\fR macros to generate \fImake\fR rules +.De +In general, +if a port exists for your system, the only file that you should need to modify +to build and install X is +.I site.def . +In some cases it may be necessary to modify the platform file. +.I Imake.tmpl , +.I Project.tmpl +and +.I Imake.rules +should be left alone.\** +.FS +It should be emphasized that ``should be left alone'' applies +.I "only to building X itself" . +If you are adapting the configuration files for use with another +project, you will probably modify all of them somewhat. +You may even find yourself in the position of having modified them to such +an extent that they end up hacked to bits, incapable of configuring +anything, with you left possessing only the faint hope that something useful +will rise, Phoenix-like, from out of the remains. +Be assured\*-it won't. +But cheer up; start again and learn from your mistakes. +.FE +.LP +If you are porting X to a new platform, you will need to write your +own platform file, and modify the top part of +.I Imake.tmpl +slightly. +If you are doing a new port of X, +.I or +porting the X configuration files for use with a different project, you +are well-advised to study all of the configuration files thoroughly. +Ignorance is not bliss in such instances. +.LP +.I Imake.tmpl +contains an #include line for each of the other four configuration files and +for the +.I Imakefile +in the current directory. +It also contains in-line sections for global constant definitions, +header block selection, description of system characteristics, build +definitions, and extra +.I make +rules. +The template is +structured as follows to make everything fit together: +.LP +.TS +box tab (%) ; +l l s l l +l _ _ _ l +l | l l s | l +l | l l s | l +l | l _ l | l +l | l | l | l | l +l | l _ l | l +l | l _ l | l +l | l | l | l | l +l | l _ l | l +l | l l l | l +l | l l l | l +l | l _ l | l +l | l | l | l | l +l | l _ l | l +l | l _ l | l +l | l | l | l | l +l | l _ l | l +l | l _ l | l +l | l | l | l | l +l | l _ l | l +l | l l s | l +l _ _ _ l . +\h'.01i'%Imake.tmpl:%\h'.01i'%\h'.01i' +% +%\h'.01i'%global constants +%%header blocks +%% +%%#include <\fIplatform\fR.cf> +%% +%% +%%#include <site.def> +%% +%%system description and +%%build definitions +%% +%%#include <Project.tmpl> +%% +%% +%%#include <Imake.rules> +%% +%% +%%#include "./Imakefile" +%% +%%extra \fImake\fR rules +% +.TE +.LP +Before these sections of the template are described, there are some general +principles that should be kept in mind. +.LP +Much of the flexibility of the X configuration files is achieved +through the use of the following construct, which defines +.I symbol +only if it has not already been defined: +.Ds +#ifndef \fIsymbol\fR +#define \fIsymbol value\fR +#endif +.De +This construct allows any system-, build- or project-related symbol to +be given a default definition if none has been supplied earlier; +coupled with support for inclusion of platform- and site-specific +files prior to the section in which the default is defined, +the default may be overridden +by a definition occurring within those files. +For example, the default for the C compiler symbol occurs in the build +definitions section of +.I Imake.tmpl +and is defined thus: +.Ds +#ifndef CcCmd +#define CcCmd cc +#endif +.De +If the GNU C compiler is to be used instead, the default definition +can be overridden +simply by putting the following in +.I site.def : +.Ds +#ifndef CcCmd +#define CcCmd gcc +#endif +.De +Use of the #ifndef/#endif construct is pervasive throughout the X11R4 +configuration files, to a much greater extent than in the X11R3 files. +This is especially true in the platform-specific files. +.LP +A fairly consistent pattern followed within the system/build section of +.I Imake.tmpl +and within +.I Project.tmpl +is that definitions for +.I cpp +symbols are listed first, followed by definitions for +.I make +variables. +I presume this is done because there is greater flexibility +available in defining +.I cpp +symbols, e.g., through #ifndef conditional testing. +Since +.I cpp +can't tell whether a +.I make +variable has previously been defined, the strategy adopted is to associate a +.I cpp +symbol with a given +.I make +variable thus: +define the symbol conditionally to allow the possibility of +overriding, then equate the +variable to whatever value the symbol finally ends up with. +For instance, +.I Imake.tmpl +contains: +.Ds +#ifndef CcCmd +#define CcCmd cc +#endif +.sp .3v +\&. . . +.sp .3v +CC = CcCmd +.De +If no earlier definition of CcCmd overrides the default +CC ends up as +``cc''. +On the other hand, if the default is overridden to use ``gcc'' +instead (e.g., in +.I site.def ), +CC ends up as ``gcc''. +.LP +Sometimes ``mixed'' symbol definitions occur, in which +.I cpp +symbols are defined in terms of +.I make +variables. +There are at least two reasons to do this. +.IP (1) +To avoid order-of-definition problems. +Consider the two sets of definitions below. +.Ds .IP +.ta 3i +#ifndef a #ifndef a +#define a b #define a ${B} +#endif #endif +A = a A = a +.sp .3v +\&. . . . . . +.sp .3v +#ifndef b #ifndef b +#define b z #define b z +#endif #endif +B = b B = b +.De .IP +What ends up in the +.I Makefile +is: +.Ds .IP +.ta 3i +A = b A = ${B} +B = z B = z +.De .IP +The example on the left is dependent on the order in which a and b are +defined. +As written above, a (and hence A) is defined in terms of +a symbol that hasn't been defined yet; both get the value of a +literal ``b''. +The example on the right works; b is defined as ``z'', B gets +the same value. +A becomes ``${B}'', which is not evaluated further until +.I make +is run. +At that time A evaluates properly to ``z'', independently of the order in +which a and b are defined in the configuration file. +.IP (2) +To allow for greater flexibility at installation time. +For example, UsrLibDir and USRLIBDIR are defined as: +.Ds .IP +#ifndef UsrLibDir +#define UsrLibDir $(DESTDIR)/usr/lib +#endif +.sp .3v +\&. . . +.sp .3v +USRLIBDIR = UsrLibDir +.De .IP +Symbols such as IncRoot, BinDir, AdmDir are defined similarly, even +though DestDir (to which DESTDIR is eventually equated) is defined +earlier (i.e., there is no order-of-definition problem here). +If a user wants the install to take place under a different root than +DestDir, the command ``make DESTDIR=/alternate/root install'' +suffices, by overriding the definition of DESTDIR in the +.I Makefile . +If UsrLibDir, etc., were defined directly in terms of DestDir rather +than DESTDIR, this would not be possible.\** +.FS +Actually, it would be possible, but cumbersome: ``make install +BINDIR=/alt/bin/dir ADMDIR=/alt/adm/dir LIBDIR=/alt/lib/dir ...'' +.FE +.LP +Each of the sections of +.I Imake.tmpl +is described below. +The descriptions only contain representative examples of the symbols +used in each configuration file. +For exhaustive (and exhausting?) lists, consult the appendix. +.NH 2 +Global constant definitions +.LP +This section of +.I Imake.tmpl +defines two symbols (YES as 1 and NO as 0). +References to these symbols are legion +throughout the rest of the configuration +specification and their values should not be changed. +.LP +Note: symbols #define'd in the configuration files or the +.I Imakefile +have nothing to do with symbols #define'd in your programs; they +are entirely independent.\** +.FS +I once wondered about this, which seems pretty ridiculous now. +.FE +.NH 2 +Header block selection +.LP +The header block section of +.I Imake.tmpl +determines the type of machine on which +.I imake +is being run. +This is done by looking for a +.I trigger \*-a +.I cpp +preprocessor symbol that uniquely and unambiguously indicates a given platform. +For instance, +``sun'' is defined only on Sun systems, ``apollo'' only on Apollo systems, +and +``ultrix'' is only on Ultrix systems. +Their header blocks look like this: +.Ds +.ta 3i +\fBSun:\fR \fBUltrix:\fR +#ifdef sun #ifdef ultrix +#define MacroIncludeFile <sun.cf> #define MacroIncludeFile <ultrix.cf> +#define MacroFile sun.cf #define MacroFile ultrix.cf +#undef sun #ifdef vax +#define SunArchitecture #undef vax +#endif /* sun */ #define VaxArchitecture + #endif +\fBApollo:\fR #ifdef mips +#ifdef apollo #undef mips +#define MacroIncludeFile <apollo.cf> #define MipsArchitecture +#define MacroFile apollo.cf #endif +#undef apollo #undef ultrix +#define ApolloArchitecture #define UltrixArchitecture +#endif /* apollo */ #endif +.De +The trigger symbol might be predefined by +.I cpp +itself; if no such predefined symbol is available,\** +.FS +A goal ANSI C will help us reach? +.FE +.I imake +is built to explicitly pass a definition for one to +.I cpp +to cause the correct header block to be selected. +.LP +If no trigger is defined, a generic configuration +header block is selected instead. +Since that means the platform wasn't +properly determined, a warning is written into the +.I Makefile : +.Ds +# WARNING: Imake.tmpl not configured; guessing at definitions!!! +# This might mean that BOOTSTRAPCFLAGS wasn't set when building imake. +.De +The resulting generically-configured +.I Makefile +will probably fail in one of a number of strange and wondrous ways when +used to try to build anything, +With any luck, the hapless user will examine the +.I Makefile +to figure out +what went wrong, see the warning, and realize that the platform wasn't +determined properly. +.LP +Failure to find a defined trigger symbol might occur because no +port exists for the machine in question, and thus no header block for +it exists. +(Each time X is ported, a header block for the new platform is added +to this section of +.I Imake.tmpl .) +Failure will also occur if +.I imake +was not built properly (i.e., it doesn't pass the +proper trigger symbol definition to +.I cpp ). +.LP +Assuming the proper header block is selected, several +things happen inside of it. +The name of the associated platform-specific +.I .cf +file is defined for later inclusion by the template; one or more architecture +indicator symbols are defined that can be used +by later configuration sections +to test for particular software or hardware platforms; +the trigger symbol is undefined so it won't trigger any other header +block. +.LP +A header block may define a single architecture indicator symbol that refers +both to the software and hardware, +or separate indicators may be defined for an operating system that +runs on multiple hardware types, +For example, ``ultrix'' indicates an Ultrix system, but it is no longer +true (as it once was) that a VAX can be assumed as the hardware +platform\*-RISC Ultrix systems run on MIPS chips now. +Thus UltrixArchitecture is defined as the software indicator symbol, and +VaxArchitecture or MipsArchitecture as the hardware indicator. +.LP +Software indicator symbols should be unique. +Hardware indicator symbols are not necessarily unique in themselves +and may be shared across different software +platforms, e.g., MipsArchitecture can be defined for Ultrix or SGI systems, +VaxArchitecture for Ultrix or BSD systems. +.LP +.I Imakefiles +should always test for indicator symbols rather than trigger symbols, +since the former are more reliable (the latter are undefined by the +header block, anyway). +.LP +The use of predefined or +.I imake -supplied +.I cpp +trigger symbols is fraught with peril, and one must construct the +header blocks carefully, for two reasons: +.IP (1) +Symbols may be ambiguous. +For instance, ``vax'' can be defined both under Ultrix and under BSD. +Thus, the Ultrix header block must come first. +It tests for ``ultrix'' and if that succeeds, defines UltrixArchitecture +and undefines ``vax'' so the BSD block will fail. +.IP (2) +Symbols may become ambiguous in unanticipated ways in the +future. +The ``mips'' symbol is an example. +In R3 it was used to unambiguously detect a true MIPS machine. +This can no longer be done given the presence of that symbol on other +systems that also run on MIPS chips now. +.LP +When porting X to other platforms, it is sometimes +difficult to know either what the trigger symbol should be, or what +indicator symbol(s) to use. +Consider MIPS machines running RISC/os. +``mips'' is insufficient as a trigger, because it is does not +unambiguously define MIPS systems. +The hardware indicator symbol is clear enough, MipsArchitecture, but +the software indicator is less so. +The name of the MIPS operating system suggests that +RiscosArchitecture might be a good choice. +Guess again. +Acorn Computers Ltd. has an OS with a similar name, ``RISC OS''.\** +.FS +My own preference is to use ``mipsriscos'' as the trigger symbol, +MipsArchitecture as the hardware indicator, +and MipsRiscosArchitecture +(which seems suitably unique, but has the disadvantage of being quite +long, and uneuphonious to boot) as the software indicator. +MIPS Computers now claims to consider ``RISCOS'' their trigger symbol. +.FE +.NH 2 +platform.cf +.LP +After the header block section has determined which platform-specific +file to use, that file is then included by +.I Imake.tmpl : +.Ds +/**/################################################################ +/**/# platform-specific configuration parameters - edit MacroFile to change +#include MacroIncludeFile +.De +where MacroIncludeFile has been defined properly by the header block. +.LP +The platform file contains definitions needed to make X build and +install correctly on a particular system. +Some common things found here are definitions for the operating +system name version numbers (major and minor), C compiler version +numbers, and workarounds for missing commands. +Overall, these files are really quite a hodgepodge of different things, +and it is difficult to describe them in any general way. +You should read through the +.I .cf +file for your system before you try to compile anything, to get an +idea what can be done with it. +(It doesn't hurt to read +.I all +the +.I .cf +files, as a matter of fact, especially if you are doing a new port.) +.LP +It is important that version numbers in the platform file +accurately reflect your system. +Some symbol values are contingent upon the OS or C +compiler version, to accommodate system changes, deficiencies, or +bugs, so you want to make sure you get the right definitions. +For example, +.I sun.cf +contains the following: +.Ds +#if OSMajorVersion <= 3 +#define HasVoidSignalReturn NO +#else +#define HasVoidSignalReturn YES +#endif +.De +This reflects a change in the return type of the +.I signal() +system call (from +.I int* +to +.I void* ) +on Sun systems beginning with SunOS 4.0. +Ultrix systems underwent a similar change between 3.0 and 3.1 but the +.I ultrix.cf +file doesn't yet reflect the change. +Perhaps in R5. +.LP +A common missing-command workaround occurs for those systems +that have no BSD-compatible +.I install +command, such as in +.I cray.cf : +.Ds +#define InstallCmd sh $(SCRIPTSRC)/install.sh +.De +It is important to set the value of the SystemV symbol to either YES or NO +in the platform file because +(1) the value of parameters defined in +.I site.def +may depend on it, and the default value is not set until +the system/build definition section (i.e., after +.I site.def ); +(2) +the default values of many parameters in later parts of the template +depend on the value of SystemV. +For instance, there is usually no +.I ranlib +under System V, so the default is defined as a no-op: +.Ds +#ifndef RanlibCmd +#if SystemV +#define RanlibCmd /bin/true +#else +#define RanlibCmd ranlib +#endif +#endif +.De +It is perhaps safer to rely on predefined +.I cpp +symbols (should they exist) in the platform-specific files +than in the header block section of +.I Imake.tmpl . +Once you know the system type, the universe of such +symbols is more constrained and their meanings cannot clash with those +of symbols defined on other vendors' systems. +.LP +The platform files were significantly reorganized between R3 and R4. +In R3, each platform file was expected to contain a definition for +each of the build parameters (C compiler, loader, link command, +etc.). +Whenever a change was made that affected one platform file, such as +defining a new symbol, it usually affected them all. +Since the definitions were usually broadly similar across platforms, +this was more work than necessary. +The approach adopted in R4 is to supply best-guess values as the +default definitions for these parameters in the template, which +individual platform files may override as necessary. +This set of defaults defines a baseline configuration. +There are two advantages to this method. +The platform files need only specify where they +.I differ +from the baseline, by overriding the default definitions; and changes or +additions to the baseline usually require retrofitting of only a few +platform files. +.NH 2 +site.def +.LP +This file contains site-specific definitions. +It is used to reflect local site-wide conventions. +Should you wish to override the defaults, +this is the place to indicate installation directories, whether to +build the server and example programs, any special versions of +programs to use during the build, etc. +.LP +The name +.I site.def +seems, to me at least, something of a misnomer. +For instance, one of the things that is likely to be set there +is HasLargeTmp, to indicate whether you have a large temp file +directory. +.I site.def +is the place for this definition (it depends on your particular +file system layout, so it doesn't go in the platform-specific file, +and it's not +.I cpp -guessable, +so it doesn't go in the system description section). +But a ``site'' can be a location at which multiple hosts +are administered, and which may be configured dissimilarly. +Some may have a large temp directory, others may not. +Similarly, +.I site.def +is the logical place to specify that you want to use the GNU C +compiler, +but you might not necessarily want to use it on all hosts at a site. +In some ways +.I host.def +might be a better name for this file. +.NH 2 +System description and build parameter definitions +.LP +The platform- and site-specific files are followed by a section containing +a number of default definitions. +Generally, these describe system characteristics +(e.g., does it have +.I vfork() ? +does it have sockets?) or are related to management of the +build and installation\** +.FS +Viz., +.I how +things should be installed, not +.I where ; +defaults for the latter are in +.I Project.tmpl . +.FE +processes (e.g., what is the name of the C compiler? +does the loader need any special flags?). +These are not X issues and so are segregated into their own section. +.LP +This section of +.I Imake.tmpl +should not be modified; definitions should be overridden +in platform- or site-specific files. +.NH 2 +Project.tmpl +.LP +This +file contains definitions for parameters that are specific to X. +Examples: whether to build debuggable versions of libraries, the +screen resolution, what sorts of connections to accept (UNIX, TCP +or DECnet sockets), where programs or libraries should be installed. +.LP +A number of the +.I make +variables in +.I Project.tmpl +are directory locations. +Most of them are named in one of two ways, \fIXXX\fRDIR or \fIXXX\fRSRC. +Variables of the first form are defined by equating them to the +values +.I cpp +symbols having similar names (e.g., LIBDIR=LibDir). +The +.I cpp +symbols are defined in the usual default-provided-but-override-allowed +manner, +because they refer to where things are to be placed +at installation time, something which the installer might wish to +change. +.LP +Variables of the second form, \fIXXX\fRSRC, indicate the layout of various +source directories within the X distribution. +They are not supposed to be changed, so there is no provision for +overriding them; rather than being equated to +.I cpp +symbols, they are simply defined +directly (e.g., SERVERSRC=$(TOP)/server). +.LP +.I Project.tmpl +should not be modified; definitions should be overridden +in platform- or site-specific files. +.NH 2 +Imake.rules +.LP +This file contains +.I cpp +macros used to generate +.I make +rules from concise descriptions of targets and dependencies. +Since all the +.I cpp +symbol substitution functionality is available, these macros can be +very powerful and are sometimes quite complicated. +.LP +.B Example: +A simple rule to compile a program might be (this isn't an actual X +rule): +.Ds +.ta .5i +4i +# define CompileProgram(program,objects,libraries) +program: objects + cc \-o program objects libraries +.De +If invoked in an +.I Imakefile +as ``CompileProgram (xproga, main.o, \-lm)'', this macro would expand in the +.I Makefile +to: +.Ds +.ta .5i +xproga: main.o + cc \-o xproga main.o \-lm +.De +The invocation +``CompileProgram (xprogb, main.o parse.o scan.o, \-lm \-ll \-ly)'' +would expand to: +.Ds +.ta .5i +xproga: main.o parse.o scan.o + cc \-o xproga main.o parse.o scan.o \-lm \-ll \-ly +.De +There is one problem with these examples, which is that the CompileProgram() +macro definition spans multiple lines, and +.I cpp +macros are normally single-line. +One can can write multiple-line macros by putting a ``\e'' at the end +of lines to be continued onto the next, but this doesn't work for +.I imake's +purpose since +.I cpp +will still collapse the expanded macro onto a single (possibly quite long) +line. +That makes +.I make +quite unhappy. +.LP +To get around this, special place markers ``@@\e'' are used on all +lines of a rule definition but the last. +The ``\e'' allows multiple-line definitions for +.I cpp +and the ``@@'' lets +.I imake +know how to postprocess +.I cpp +output in order to split expanded macros back up into multiple lines +suitable for +.I make . +This keeps both +.I cpp +and +.I make +happy. +.LP +So: +the +.I real +way to write the CompileProgram() macro is: +.Ds +.ta .5i +4i +# define CompileProgram(program,objects,libraries) @@\e +program: objects @@\e + cc \-o program objects libraries +.De +The invocation ``CompileProgram (xproga, main.o, \-lm)'' comes out of +.I cpp +looking like this: +.Ds +xproga: main.o @@ cc \-o xproga main.o \-lm +.De +.I imake +sees the ``@@'' and knows it has to break the line back up to +produce the intended result. +.LP +In short, +the purpose of the strange syntax is to keep +.I cpp +from totally destroying the usefulness of the output for +.I make +purposes. +Thus, although +.I imake +relies heavily on +.I cpp , +one of +.I imake 's +jobs is to undo some of the damage done by +.I cpp \*-an +uneasy alliance indeed.\** +.FS +This use of ``@@\e'' seems quite natural and obvious, now that I have worked +with it for a while. +I remember, though, that the first few times I looked at the X +.I imake +rules, especially the more complicated ones, +the formatting and syntax seemed so bizarre to me that +a switch flipped in my brain, which then refused to comprehend +anything at all. +Repeated exposure gradually inured me to the infelicities of the +syntax. +.FE +.LP +All the macro definitions in +.I Imake.rules +are embedded within the standard override construct: +.Ds +#ifndef \fIrulename\fR +#define \fIrulename\fR .\0.\0. +#endif +.De +Thus, even rules are subject to being overridden. +If a rule needs to be overridden for a particular platform, +the default definition will be placed in the +platform-specific +file (\fIsgi.cf\fR does this). +If a rule only needs redefining in a single directory, it may be +better to undefine it and redefine right it in that directory's +.I Imakefile +(see +.I mit/config/Imakefile +for an example). +.LP +In R3, rule definitions were not bracketed within #ifndef/#endif pairs. +This meant that although individual +.I Imakefiles +could undefine and redefine rules, platform files could not. +Any definition of a rule in a platform file would be unconditionally replaced +by the definition in +.I Imake.rules +(possibly accompanied by a ``symbol redefined'' message). +The R4 architecture is an improvement because it is not +constrained by this limitation. +.LP +.I Imake.rules +should not be modified; definitions should be overridden +in platform- or site-specific files. +.NH 2 +\&./Imakefile +.LP +The last file included by the template is the +.I Imakefile +from the current directory. +As already mentioned, +.I imake +causes +.I make +comments in this file to be made +.I cpp -safe +by preceding them with ``/**/'' if necessary. +The +.I Imakefile +indicates targets to be built and installed, and their +dependencies, in terms of the +.I cpp +macros defined in +.I Imake.rules . +There may also be targets for generating dependencies, creating +installation directories, creating lint libraries or tag files, etc. +.LP +.I Imakefile -writing +is described in more detail in a later section. +.NH 2 +Extra make rules +.LP +The last section of +.I Imake.tmpl +adds some common targets to the +.I Makefile , +such as a ``Makefile'' target to regenerate the +.I Makefile +itself, and default ``tags'' and ``clean'' targets. +If the directory has subdirectories, rules to +recurse through them for the ``install'', ``install.man'', ``clean'', +``tags'', ``Makefiles'' and ``includes'' targets are generated. +These rules are added if the +.I cpp +symbol IHaveSubdirs is defined and the +.I make +variable SUBDIRS is equated to the list of subdirectories in the +.I Imakefile . +.NH +Building imake +.LP +Before you can build any part of X, +.I imake +itself must be built. +``make World'' in the top-level X source directory builds +.I imake +automatically (in +.I mit/config ). +The following discussion explains what happens during that process and +some of the things you may need to do in preparation for the ``World'' +build. +You want to read this section if ``make World'' dies when you try it, or you +want to port X to another platform, +or you want to build +.I imake +or adapt the X configuration files for use with other projects. +You need to look at the following files: +.I Makefile.ini ; +.I imakemdep.h ; +.I Imake.tmpl . +.NH 2 +Determine what you are trying to accomplish +.LP +When you build +.I imake +you want to +(1) get it to compile successfully, so you can use it; +(2) guarantee that it makes sure +.I cpp +knows the trigger symbol\*-whether +.I cpp +predefines it or not\*-so you don't end up with generically-configured +.I Makefiles . +.LP +Conspiring to keep you from your goal are three dilemmas. +.IP \(bu +.I imake +generates +.I Makefiles +for use in compiling programs; +.I imake +is compiled using a +.I Makefile . +.IP \(bu +.I imake +needs to know your system's trigger symbol in order to pass it along to +.I cpp +for proper +.I Makefile +generation. +But +.I imake +doesn't know the trigger itself if neither +.I cc +nor +.I cpp +predefine it. +.IP \(bu +Some systems require special C compiler flags to ensure proper +compilation of all but the most trivial programs. +One of the facilities provided by +.I imake -generated +.I Makefiles +is that these flags can be automatically specified. +Of course, that is small consolation when the program to be compiled is +.I imake \*-which +happens to be just such a non-trivial program itself. +.LP +The solution to the first dilemma is to use a minimal handwritten file +.I Makefile.ini +instead.\** +.FS +There might be a +.I Makefile +in +.I mit/config +already, +but it might not have been generated on your system, so it's not safe to +use. +It has a bug in it, anyway. +.FE +You might need to hack +.I Makefile.ini +file slightly for your system\*-but only slightly. +If you find yourself making large changes, that is a symptom you don't +understand what you're supposed to be doing. +Stop and think some more first. +.LP +The second and third dilemmas are solved by manually passing the trigger symbol +to the +.I imake +compilation and using a small bootstrap program that knows what +special flags are necessary to get +.I imake +to compile without error. +The commands in +.I Makefile.ini +that build +.I imake +look something like this:\** +.FS +The commands actually use CFLAGS, which includes BOOTSTRAPCFLAGS as part +of its definition; you get the idea. +.FE +.Ds +$(CC) \-o ccimake $(BOOTSTRAPCFLAGS) ccimake.c +$(CC) \-o imake $(BOOTSTRAPCFLAGS) imake.c `./ccimake` +.De +BOOTSTRAPCFLAGS is the +.I make +variable used to pass the trigger value for your system to +.I ccimake +and +.I imake +so they know the platform type. +It is typically ``BOOTSTRAPCFLAGS=\-D\fItrigger\fR'' +if your +.I cpp +doesn't predefine the trigger, empty otherwise.\** +.FS +The BOOTSTRAPCFLAGS mechanism was not present in some earlier versions +of X11 (e.g., R1). +The number of systems to which X had been ported then was smaller and +all of them had +.I cpp 's +that predefined a unique symbol. +.FE +.LP +.I ccimake +is the bootstrap program. +It is\*-by design\*-so simple that it should compile +without any special treatment, and is used to figure out any extra +flags needed on your platform to get +.I imake +to compile. +BOOTSTRAPCFLAGS is supplied to the +.I ccimake +build so it can select the necessary flags by platform type. +.LP +.I imake +is built using the flags supplied by +.I ccimake , +so that it compiles correctly, and with the +the trigger value supplied in BOOTSTRAPCFLAGS, +so that it learns and memorizes the trigger for +itself. +When +.I imake +passes the trigger to +.I cpp , +that in turn allows +.I cpp +to properly determine the correct header block in +.I Imake.tmpl +when +.I Makefiles +are generated. +.NH 2 +Lay the groundwork +.LP +First, you need to determine what the trigger symbol is for your system, +as well as the value of BOOTSTRAPCFLAGS. +For existing ports, you can find out the trigger symbol by +examining the header block section of +.I Imake.tmpl . +The value of BOOTSTRAPCFLAGS can be found in the platform +.I .cf +file for your system. +Look for a line that defines BootstrapCFlags; if +.I cpp +predefines the trigger, there will likely be no such line. +This means BOOTSTRAPCFLAGS is empty. +Otherwise the value will probably be ``\-D\fItrigger\fR'', e.g., +``\-DmacII'', ``\-Datt'', ``\-Daix''. +.LP +A complication likely to arise in the future with regard to +predefined preprocessor symbols is that ANSI C takes a dim view of +all (or almost all) such. +BOOTSTRAPCFLAGS is likely +to be non-empty on more systems as implementations of ANSI C become +distributed more widely. +.LP +For new ports, you need to invent a trigger symbol +that uniquely identifies your system and define +BOOTSTRAPCFLAGS accordingly. +Suppose you have a Brand X system. +You can use ``brandx'' as the trigger and ``BOOTSTRAPCFLAGS=\-Dbrandx''. +You also must modify +.I imakemdep.h . +This header file is #include'd by three programs, +.I ccimake , +.I imake +and +.I makedepend , +and has one section for each.\** +.FS +.I Imake.tmpl +contains some comments near its beginning pertaining to new ports. +These indicate that +.I imake.c , +and +.I main.c +in the +.I makedepend +source, should be modified. +These comments are correct for R3 but evidently were not updated for R4; +in both cases the modifications should be made to +.I imakemdep.h . +Similarly, the +.I README +file refers to +.I ccflags.c , +the R3 equivalent of +.I ccimake.c . +.FE +.LP +The first section of +.I imakemdep.h +pertains to +.I ccimake ; +it consists of a bunch of #ifdef/#endif blocks that define +.I imake_ccflags +according to the trigger symbol. +.I imake_ccflags +is defined as the flags needed to compile +.I imake +on your platform. +For instance, if your Brand X system is System V-based, you need to +specify that: +.Ds +#ifdef brandx +#define imake_ccflags "\-DSYSV" +#endif +.De +.I ccimake +simply writes the value of +.I imake_ccflags +to its standard output. +Common flags in this definition are \-DSYSV or \-DUSG to indicate System +V or USG systems. +Other flags might also be necessary\*-see the ``hpux'' and ``umips'' +blocks for some particularly unpleasant examples. +If no special flags are necessary to compile +.I imake +(e.g., under Ultrix or BSD), +there need not be any block for your system, and +.I ccimake +simply writes out a default definition of +.I imake_ccflags +(currently \-O). +.LP +You might have to fool around trying to compile +.I imake +by hand to determine the correct flags before you know how to define +.I imake_ccflags . +.LP +The second section of +.I imakemdep.h +is for +.I imake . +It too has a set of #ifdef/#endif blocks, this time to select a +trigger symbol definition based on the trigger symbol. +That sounds circular and it is. +These blocks add entries to +.I cpp_argv [\|], +which is an array of strings to be passed to +.I cpp +by +.I imake . +If your +.I cpp +predefines the correct trigger symbol automatically, you don't need to +do anything to this. +Otherwise, this is where you want your trigger symbol to be listed, +and there should be a block something like this: +.Ds +#ifdef brandx + "\-Dbrandx", /* for Brand X systems */ +#endif +.De +This causes +.I imake +to pass ``\-Dbrandx'' to +.I cpp +to make it simulate predefinition of the trigger. +When +.I cpp +reads the configuration files the trigger will have been defined and +the correct header block in +.I Imake.tmpl +will be selected. +.LP +Following the sections for +.I ccimake +and +.I imake , +.I imakemdep.h +contains a third section for +.I makedepend +(the compiled version; if you use the shell script version of +.I makedepend +in +.I mit/util/scripts , +this section of +.I imakemdep.h +is irrelevant). +It looks for various system- and compiler-related definitions that may +be predefined by +.I cc +and/or +.I cpp . +.I makedepend +uses this information to be smart. +Consider the following C program fragment: +.Ds +#ifdef ultrix +#include "inca.h" +#else +#include "incb.h" +#endif /* ultrix */ +.De +If ``ultrix'' is defined, +.I makedepend +knows to generate a dependency for ``inca.h'' and not +``incb.h''; +a dumb +.I makedepend +has to to assume dependencies on both. +.LP +It's easiest simply to leave this section of +.I imakemdep.h +alone. +.NH 2 +Build the program +.LP +You're ready to begin (this should actually be simple if you've done +the above correctly). +The first thing to do is ensure the absence of any detritus that might +be laying around from previous builds: +.Ds +make \-f Makefile.ini clean +.De +Then build +.I ccimake +and +.I imake . +If your +.I cpp +predefines the trigger, you can build with: +.Ds +make \-f Makefile.ini +or +make \-f Makefile.ini BOOTSTRAPCFLAGS= +.De +Otherwise, specify the trigger explicitly. +E.g., for Brand X, use: +.Ds +make \-f Makefile.ini BOOTSTRAPCFLAGS=\-Dbrandx +.De .NH 2 +Test your handiwork +.LP +If +.I imake +is supposed to pass a trigger symbol definition to +.I cpp , +you should test whether it actually does or not by executing the +following command (\fB\-T\fI/dev/null\fR provides an empty input template, and +\fB\-s\fI/dev/null\fR throws away the output so it doesn't clobber the +.I Makefile +in your current directory): +.Ds +imake \-v \-T/dev/null \-s/dev/null +.De +.B \-v +causes +.I imake +to print out the +.I cpp +command that it executes. +If you don't see a \-D\fItrigger\fR +in that command, +.I imake +wasn't built properly. +.NH 2 +Modifying other configuration files for a new platform +.LP +If you are developing a new port to another system, +you have to do more than be able to compile +.I imake , +you also need to be able to use it +in conjunction with the configuration files. +First, you must modify the header block section of +.I Imake.tmpl +to add a block for your system.\** +.FS +This is the only section of +.I Imake.tmpl +that should ever need modifying. +Other changes would be specified in the platform-specific file for +your system. +.FE +It will look something like this: +.Ds +#ifdef brandx +#define MacroIncludeFile <brandx.cf> +#define MacroFile brandx.cf +#undef brandx +#define BrandxArchitecture +#endif /* brandx */ +.De +Second, you must create a platform-specific file +.I brandx.cf . +If your bootstrap flags are non-empty, this should contain, at +minimum, ``#define BootstrapCFlags \-Dbrandx''. +Most certainly it will have other things in it, too. +You will discover just what as you go through the process +of porting the server and/or clients. +.NH +Building X Itself, or, When Is BOOTSTRAPCFLAGS Necessary? +.LP +The question addressed in this section is: +how can you get all the +.I Makefiles +built? +(This document is really about configuring X, not building it, and +configuring X amounts to building the +.I Makefiles .) +.LP +If you have gotten this far, you know you can get +.I imake +compiled and can proceed to build X itself. +.I "Before you do anything else," +copy the top-level +.I Makefile +somewhere safe (outside of the source tree). +If something goes wrong and this file gets trashed, +you want to be able to recover it. +You're asking for trouble if you don't. +.LP +The ``do everything'' operation in building X is ``make World''. +It builds +.I imake , +generates all the +.I Makefiles , +removes extraneous object files, builds the header file tree, +generates dependencies, and compiles everything. +The interesting parts of this +from a configuration perspective are the first two steps. +.LP +The important questions are: (1) what is the value of BOOTSTRAPCFLAGS; +and (2) when +must BOOTSTRAPCFLAGS be specified? +You have already answered the first question by determining how to +build +.I imake , +so only the second is considered below. +.LP +When you build +.I imake +``manually'' in +.I mit/config +using +.I Makefile.ini , +you must specify BOOTSTRAPCFLAGS explicitly if it is non-empty. +What about when building from the top-level directory, e.g., ``make +World''? +It is a useful exercise to build +.I imake +by hand to test your understanding of the issues involved, but that +won't help you to do the ``World'' build\*-the first thing +``make World'' does, unfortunately, is throw +.I imake +away and rebuild it from scratch. +.LP +The X Release Notes (section 2) indicate that for +``make World'' you should +specify BOOTSTRAPCFLAGS if you find a definition for BootstrapCFlags in the platform +.I .cf +file (which means there is no unique predefined +.I cpp +symbol). +By implication, you do not need to specify BOOTSTRAPCFLAGS +if there is no value of BootstrapCFlags in your platform +.I .cf +file. +This means essentially that the empty value ``BOOTSTRAPCFLAGS='' is sufficient to +compile +.I imake +properly, which brings up a subtle point. +Each +.I Makefile +created in the X distribution contains a line that says +.Ds +BOOTSTRAPCFLAGS=\fIsomething\fR +.De +where +.I something +is the default value for any +.I make +operation, and may or may not be empty. +Thus, when you execute a command such as +.Ds +make World BOOTSTRAPCFLAGS=\-Dbrandx +.De +you are not just +.I providing +a value of BOOTSTRAPCFLAGS, you are also +.I overriding +the default value in the +.I Makefile . +.LP +The implication that BOOTSTRAPCFLAGS need not be specified if +BootstrapCFlags is +not defined involves a hidden assumption, i.e., that BOOTSTRAPCFLAGS +.I already +has the empty value in the top-level +.I Makefile . +If you obtain your X distribution from a system on which X has been built +and on which BOOTSTRAPCFLAGS is non-empty, that assumption is incorrect. +If you don't explicitly provide an empty value by saying +.Ds +make World BOOTSTRAPCFLAGS= +.De +to override the default in the +.I Makefile , +a value which is incorrect for your system is used instead. +You can get some very strange results this way. +.LP +I submit that, in the general case, the deciding factor determining +whether to specify BOOTSTRAPCFLAGS is not so much whether +BootstrapCFlags is defined or not, but whether you've built your +.I Makefiles +yet. +If not, you need to specify BOOTSTRAPCFLAGS, +.I "even if it's empty." +Otherwise, you don't have to. +In practice, this means that when you are building X on a new system, +you should assume BOOTSTRAPCFLAGS in the +.I Makefile +is incorrect and explicitly override it on the command line. +Normally this will be on the first ``World'' build. +.LP +The Release Notes do not cover the general case. +Rather, they assume you are working from a virgin distribution (where +the default BOOTSTRAPCFLAGS is in fact empty). +.LP +Once the +.I Makefiles +have been built properly, +BOOTSTRAPCFLAGS will be defined correctly in them and +they will take care of propagating the right value +for you automatically\*-forever, even into another operation that +rebuilds +.I imake +and the +.I Makefiles . +You can test this for yourself on a machine that +has a non-empty BOOTSTRAPCFLAGS. +Do ``make World BOOTSTRAPCFLAGS=\-D\fItrigger\fR'', then ``make +World''. +You'll see during the ``make World'' that BOOTSTRAPCFLAGS is supplied for you. +.LP +.B "Note 1:" +It is not necessary to do a ``World'' build to build +.I imake +and the +.I Makefiles ; +there is a ``mastermakefiles'' target that will do so. +This is a far more modest undertaking than doing the ``World'' build +and you can check a few of the +.I Makefiles +afterward to see if the ``World'' build is likely to succeed or not: +If BOOTSTRAPCFLAGS is correct and the correct header block was selected, +you can +then go ahead and do ``make World'' without having to specify BOOTSTRAPCFLAGS. +.LP +.B "Note 2:" +The above discussion assumes that if BOOTSTRAPCFLAGS is not empty, BootstrapCFlags is +defined +correctly in the platform +.I .cf +file, because BOOTSTRAPCFLAGS normally gets its value from that symbol when +.I Makefiles +are generated. +.NH 2 +Alternatives ways of specifying BOOTSTRAPCFLAGS +.LP +There are two alternatives to specifying BOOTSTRAPCFLAGS explicitly +on the +command line when you build +the +.I Makefiles , +both sneaky and both deprecated. +They are mentioned here in order to point out why you shouldn't use +them. +.LP +First, you can edit +.I config/Makefile.ini +manually to set the value of BOOTSTRAPCFLAGS directly. +The reason this is not a good idea is that if you give your X +distribution to somebody else that doesn't have the same kind of +machine, you've given away an explicitly misconfigured +.I Makefile.ini . +The recipient might fail to appreciate the subtle irony of this +gesture. +.LP +Second, you can forget about BOOTSTRAPCFLAGS entirely. +That's correct\*-you can build +.I imake +with wild abandon and total lack of regard for whether it knows about +the correct trigger symbol or not. +``But on some systems, +.I imake +must pass the trigger definition to +.I cpp +explicitly,'' you say, ``and +.I imake +compiled in such a reckless and irresponsible manner may not do the job.'' +Quite right. +However... +.I imake +also examines your environment, and the value of IMAKEINCLUDE, if +defined there, is passed to +.I cpp . +The value of IMAKEINCLUDE must begin with ``\-I'' (or +.I imake +will reject it), but you can be clever and set it +to ``\-I. \-Dbrandx'' and the +trigger symbol will be passed through to +.I cpp +and your +.I Makefiles +will build happily. +.LP +This is sneaky because it uses the environment to affect the +build process in a way that is not evident. +Worse yet, if you actually install an +.I imake +built this way, it won't work for anyone else who isn't privy to the +IMAKEINCLUDE convention. +.LP +(A third alternative is to edit +BOOTSTRAPCFLAGS to the proper value in the top-level +.I Makefile +before ``make World''. +This is functionally equivalent to specifying it on the command line.) +.NH +Imakeconoclasm\*-X configuration bugs +.LP +Given the size of the X project, there are astonishingly few outright +errors in the files involved in the configuration process. +The ones I know about are listed below. +.IP (1) +Assume the following scenario. +You do a ``make World''. +This builds +.I imake , +generates all the +.I Makefiles , +cleans all the directories and finally builds the X stuff. +.IP +Then you decide to do some work in an X directory that requires the +.I Makefile +to be rebuilt, so you execute +``make Makefile''. +What happens? +You might be surprised to observe that +.I imake +is rebuilt before your +.I Makefile +is regenerated. +This reason is that the rules for the ``Makefile'' target check +whether +.I imake +exists, and if not they build it first. +Since the ``World'' build does a clean after generating the +.I Makefiles , +.I imake +was thrown away. +.IP +In fact, +.I imake +will be built the first time ``make Makefile'' is done after the +``World'' build even if the +cleaning had not been done. +The rules that check for +.I imake 's +existence look for +.I Makefile +in +.I mit/config/Makefile.ini +and build +.I imake +with that if it's there. +(It will be because the ``World'' build generates it.) +But the dependency for +.I imake +in +.I Makefile +is +.I imake.o +while the dependency in +.I Makefile.ini +(with which +.I imake +is initially built) is +.I imake.c . +This means that even if +.I imake +is present in +.I mit/config , +it will be built again because +.I imake.o +isn't. +.IP +That isn't actually a bug, but it can be confusing. +Possibly even more confusing than the previous paragraph. +.IP +What +.I is +a bug is that +.I Makefile +in +.I mit/config +does not pass BOOTSTRAPCFLAGS to the +.I imake +compilation. +If your BOOTSTRAPCFLAGS is non-empty, you end up with a bad +.I imake. +The fix is as follows: +.Ds .IP +Change: + DEFINES = $(SIGNAL_DEFINES) +To: + DEFINES = $(SIGNAL_DEFINES) $(BOOTSTRAPCFLAGS) +.De .IP (2) +The IncRoot symbol is defined twice, once in +.I Imake.tmpl +and once in +.I Project.tmpl . +This is a minor nit, since it gets the same value in both files. +However, if you use a copy of the configuration files as a base for your own +projects, you will probably +modify these files and you should be aware that changing the definition in +.I Project.tmpl +has no effect if you leave both definitions in. +.IP (3) +.I makedepend +has some hardwired pathnames in the source code. +This may bite you if you use +.I gcc +or compile on a MIPS system under the BSD environment, or on other +systems that put include files somewhere other than +.I /usr/include . +.IP (4) +The default value of ExecableScripts in +.I Imake.tmpl +should be given a value based on SystemV, not SYSV. +.Ds .IP +Change: + #ifndef ExecableScripts + #ifdef SYSV +To: + #ifndef ExecableScripts + #ifdef SystemV +.De .IP +This is simply for consistency. +Probably the right thing always happens anyway. +.NH +Writing Imakefiles. +.LP +.B +This section is miserably incomplete. +.LP +This section assumes that +.I imake , +.I makedepend +and +.I xmkmf +are installed in a public directory somewhere, which implies the +additional assumption that the +configuration files are installed where +.I xmkmf +can get at them. +Why make these assumptions? +.LP +Normally you work with both an +.I Imakefile +and a +.I Makefile +and after you make changes to the +.I Imakefile , +you do ``make Makefile'' to regenerate the +.I Makefile . +You can use +.I Makefile +to rebuild itself this way because it has a +``Makefile'' target in it containing rules to do so. +.LP +That doesn't work when you're starting from scratch with just +.I Imakefile . +This is where +.I xmkmf +comes in useful. +Once you've written your +.I Imakefile , +you just execute ``xmkmf'' and it will bootstrap a +.I Makefile +for you. +Thereafter you can use ``make Makefile'' when +.I Makefile +needs rebuilding. +.LP +However, in order to bootstrap +.I Makefile , +you need +.I xmkmf . +.I xmkmf +assumes +.I imake +has been built and installed. +If an installed +.I imake +is used, an installed +.I makedepend +must also be used.\** +.FS +To see why, you need to look at the ImakeDependency() and +DependDependency() macros in +.I Imake.rules . +Notice that both macros depend on the value of UseInstalled, so if one +is installed, the other must be as well. +Also see the definitions of IMAKE and MAKEDEPEND in +.I Project.tmpl . +.FE +And if installed versions of +.I xmkmf , +.I imake +and +.I makedepend +are used, they will expect the configuration files to have been +installed. +Hence the assumptions at the beginning of this section. +.LP +Stuff that should go in here. +.Ds +1) ComplexProgramTarget() all, program, install, install.man, depend, + lint, clean (still need CleanTarget()) +2) ComplexProgramTarget_{1,2,3} +3) SimpleProgramTarget() = CPT with only single source file +4) NormalProgramTarget() +.De +.LP +Here is the simplest +.I Imakefile : +.Ds +.ta 1i + \(<- that's it right over there +.De +That was easy. +But what can you do with it? +First, execute ``xmkmf'', and you'll have the corresponding +.I Makefile . +Then you can try a few operations such as ``make +clean'', ``make'', ``make Makefile'' to see what happens. +(Note in particular that last target and observe that +you can get your first +.I Makefile +with ``touch Imakefile; xmkmf''.) +.LP +Since +.I make +actually executes correctly for all of those targets (or should, +anyway), you can see that a lot of structure is supplied for you by +the configuration files. +If you look at the +.I Makefile +generated from the null +.I Imakefile , +you might be surprised by the complexity of it. +.LP +To test the syntactic correctness of your +.I Imakefile : +.Ds +xmkmf ; make Makefile +.De +This builds +.I Makefile +twice. +.I xmkmf +builds the +.I Makefile +from scratch and fails if the configuration is bad. +.I make +builds a new +.I Makefile +using the one built by +.I xmkmf , +and fails if that one is not legal. +(say how that can happen, e.g., spelling errors cause it.) +This should not happen with a null +.I Imakefile , +but it may very well happen when you're writing real ones. +.NH 2 +Miscellaneous Observations +.IP \(bu +Don't forget ``make depend'' after ``make Makefile''. +.IP \(bu +If you intend to use +.I if +or +.I for +constructs in an +.I Imakefile , +you are well advised to copy the way in which they +are used in +.I Imake.rules . +(See the beginning of the +.I Imake.rules +section of the Appendix for some notes on +.I if +constructs.) +.IP \(bu +If you need to pass special \-D's to the C compiler, set the +.I make +variable DEFINES. +If you need to pass special \-I's to the C compiler, set the +.I make +variable INCLUDES. +These will be passed to compilations automatically in CFLAGS +(see definitions of CFLAGS, ALLDEFINES and ALLINCLUDES in +.I Imake.tmpl ). +.IP \(bu +Some rules may not work as you expect after changing +.I Imakefile . +In particular, +problems can occur the first time you try ``make \fItarget\fR'' that +mysteriously disappear the second time. +As an instance of this, +note that the following command lines are not always equivalent: +.Ds +make Makefile Makefiles +make Makefile ; make Makefiles +.De +You normally want to build the ``Makefiles'' target when there are +subdirectories. +Suppose you add a new subdirectory. +This is done by adding it to the definition of +SUBDIRS in the current directory's +.I Imakefile . +You then need to rebuild the +.I Makefile +so that the definition of SUBDIRS is reset, and then rebuild +.I Makefile +in each of those subdirectories. +The first command line above builds the ``Makefiles'' target using the +(old) value of SUBDIRS from the (current) +.I Makefile , +which is incorrect. +The second command line rebuilds the +.I Makefile , +then runs a second +.I make +process to build ``Makefiles''. +The second process sees the (new) value of SUBDIRS in the (new) +.I Makefile , +which includes the new subdirectory, and has the intended result. +.IP +What can be especially confusing is that if you executed ``make +Makefile Makefiles'' twice, it would not do what you expected the +first time, but it +.I would +the second time. +.NH +Courting disaster: How to do the wrong thing +.LP +.I imake +is wonderful for portability when everything is configured +properly. +However, subtle syntax errors in the configuration files are often difficult +to track down when you begin to make any significant changes to them. +This section describes some of the misfortunes that may beset you +should you make so bold as to engage in such an endeavor. +.LP +For X, the source of problems might be in any of +.I Imakefile , +.I Imake.rules , +.I Imake.tmpl , +the platform +.I .cf +file, or +.I site.def . +The most likely candidates are +.I site.def +and the platform file, though, since those are the only ones you're supposed +to edit. +(If you're writing an +.I Imakefile , +add that to the list, too.) +Just remember that the effects of mistakes in the early files may +not be manifest until much later on. +Problems may appear to originate at locations far from the actual +cause. +.IP (1) +.I Makefile +trashing +.IP +A number of problems during ``make Makefile'' can result in a trashed +.I Makefile . +If you have +.I xmkmf +working, you can use that to regenerate the +.I Makefile +after fixing whatever the problem was. +Otherwise you must recover it somehow. +If you have a copy of +.I Makefile +stashed somewhere, you can use that. +If not: +the first thing that ``make Makefile'' does is to move the original +.I Makefile +to +.I Makefile.bak ; +if the new +.I Makefile +isn't created properly, you can +usually recover it with ``cp Makefile.bak Makefile''. +Then you can fix +the problem and try again. +If +.I Makefile.bak +is trashed as well, you can +grab the +.I Makefile +from another directory at the same level and use that (this works because +they both contain the same ``make Makefile'' +rule). +You can also use a +.I Makefile +from a directory at another level, +but you need to edit the line that sets TOP to reflect where the top +project directory is in relation to the current directory. +.IP +Moral: make sure +.I xmkmf +is working first! +.IP (2) +Boolean vs. existent/nonexistent symbols +.IP +Some symbols are used in boolean fashion and are defined as +YES or NO. +They are tested by ``#if \fIsymbol\fR'' or ``#if !\fIsymbol\fR''. +Others are turned on simply by being defined. +They are tested by ``#ifdef \fIsymbol\fR'' or ``#ifndef \fIsymbol\fR''. +Failure to distinquish the sense in which a symbol is used can lead to +problems. +It is necessary to define symbols properly +.I and +to test them properly. +.IP +.B Example: +YES/NO symbols must be defined properly. +SystemV is such a symbol, and the proper test is ``#if SystemV''. +If you use ``#define SystemV'' instead of ``#define SystemV YES'', +thinking that the former will turn it on, you'll +have problems; ``#if SystemV'' turns into just ``#if'' and generates: +.Ds .IP +cpp: /usr/tmp/tmp-imake.\fImmm\fR:line \fInnn\fR: syntax error +.De .IP +.B Example: +YES/NO symbols must be tested properly. +If you test such a symbol with #ifdef, the test will always succeed, +whether the value is YES or NO; the symbol is defined in +.I both +cases. +.IP +.B Example: +Existent/nonexistent symbols must be tested properly. +A symbol such as UseInstalled is simply defined (as nothing) or left undefined. +If you say ``#define UseInstalled NO'', thinking that will turn it +off, you will be surprised. +(The test ``#ifdef UseInstalled'' will succeed.) +.IP +.B Example: +Existent/nonexistent symbols must be properly. +Such a symbol may be defined as nothing. +If you test it, incorrectly, with ``#if symbol'', the test will fail. +Use #ifdef. +.IP (3) +Rule definition problems +.IP +These can occur after ``make Makefile'', if a rule in +.I Imake.rules +is +#define'd with a space between the rule name and the argument list: +.Ds .IP +#define rule(arglist) right +#define rule (arglist) wrong! +.De .IP +.I cpp +will define rulename as ``(arglist)''. +When this happens, you'll see +.Ds .IP +make: line \fInnn\fR: syntax error +.De .IP +and you'll find `` (arglist)'' on line nnn of the +.I Makefile +because ``rule'' wasn't expanded properly (or at least not the way you +expect). +Fix it and try again. +.IP +Other similar errors can occur if rules are defined or used with spaces +anywhere between the end of the macro name to the closing parenthesis of +the argument list. +This is particularly true if a macro argument is used +to generate rule target names or file names. +For example, AliasedLibaryTarget() looks like this: +.Ds .IP +.ta .5i +4i +#define AliasedLibraryTarget(libname,alias) @@\e +AllTarget(lib/**/alias.a) @@\e + @@\e +lib/**/alias.a: lib/**/libname.a @@\e + $(RM) $@ @@\e + $(LN) lib/**/libname.a $@ +.De .IP +If invoked as ``AliasedLibraryTarget(xyz, libxyz)'', this will +expand to: +.Ds .IP +lib libxyz.a: libxyz.a + $(RM) $@ + $(LN) libxyz.a $@ +.De .IP +which won't do very well when +.I make +gets ahold of it. +There will appear to be two targets (not one) having a dependency on +.I libxyz.a \*-and +one of them is itself! +.IP (4) +Failure to supply +.I cpp +symbol default values +.IP +When a +.I make +variable is equated to a +.I cpp +symbol, the +.I cpp +symbol must be defined somewhere, even if it's just +defined as nothing. +Otherwise the make variable will be set to the literal +.I cpp +symbol name. +That is, if you have ``MAKEVAR=CppSymbol'', it must be preceded +somewhere by: +.Ds .IP +#ifndef CppSymbol +#define CppSymbol \fIwhatever\fR /* (``whatever'' might be empty) */ +#endif +.De .IP +or MAKEVAR will end up with the literal value ``CppSymbol''. +.IP (5) +Macro expansion failure +.IP +Suppose you include the following line in your +.I Imakefile +so that a special version of your library will be compiled: +.Ds .IP +DebuggedAndProfiledLibraryObjectrule() +.De .IP +After you regenerate +.I Makefile , +you try to use it and get the message: +.Ds .IP +Make: Must be a separator on rules line \fInnn\fR. Stop. +.De .IP +This is symptomatic of a spelling error. +If you look closely at the +.I Imake.rules +file, you'll find that the rule name is actually spelled +``DebuggedAndProfiledLibraryObjectRule()''. +If you don't spell a rule name correctly, it won't be expanded. +Fortunately, these problems are easy to find, because at least the error +message tells you where to look. +Unfortunately, you can't say ``make Makefile'' after you fix +.I Imakefile , +because the effect of the error is to make your +.I Makefile +unusable. +Use +.I xmkmf . diff --git a/web/glasgow/lit2x-0.16/mkworld/docs/config-wrprc.ms b/web/glasgow/lit2x-0.16/mkworld/docs/config-wrprc.ms new file mode 100644 index 0000000000..21f0036cfe --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/docs/config-wrprc.ms @@ -0,0 +1,691 @@ +.\" format with +.\" xroff -ms % | lpr +.\" +.\" revision date - change whenever this file is edited +.ds RD 24 July 1990 +.nr PO 1.2i \" page offset 1.2 inches +.nr PD .7v \" inter-paragraph distance +.\" +.EH 'Multiple-project Imake'- % -'' +.OH ''- % -'Multiple-project Imake' +.OF 'Revision date:\0\0\*(RD'\s+2\*-DRAFT\*-\s-2'Printed:\0\0\n(dy \*(MO 19\n(yr' +.EF 'Revision date:\0\0\*(RD'\s+2\*-DRAFT\*-\s-2'Printed:\0\0\n(dy \*(MO 19\n(yr' +.\" +.\" I - italic font (taken from -ms and changed) +.de I +.nr PQ \\n(.f +.if t \&\\$3\\f2\\$1\\fP\&\\$2 +.if n .if \\n(.$=1 \&\\$1 +.if n .if \\n(.$>1 \&\\$1\c +.if n .if \\n(.$>1 \&\\$2 +.. +.TL +Using Imake for Multiple Projects +.sp .5v +(document version 1.02) +.AU +Paul DuBois +dubois@primate.wisc.edu +.AI +Wisconsin Regional Primate Research Center +Revision date:\0\0\*(RD +.NH +Introduction +.LP +.I imake +is a tool for generating makefiles and is used to allow software projects +to be configured easily on a wide variety of target machines. +It is distributed with projects such as the X Window System and the Kerberos +authentication system. +The tool +.I makedepend +is typically used in conjunction with +.I imake +to generate dependencies in makefiles. +.I xmkmf +is also used, for bootstrapping makefiles from imakefiles. +.LP +This document describes the particular way +.I imake +is used to configure projects at WRPRC. +The method is patterned after the way +.I imake +is employed in the X Window System (version 11, release 4). +The X11R4 method is significantly more developed than in X11R3. +Presumably, +.I imake +as used in Kerberos (currently at protocol revision 4) +might have been used as a base, but I judged it +unsuitable for two reasons: (i) I learned +.I imake +from studying X, so I'm probably imprinted to it; +(ii) development of the configuration files in Kerberos appears to be +at a more primitive level even than in X11R3. +.LP +The X11R4 approach allows configuration files to be stored either +in a well-known system-wide location (e.g., +.I /usr/lib/config ), +or in a +.I config +directory under the project top-level directory. +.LP +A more-than-passing acquaintance with +.I imake +is assumed here. +Helpful companion documentation includes ``Configuration Management in +the X Window System,'' the configuration and +.I README +files in the X11R4 distribution (in the +.I mit/config +directory), and the WRPRC configuration files (see below for +information on distribution and availability). +.NH +Statement of Problem +.LP +Because of the flexibility +.I imake +provides as a +configuration tool (once you figure out how to use it!), +I had begun to use it on all my projects. +Since these were all developed at the same site, the projects naturally +had quite a bit of configuration information in common. +On the other hand, different projects just as naturally had their own +individual requirements. +.LP +What I had been doing was creating a +.I config +directory in each project directory, with a copy of the configuration files +in each, modified as necessary for the project (otherwise known as ``using +brute force''). +I did not use configuration files in a system-wide location +because of differing project requirements. +At the same time, there was a great deal of redundancy between sets of +configuration files since projects were built and installed +in similar ways. +It seemed rather wasteful and silly not to take advantage of this overlap, +besides the fact that the multiple copies of files contributed to a +maintenance inefficiency when changes were made that affected all projects. +.LP +This (unsatisfactory) situation prompts the question: +how can the number of files to be maintained be minimized and how can +configuration files be shared among projects without sacrificing the ability +to specify project-specific information as necessary? +.NH +Solution to Problem +.LP +Since +.I imake +possessed the ability to look through multiple directories when looking +for configuration files, the simplest solution to the problem seemed to be: +.IP (i) +Create a set of standard configuration files and store them in a well-known +location (referred to here as StdConfigDir). +.IP (ii) +Allow projects to define an alternate configuration directory (referred to +here as ProjConfigDir, typically the +.I config +directory under the project directory). +.IP (iii) +Tell +.I imake +to look through ProjConfigDir, then StdConfigDir for configuration files. +This means changing +.I xmkmf , +which executes +.I imake , +and the configuration file definitions that construct +.I imake +commands. +.LP +In other words, +a standard set of configuration files is created and stored in a well-known +location for use by multiple projects. +However, should it be required, +individual projects place configuration files in their own +.I config +directory, which takes precedence over StdConfigDir when +searching for files. +In the degenerate case, projects need supply nothing if +the standard stuff is sufficient; only files in StdConfigDir will be +used. +.NH +Implementation of Solution +.NH 2 +Imake.tmpl Architecture +.LP +The architecture of the +.I imake +template, +.I Imake.tmpl , +as used in X11R4 is, roughly: +.LP +.DS +.ta 3i +header block section +#include <\fIplatform\fR.cf> (platform-specific definitions) +#include <site.def> (site-specific definitions) +system description, build and installation definitions +#include <Project.tmpl> (project-specific definitions) +#include <Imake.rules> (\fIimake\fR rules) +#include "./Imakefile" (\fIImakefile\fR for current directory) +.DE +.LP +The header block section determines the machine type and the +platform-specific file +.I platform .cf +to be included. +.LP +To accommodate other project-specific files, extra +#include's are introduced into +.I Imake.tmpl . +The resulting modified architecture becomes: +.LP +.DS +header block section +.sp .2v +#include <\fIplatform\fR.pcf> +#include <\fIplatform\fR.cf> +.sp .2v +#include <site.pdef> +#include <site.def> +.sp .2v +system description, build and installation definitions +.sp .2v +#include <Project.ptmpl> +#include <Project.tmpl> +.sp .2v +#include <Imake.prules> +#include <Imake.rules> +.sp .2v +#include "./Imakefile" +.DE +.LP +The header block section now additionally determines the name of the +project-specific platform file +.I platform .pcf. +.LP +The modification is based on the notion of override files. +Before any of the platform, site, project or rules +files are included, another related file is +included which may contain project-specific information. +Standard versions of these project-specific files +.I *.pcf , ( +.I site.pdef , +.I Project.ptmpl +and +.I Imake.prules ) +are present in +StdConfigDir (to prevent file-inclusion errors) but they are all empty. +If a given project has special configuration requirements, it may +supply its own private versions of any of these files in its +.I config +directory. +Since +.I imake +will search that directory before StdConfigDir, the standard (empty) +versions will be overridden. +The project does not have to actually replace them. +.LP +.B "Example 1:" +At the one extreme, when a project has +no special project-specific configuration requirements (no +.I config +directory, or an empty one), +only the files in StdConfigDir are used to create makefiles. +Since the default project-specific files are empty, the new +architecture of +.I Imake.tmpl +is functionally equivalent to the old. +At the other extreme, a project can replace +.I all +the configuration files; nothing from StdConfigDir is used then. +.LP +.B "Example 2:" +The standard +.I site.def +file might be used by the system administrator to set the value of +BinDir to the directory in which programs are installed. +A project might want them installed somewhere else; this could be done +by defining BinDir in the project-specific site file +.I site.pdef +to override the value in +.I site.def . +.LP +.B "Example 3:" +Override files may also be used to extend the standard configuration +by defining symbols not appearing at all in the standard files. +For instance, if some programs were to be installed in the standard +BinDir, but others were to be installed in a private directory, a +symbol such as ProjBinDir could be defined for the latter purpose in +.I Project.ptmpl . +.LP +One bothersome thing about this architecture is the naming of +.I Project.tmpl +and +.I Project.ptmpl . +If +.I Project.tmpl +contains ``project-specific'' information, then what does +.I Project.ptmpl +contain? +``Project-project-specific'' information? +Ugh. +I prefer to consider +.I Project.tmpl +to contain ``standard'' (i.e., best-guess) project configuration +parameters, and +.I Project.ptmpl +to contain the parameters which actually are specific to a given project. +.LP +The disadvantages of this architecture are obvious: +.IP \(bu +.I Imake.tmpl +is somewhat more complex. +.IP \(bu +StdConfigDir must be populated with the additional +.I *.pcf , +.I site.pdef , +.I Project.ptmpl +and +.I Imake.prules +files (although this is easy since they are all empty). +.LP +The advantages are: +.IP \(bu +Configuration information is centralized, but flexibility is maintained. +Projects may +override definitions in the the standard configuration files +without replacing those files directly, and multiple projects may use +files in StdConfigDir cooperatively without interfering with each other. +.IP \(bu +Override files minimize the need for individual +projects to modify the standard non-project specific files +.I Imake.tmpl , ( +.I *.cf , +.I site.def , +.I Project.tmpl +and +.I Imake.rules ) +directly. +The philosophy underlying the architecture is that the standard files +describe a common ``baseline'' configuration, and +individual projects need specify configuration information (using +private +.I *.pcf , +.I site.pdef , +.I Project.ptmpl +and +.I Imake.prules +files) only to the extent that they +.I differ +from the standard. +.IP \(bu +When improvements are made to the standard files, the changes are +immediately available to any project using them via a normal +configuration step, i.e., ``make Makefile;make Makefiles''. +(Of course, it also becomes possible to break a lot of projects if an +erroneous change is made.) +.IP \(bu +Overall, fewer files need to be maintained, and less space is used. +.NH 2 +Other Changes +.LP +.I xmkmf +is used to bootstrap makefiles from imakefiles. +To accommodate the above scheme, it was +modified from the version distributed with X11R4 to search the project's +.I config +directory, then the standard configuration directory +(i.e., ProjConfigDir then StdConfigDir, not just StdConfigDir). +.LP +The definition of the makefile variable IMAKE_CMD in the configuration +files was also changed: +.LP +.DS +Old (from X11R4): +#ifdef UseInstalled + IRULESRC = $(CONFIGDIR) + IMAKE_CMD = $(IMAKE) -DUseInstalled \e + -I$(IRULESRC) \e + $(IMAKE_DEFINES) +#else + IRULESRC = $(CONFIGSRC) + IMAKE_CMD = $(NEWTOP)$(IMAKE) \e + -I$(NEWTOP)$(IRULESRC) \e + $(IMAKE_DEFINES) +#endif +.DE +.\" allow page break here if necessary... +.DS +New: +#ifdef UseInstalled + IMAKE_CMD = $(IMAKE) -DUseInstalled \e + -I$(NEWTOP)$(PROJCONFIGDIR) \e + -I$(STDCONFIGDIR) \e + $(IMAKE_DEFINES) +#else + IMAKE_CMD = $(NEWTOP)$(IMAKE) \e + -I$(NEWTOP)$(PROJCONFIGDIR) \e + -I$(STDCONFIGDIR) \e + $(IMAKE_DEFINES) +#endif +.DE +.LP +The old rule determines whether to use versions of +.I imake +(and +.I makedepend ) +already installed in public directories or +build them in the source tree based on whether UseInstalled is defined or not. +That symbol also determines where to look for configuration files and +defines the value of IRULESRC accordingly. +If UseInstalled is undefined, searches look in CONFIGSRC, the project's +.I config +directory, otherwise in CONFIGDIR, the standard configuration directory. +.LP +This behavior is unsuitable for the purposes described here, since both of +those directories should be searched, if they exist. +The new rule makes UseInstalled relevant only for determining where +to find (and possibly build) +.I imake +and +.I makedepend , +not where to look for configuration files. +.NH +Test of Implementation +.LP +After making the changes described above, a flight test was arranged. +Nine projects developed under six different logins were converted to use +the standard files. +Projects supplied override files where necessary. +These projects were all initially developed using configuration files +that bore a +fairly strong relationship to the standard set, so it was expected +that conversion would not be unbearably odious. +The degree of relationship broke down as follows: +.IP \(bu +Two projects used configuration files that were identical (or nearly +so) to the standards. +Each of these projects, unlike the other seven, comprised only a +single source directory. +As expected, conversion was completely trivial, once the top-level +.I Makefile +was rebuilt with +.I xmkmf . +.IP \(bu +Four projects required additional project-specific specification +beyond the standard configuration +(special include file directories, link libraries, +installation directories, etc.). +These usually required only +.I site.pdef +and +.I Project.tmpl +files in their local +.I config +directories. +One project required a +.I platform.pcf +file. +Project owner and group names (used for install operations) were moved +out of +.I site.def +files into +.I site.pdef . +.IP \(bu +Three projects diverged from the standard files fairly significantly, +because although their configuration files were initially set up from +files similar to the standards, less effort had been exerted to keep +them in sync as project development progressed. +Besides the changes made to the projects described in the previous +paragraph, there were additional special commands for compilation, special +.I Imakefile +rules, etc. +Nevertheless, conversion proceeded smoothly and without incident. +.LP +One thing I had done in the original +.I Project.tmpl +files was to define certain +makefile variables directly (e.g., ``INCLUDESRC=$(TOP)/h''), rather +than by using a previously #define'd +.I cpp +symbol (e.g., ``INCLUDESRC=IncludeSrc'', where IncludeSrc is #define'd +within a #ifndef/#endif block). +This was a short-cut, that works in a non-shared environment but +needed to be fixed to work in a shared environment. +A default value of IncludeSrc needs to be placed in +.I Project.tmpl , +and individual projects redefine that symbol as necessary in +.I Project.ptmpl . +.LP +It was necessary to place a number of +.I cpp +symbol definitions in +.I Project.tmpl +within #ifndef/#endif blocks, since they became liable to being +overridden in +.I Project.ptmpl . +.LP +In the top-level imakefiles for the multiple source directory +projects, the ``make World'' rules had to be adjusted to account for +whether UseInstalled is defined or not. +If so, the build process does not need to try to build +.I imake +and +.I makedepend +in the project source tree. +(That would be a mistake since the source for those programs would not +necessarily be present.) +.LP +Overall, conversion was simple and straightforward. +I judged the conversion odiousness coefficient acceptably low. +.NH +Another Problem\*-Project Groups +.LP +The mechanism described above allows a group of similarly-configured +projects to share configuration files and selectively extend or +override them as necessary. +This provides a solution to the original problem (how to avoid +maintaining multiple full sets of files while maintaining flexibility), +but leads to another. +Suppose that instead of a group of projects, there exist several +groups of projects, such that projects within a group are similar, but +differences between groups are quite large. +This can happen, for instance, if projects designed and developed at one +site under certain conventions are installed at another +site where different conventions are used. +.LP +The difficulty here is that there are two sets of ``standard'' configuration +files, and they cannot both be installed in the same well-known +location. +This problem can be overcome quite simply. +Instead of using StdConfigDir as the single well-known location in which +the standards are installed, define StdConfigPath to be that +directory, and use it as the root of a set of +subdirectories, each of which corresponds to a project group. +Each group's standard configuration files are installed in the appropriate +directory, and StdConfigDir for a given project group +will be defined as that directory (e.g., StdConfigPath/\fIabc\fR for +project \fIabc\fR). +.LP +To allow +.I xmkmf +to be used for bootstrapping, +it was modified slightly again to select +one of the subdirectories as the hardwired-in default, but allow +another to be selected through a +.B \-C +option. +For convenience, the argument following +.B \-C +may be absolute or relative. +If absolute, it is used unchanged. +If relative, StdConfigDir is prepended. +.LP +This modification makes +.I xmkmf +incompatible with the version distributed with X11R4, which is a +problem for sites using that version. +Assuming X configuration files are installed in +.I /usr/lib/X11/config +and the value of StdConfigPath is +.I /usr/lib/config , +this incompatibility can be obviated as follows: +.LP +.DS +mkdir /usr/lib/config +cd /usr/lib/config +ln -s /usr/lib/X11/config X11 +ln -s X11 default +.DE +.LP +For sites without symbolic links, the files in +.I /usr/lib/X11/config +can be copied into +.I /usr/lib/config/X11 , +and +.I xmkmf +can be hacked to use +.I /usr/lib/config/X11 +instead of +.I /usr/lib/config/default +as the default. +Ugly, but workable. +(Also known as ``crude, but effective''.) +.LP +With these conventions, +projects within groups can share redundant information, as before, and +project groups can coexist peacefully. +.LP +The nine projects previously converted were tested against these +additional modifications. +They required only ``xmkmf;make Makefile;make Makefiles'' to properly +reset the configuration information in the makefiles. +.NH +Distribution of Projects +.LP +The mechanism described in this document appears to solve +the problem of reusing +configuration files while allowing for extension and override within +individual projects. +However, when a project is packaged for distribution, it's very little +use to include only those configuration files which are unique to the +project, if the receiving site doesn't have the standard files. +Several alternatives come to mind. +.IP \(bu +Provide the standards as a separate distribution, along with the +sources to +.I imake +and +.I makedepend . +This is perhaps inconvenient for the receiver, as it is another +distribution that needs to be retrieved. +.IP \(bu +Copy all the standard files into the project's +.I config +directory and distribute along with the project. +One has to be careful when doing the copying not to destroy the +project's override files, +the resulting distribution size is larger, and +distributing the standards is unnecessary if receiving site +has them already. +Also, it is not clear which files are actually unique to the project +when this is done. +.IP \(bu +Keep the project's unique configuration files in +.I config +(where they are normally anyway), and copies of the standard files in +.I config-std . +If the receiver has the latter already, they can be jettisoned easily, +otherwise installed in the project's StdConfigDir. +.LP +It is unclear whether any of these has any compelling advantage over +the others. +.NH +Beginning New Projects +.LP +If a new project has special configuration requirements, a file +.I README.{project-name} +should be created in +.I config +explaining what they are. +.NH 2 +Define UseInstalled, or Not? +.LP +If a project wants to use the installed versions of +.I imake +and +.I makedepend , +the initial makefile should be created from the the imakefile by executing +.I xmkmf +with no arguments (or just +.B \-C +.I configdir ) +in the project top-level directory. +This will cause -DUseInstalled to be passed to +.I imake +which will in turn cause the version of IMAKE_CMD that +includes -DUseInstalled to be selected from the configuration files. +Thus -DUseInstalled will propagate nicely through all future ``make Makefile'' +operations. +.LP +If +.I imake +and +.I makedepend +are to be built in the project source tree, UseInstalled should not be defined, +and you must have the source under the project. +.I imake +source is in +.I config +and +.I makedepend +source is in +.I util/makedepend +or +.I util/scripts , +depending on the definition of UseCCMakeDepend. +Execute ``xmkmf \fB.\fR'' (note the \fB.\fR!) in the project top-level +directory. +This will run +.I imake +without -DUseInstalled, and the proper IMAKE_CMD in the config +files will be selected. +.LP +One problematic aspect of +.I xmkmf +is that it really should always pass -DUseInstalled, since it assumes there +is an installed version of +.I imake +anyway (it doesn't specify a path to it). +But then the problem becomes how to turn UseInstalled off later? +You can't run ``make Makefile'' because the version of IMAKE_CMD that +uses -DUseInstalled has already been selected. +.NH +Distribution and Availability +.LP +The standard WRPRC configuration files are (or will be soon) +available for anonymous +.I ftp +access in the +.I ~ftp/pub/imake-stuff +directory, in file +.I config-WRPRC.shar.Z +on host +.I indri.primate.wisc.edu +(Internet address 128.104.230.11). +These files illustrate the concepts discussed in this document. +.LP +This distribution also includes parts of the X11R4 +.I mit/util +source tree (where +.I makedepend +and +.I xmkmf +are found) as well as +.I msub , +a locally-developed utility for yanking the values of +variables directly from makefiles to produce target files from templates. +.LP +The X11R4 configuration files are in the same directory, in +.I config-X11R4.shar.Z . diff --git a/web/glasgow/lit2x-0.16/mkworld/docs/imake-moraes.tex b/web/glasgow/lit2x-0.16/mkworld/docs/imake-moraes.tex new file mode 100644 index 0000000000..afcc96b846 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/docs/imake-moraes.tex @@ -0,0 +1,884 @@ +% Document type: LaTeX +% +% $Header: imake.tex,v 1.1 89/02/25 03:25:37 moraes Exp $ +% +% Copyright 1986, Mark Moraes +% May be freely used for non-commercial purposes provided acknowledgement +% to the source is given. +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%\documentstyle[fullpage,notes]{article} +\documentstyle[fullpage]{article} +%\documentstyle[dvidoc]{article} + +\title{An {\em Imake} tutorial} + +\author{Mark Moraes, Computer Systems Research Institute,\\ +University of Toronto\\ +moraes@csri.toronto.edu} +\date {Revised \today} + +\begin{document} +\maketitle + +{\em {\tt \$(TOP)} in the document refers to the top level directory +of the X Windows source tree.} + +\section{Introduction} {\em Imake} is a tool for generating Makefiles +\footnote{Familiarity with the {\em make} program and C preprocessor +syntax is assumed in this document. Those unfamiliar with these are +advised to read their system manuals for {\em make} and {\em cpp} and +experiment with them} for large software distributions. + +{\em Imake} uses the C preprocessor on macro-makefiles (called {\em +Imakefiles}) to generate Makefiles. It uses a predefined template file +for default values and macros. The {\em imake} program is part of, and +used by the X Windows System software distribution. (The following +description uses fragments from the X Windows distribution as examples +--- you might want to look at the files in {\tt +\$(TOP)/config} for more detailed information. The source +code for {\tt imake} is in {\tt \$(TOP)/util/imake}, and includes a {\tt +sample.rules} file as well as a manual page) + +This document attempts to provide a working introduction to {\em +imake}. In particular, it provides an annotated tour of some of the +relevant files, and through some example {em Imakefiles}. For a more +precise description of {\em imake}'s workings, see the manual page. + +\section{Why {\em Imake}} + +Makefiles have some limitations for large software distributions, +distributed over multiple directories, viz. + +\begin{itemize} + +\item A single makefile doesn't handle multiple directories well, + which means that each directory needs a makefile. At that + point, to change a default value, for example the directory + where the binaries are to be installed, you have to change all + the makefiles. + +\item Typically, makefiles are used to achieve a limited set of + actions, like create a binary from a set of object files, or + generate a library from some object files, etc. These can be + encapsulated in rules that are slightly more complex that the + ones {\em make} supports (which are only suffix based) + +\item A production makefile which supports all the actions necessary + for a development environment, can get fairly long --- + typically, you want a {\em clean} target, an {\em install} + target, a {\em depend} target, and an {\em all} target. + +\item For a system that is ported to many different systems, there are + bound to be differences in the requirements of the systems, + that cannot be dealt with solely at the C source level. For + instance, some System V Unix \footnote{Unix is a trademark of + AT\&T} machines provide a BSD compatibility library which must + be linked in with {\tt -lbsd}, and BSD includes that must the + C compiler must be told about with a {\tt -I/usr/include/bsd + option}. Vanilla {\em make} allows no facilities for changes + like this, and you end up having multiple makefiles, with + suffixes to indicate the type of system being used. +\end{itemize} + +\section{A simple example} +For example, for a simple program, {\tt xcalc}, the Imakefile looks something +like: + +\begin{quote} +\begin{verbatim} + LOCAL_LIBRARIES = $(XLIB) + SYS_LIBRARIES = -lm + #ifdef MacIIArchitecture + DEFINES = -DIEEE + #endif /* MacIIArchitecture */ + SRCS = xcalc.c sr.c + OBJS = xcalc.o sr.o + + ComplexProgramTarget(xcalc) +\end{verbatim} +\end{quote} + +This will generate a Makefile which will contain an {\tt all} target, +and an {\tt xcalc} target, both of which will result in the program +{\tt xcalc} being compiled and linked. The Makefile will also contain +an {\tt install} target, which will install the binaries in specified +destination directories, an {\tt install.man} target, which will +install the manual pages for the program, a {\tt clean} target, which +will remove all compiler generated files, editor backup files, etc., +and a {\tt depend} target which will invoke the {\em makedepend} +program to generate Makefile depenencies. + +It will also contain a {\tt Makefile} target, so you only need to type +{\tt make Makefile} to regenerate the Makefile should the Imakefile +change. + +The real work lies in {\tt ComplexProgramTarget}, which is defined in +the template as a {\tt \#define} macro, which expands out to the make +rules needed to generate program {\em xcalc}, from the variables {\tt +SRCS} and {\tt OBJS}. Let's take a look at that particular rule. + +\begin{quote} +\begin{verbatim} +/* + * This target is the general interface for building a single program + */ +#define ComplexProgramTarget(program) @@\ + PROGRAM = program @@\ + @@\ +AllTarget(program) @@\ + @@\ +program: $(OBJS) $(LOCAL_LIBRARIES) @@\ + $(RM) $@ @@\ + $(CC) -o $@ $(OBJS) $(LOCAL_LIBRARIES) $(LDFLAGS) $(SYSLAST_LIBRARIES) @@\ + @@\ +relink:: @@\ + $(RM) $(PROGRAM) @@\ + $(MAKE) $(MFLAGS) $(PROGRAM) @@\ + @@\ +InstallProgram(program,$(BINDIR)) @@\ +InstallManPage(program,$(MANDIR)) @@\ +DependTarget() @@\ +clean:: @@\ + $(RM) $(PROGRAM) +\end{verbatim} +\end{quote} + +Ignoring {\tt AllTarget()} for now, we see that {\tt program} is +defined to depend on the {\tt OBJS}, and {\tt LOCAL\_LIBRARIES}, and to +make it, the old version is removed (a precaution to save disk space, +among other things), and then, {\tt program} is linked from {\tt OBJS}, +{\tt LOCAL\_LIBRARIES}, and {\tt SYSLAST\_LIBRARIES}. ({\tt LDFLAGS} +are link flags) + +An additional target {\tt relink::} is also generated, which can be +used if libraries change. {\tt InstallProgram} generates the the +{\tt install::} target, which puts the program in {\tt BINDIR}, +{\tt InstallManPage} installs the manual page, {\tt DependTarget} generates +the target for {\em make depend} which invokes a {\em makedepend} +program to follow all {\tt \#includes} in the source. These macros are +listed below --- they aren't very complex. + +\begin{quote} +\begin{verbatim} +/* + * Install a man page. + */ +#define InstallManPage(file,dest) @@\ +InstallManPageLong(file,dest,file) + +/* + * Install a program + */ +#define InstallProgram(program,dest) @@\ +install:: program @@\ + $(INSTALL) -c $(INSTALLFLAGS) program dest + + +/* + * This makes the depend target given OBJS. + */ +#define DependTarget() @@\ +depend:: $(DEPEND) @@\ + @@\ +depend:: @@\ + $(DEPEND) -s "# DO NOT DELETE" -- $(CFLAGS) -- $(SRCS) @@\ + @@\ +$(DEPEND): @@\ + @echo "making $@"; \ @@\ + cd $(DEPENDSRC); $(MAKE) @@\ + + +#define AllTarget(depends) @@\ +all:: depends +\end{verbatim} +\end{quote} + +Note the use of make variables like {\tt \$(INSTALL)} to describe +programs that are used - this makes it possible to define these in the +templates, and thus enhances portability. + +Also, note that the make targets use a conditional dependency branch +with double colons (::) rather than the more common single colon (:). +This allows multiple make targets. + +Based on all this, the Imakefile expands to the following Makefile: + +\begin{quote} +\begin{verbatim} +LOCAL_LIBRARIES = $(XLIB) + SYS_LIBRARIES = -lm + + SRCS = xcalc.c sr.c + OBJS = xcalc.o sr.o + + PROGRAM = xcalc + +all:: xcalc + +xcalc: $(OBJS) $(LOCAL_LIBRARIES) + $(RM) $@ + $(CC) -o $@ $(OBJS) $(LOCAL_LIBRARIES) $(LDFLAGS) $(SYSLAST_LIBRARIES) + +relink:: + $(RM) $(PROGRAM) + $(MAKE) $(MFLAGS) $(PROGRAM) + +install:: xcalc + $(INSTALL) -c $(INSTALLFLAGS) xcalc $(BINDIR) + +install.man:: xcalc.man + $(INSTALL) -c $(INSTMANFLAGS) xcalc.man $(MANDIR)/xcalc.n + +depend:: $(DEPEND) + +depend:: + $(DEPEND) -s "# DO NOT DELETE" -- $(CFLAGS) -- $(SRCS) + +$(DEPEND): + @echo "making $@"; \ + cd $(DEPENDSRC); $(MAKE) + +clean:: + $(RM) $(PROGRAM) +\end{verbatim} +\end{quote} + + +We've omitted a few standard definitions for {\tt CFLAGS, CC, DEPEND, +INSTALL, RM, LDFLAGS} etc. These are installation and system +dependent, and form part of the Imake template. They will precede the +above text. + +\section{Generating the Makefile for the first time} + +Invoking {\em Imake} for the first time is a little complex because +you have to tell it where to find the template, as well as define the +top level directory. The simplest way to do it is to use the {\tt ximake} +script that should have been installed along with the rest of +{\tt X} and {\tt imake}. The invocation is simply +\begin{quote} +{\tt ximake} +\end{quote} + +\section{The {\em Imake} template} + +For a more portable setup, it is possible to split the template file +into the following components: +\begin{itemize} +\item the rules +\item the system-dependent macros, which vary depending on the + specific architecture/operating-system combination, things + like the compiler name, flags. +\item the site dependent variables --- where to install the + binaries, libraries etc. +\end{itemize} + +For example the X distribution has an {\tt Imake.rules} file, which +defines various rules like {\tt ComplexProgramTarget()}, system +dependent files of the form {\em machinetype}{\tt .cf}, eg. {\tt +sun.cf, ultrix.cf}, ..., and a site dependent variables file called +{\tt site.def}. The template looks something like the following: (This +is abbreviated to keep the flavour but omit much detail, deemed +unnecessary for the purposes of this tutorial --- annotations in C +style comments) + +\begin{quote} +\begin{verbatim} +#ifdef sun +#define MacroIncludeFile "sun.cf" +#define MacroFile sun.cf +#undef sun +#define SunArchitecture +#endif /* sun */ + +/* + * The macrofile sun.cf contains definitions specific to Sun + * machines --- examples from it are after this file + */ +/**/########################################################################### +/**/# platform-specific configuration parameters - edit MacroFile to change +#include MacroIncludeFile + +/**/########################################################################### +/**/# site-specific configuration parameters - edit site.def to change +#include "site.def" + +/***************************************************************************** + * * + * DEFAULT DEFINITONS * + * * + * The following section contains defaults for things that can be overridden * + * in the various .macros files and site.def. DO NOT EDIT! * + * * + ****************************************************************************/ + +#ifndef SystemV +#define SystemV NO /* need system 5 style */ +#endif +#ifndef BuildServer +#define BuildServer YES /* go ahead and build server */ +#endif +#ifndef UnalignedReferencesAllowed +#define UnalignedReferencesAllowed NO /* if arbitrary deref is okay */ +#endif +#ifndef BourneShell /* to force shell in makefile */ +#define BourneShell /bin/sh +#endif + +/* + * Lots and lots more variables that can be overridden in the site.def + * including: + */ + +#ifndef DestDir +#define DestDir /* as nothing */ +#endif +#ifndef UsrLibDir +#define UsrLibDir $(DESTDIR)/usr/lib +#endif +#ifndef BinDir +#define BinDir $(DESTDIR)/usr/bin/X11 +#endif +#ifndef IncDir +#define IncDir $(DESTDIR)/usr/include/X11 +#endif +#ifndef IncRoot +#define IncRoot $(DESTDIR)/usr/include +#endif +#ifndef AdmDir +#define AdmDir $(DESTDIR)/usr/adm +#endif +#ifndef LibDir +#define LibDir $(USRLIBDIR)/X11 +#endif +#ifndef LintlibDir +#define LintlibDir $(USRLIBDIR)/lint +#endif +#ifndef FontDir +#define FontDir $(LIBDIR)/fonts +#endif + +/* + * This is followed by the actual definitions that will appear in the + * Makefile, again, the list is partial. + */ +/* + * This list must be reflected in the DIRS_TO_BUILD list in the top-level + * Makefile. + */ + DESTDIR = DestDir /* root of install */ + USRLIBDIR = UsrLibDir /* libraries */ + BINDIR = BinDir /* programs */ + INCDIR = IncDir /* header files */ + INCROOT = IncRoot /* base for header files */ + ADMDIR = AdmDir /* server log files */ + LIBDIR = LibDir /* rgb, XErrorDB, etc. */ + LINTLIBDIR = LintlibDir /* lint libraries */ + FONTDIR = FontDir /* font directories */ + + CFLAGS = $(CDEBUGFLAGS) $(INCLUDES) $(STD_DEFINES) $(DEFINES) + LINTFLAGS = $(LINTOPTS) $(INCLUDES) $(STD_DEFINES) $(DEFINES) -DLINT + LDFLAGS = $(CDEBUGFLAGS) $(SYS_LIBRARIES) $(SYSAUX_LIBRARIES) + TOP = TOPDIR +#ifdef CompileWithInstalled + EXTENSIONLIB = $(USRLIBDIR)/lib/libXext.a + XLIB = $(USRLIBDIR)/libX11.a + XMULIB = $(USRLIBDIR)/libXmu.a + OLDXLIB = $(USRLIBDIR)/liboldX.a + XTOOLLIB = $(USRLIBDIR)/libXt.a + XAWLIB = $(USRLIBDIR)/libXaw.a + INCLUDES = -I$(INCDIR) -I$(INCROOT) +#else /* ! CompileWithInstalled */ + EXTENSIONLIB = $(EXTENSIONSRC)/lib/libXext.a + XLIB = $(XLIBSRC)/libX11.a + XMULIB = $(XMUSRC)/libXmu.a + OLDXLIB = $(OLDXLIBSRC)/liboldX.a + XTOOLLIB = $(TOOLKITSRC)/libXt.a + XAWLIB = $(AWIDGETSRC)/libXaw.a + INCLUDES = -I$(TOP) +#endif /* CompileWithInstalled */ + +/* + * The above fragment illustrates how different makefiles can be + * generated for the distribution, presumably, once with + * CompileWithInstalled not defined in site.def, so that the + * distribution can be bootstrapped and built for the first time, then + * with CompileWithInstalled defined in site.def so that it uses the + * already installed libraries instead of requiring the compiled + * objects remain forever in src directories + */ + + MACROFILE = MacroFile + ICONFIGFILES = $(IRULESRC)/Imake.tmpl \ + $(IRULESRC)/$(MACROFILE) $(IRULESRC)/site.def + IMAKE_DEFINES = /* leave blank, for command line use only */ + IMAKE_CMD = $(NEWTOP)$(IMAKE) -TImake.tmpl -I$(NEWTOP)$(IRULESRC) \ + -s Makefile $(IMAKE_DEFINES) + +/* + * Now include the actual rules file --- this contains the definitions + * of macros like ComplexProgramTarget, as described earlier + */ + +#include "Imake.rules" + +/* + * INCLUDE_IMAKEFILE is defined by the imake program to be the name of + * the Imakefile you are processing, usually just Imakefile. It + * gets included here. + */ +/**/########################################################################### +/**/# start of Imakefile +#include INCLUDE_IMAKEFILE + +/* + * Followed by some basic rules for all Makefiles, especially useful + * for Imakefiles where all you want to do is make the subdirectories. + */ +/**/########################################################################### +/**/# Imake.tmpl common rules for all Makefiles - do not edit +/* + * These need to be here so that rules in Imakefile occur first; the blank + * all is to make sure that an empty Imakefile doesn't default to make clean. + */ +emptyrule:: + +CleanTarget() +MakefileTarget() +TagsTarget() + +#ifdef IHaveSubdirs + +/**/########################################################################### +/**/# rules for building in SUBDIRS - do not edit + +InstallSubdirs($(SUBDIRS)) +InstallManSubdirs($(SUBDIRS)) +CleanSubdirs($(SUBDIRS)) +TagSubdirs($(SUBDIRS)) +MakefileSubdirs($(SUBDIRS)) + +#else + +/**/########################################################################### +/**/# empty rules for directories that do not have SUBDIRS - do not edit + +install:: + @echo "install done" + +install.man:: + @echo "install.man done" + +Makefiles:: + +#endif /* if subdirectory rules are needed */ + +/**/########################################################################### +/**/# dependencies generated by makedepend +\end{verbatim} +\end{quote} + +The {\tt Sun.macros} file looks something + +\begin{quote} +\begin{verbatim} +#define SunOSPlatform YES /* set to NO if not running SunOS */ +#define OSName SunOS 3.5 +#define OSMajorVersion 3 +#define OSMinorVersion 5 + +/**/# platform: $XConsortium: Sun.macros,v 1.52 88/10/23 11:00:55 jim Exp $ +/**/# operating system: OSName + +#if SunOSPlatform && OSMajorVersion == 3 && OSMinorVersion <= 2 +#define OptimizedCDebugFlags /* as nothing */ +#endif + +BOOTSTRAPCFLAGS = + AS = as + CC = cc + CPP = /lib/cpp + LD = ld + LINT = lint + INSTALL = install + TAGS = ctags + RM = rm -f + MV = mv + LN = ln -s + RANLIB = ranlib +RANLIBINSTFLAGS = -t + AR = ar clq + LS = ls + LINTOPTS = -axz + LINTLIBFLAG = -C + MAKE = make +STD_CPP_DEFINES = + STD_DEFINES = + +/* This defines the server you want */ +#define XsunServer Xsun +\end{verbatim} +\end{quote} + +There's more in the macros file but the rest of the definitions are X +dependent. + +Most of the definitions shown here can be overridden in the {\tt +site.def} file, so a system administrator can completely reconfigure +the setup, if necessary. + +\section{Simple Imakefiles} + +We end with a few simple examples to illustrate the rules in the X +Imake.rules. + +\subsection{A single program, one source file} + +The first is for a simple program that has only one source file {\tt +xstring.c} and a corrsponding manual page {\tt xstring.man} It +requires the libraries {\tt XAWLIB, XTOOLLIB, and XLIB} (the X Athena +widgets, the X Toolkit, and the C library interface to X). + +\begin{quote} +\begin{verbatim} +LOCAL_LIBRARIES = $(XAWLIB) $(XTOOLLIB) $(XLIB) + +SimpleProgramTarget(xstring) +\end{verbatim} +\end{quote} + +\subsection{A single program, multiple source files} + +A slightly more complex Imakefile is the one for {\tt xcalc}, the +example described earlier. + +\begin{quote} +\begin{verbatim} +LOCAL_LIBRARIES = $(XLIB) + SYS_LIBRARIES = -lm +#ifdef MacIIArchitecture + DEFINES = -DIEEE +#endif /* MacIIArchitecture */ + SRCS = xcalc.c sr.c + OBJS = xcalc.o sr.o + +ComplexProgramTarget(xcalc) +\end{verbatim} +\end{quote} + +\subsection{Multiple programs} + +An Imakefile for a directory with multiple programs is a little more +complicated. {\tt ComplexProgramTarget\_1} is similar to {\tt +ComplexProgramTarget} but it uses {\tt OBJS1} to link the program +instead of {\tt OBJS}. The first argument is the program name, the +second is the list of {\tt LOCAL\_LIBRARIES}, and the third is the list of +{\tt SYSLAST\_LIBRARIES}. It is possible to have more complex programs +defined (the X Imake rules allow for 3 such targets) called +{\tt ComplexProgramTarget\_1, ComplexProgramTarget\_2,} and {\tt +ComplexProgramTarget\_3} which link {\tt OBJS1, OBJS2} and {\tt OBJS3} +respectively. + +{\tt SingleProgramTarget} is a variant that allows multiple programs +to be built - it differs from a {\tt ComplexProgramTarget\_}n in that +it does not generate targets to install the program or the manual +page, so it can be used for internal programs as well --- i.e. +programs that are compiled to generate files or preprocess data for +the installable targets. + +{\tt CFLAGS}, {\tt LINTFLAGS} and {\tt LDFLAGS} is defined as follows: +\begin{quote} +\begin{verbatim} + CFLAGS = $(CDEBUGFLAGS) $(INCLUDES) $(STD_DEFINES) $(DEFINES) + LINTFLAGS = $(LINTOPTS) $(INCLUDES) $(STD_DEFINES) $(DEFINES) -DLINT + LDFLAGS = $(CDEBUGFLAGS) $(SYS_LIBRARIES) $(SYSAUX_LIBRARIES) +\end{verbatim} +\end{quote} + +An Imakefile can redefine some of the right hand side variables - +typically, +\begin{itemize} +\item {\tt CDEBUGFLAGS} can be {\tt -g} or {\tt -O}, or if you're +using the GNU C compiler, {\tt -g -O}, + +\item{\tt INCLUDES} is usually {\tt -I\$\{TOP\}} by default, + +\item {\tt DEFINES} is left for user defined {\tt-D} flags. +({\tt STD\_DEFINES} is defined by the system macros file +and should be left alone) + +\item {\tt SYS\_LIBRARIES} or {\tt SYSAUX\_LIBRARIES} can be used for +{\tt -l} options to link in system libraries. ({\tt SYSLAST\_LIBRARIES} +is defined by the system macros, typically for portability or +emulation. + +\end{itemize} + +\begin{quote} +\begin{verbatim} +XWSRC=$(CONTRIBSRC)/widgets/Xhp +XPICLIBDIR=$(LIBDIR)/xpic +# The documents go in $(DOCDIR)/xpic - see the install target. +DOCDIR=/local/doc/X11 +############################################################# +# -DXPIC is used by the filename completion code. +# -DMAGIC will include code that puts a '#! $(BINDIR)/xpic' +# header on the saved xpic files, and make them executable, so +# you can just execute the saved xpic file and it starts up +# xpic. +# -DDEBUG turns on debugging output - do you really want that?! +# -DDRAWBBOX is also for debugging - it draws the bounding box +# of all gels. +# -DGRAB should be defined if XtAddGrab and XtRemoveGrab can be +# made to work in Minibuf.c and input.c - I can't seem to get them +# to work. +# -DTYPEOUT includes the typeout code - this is still not used by +# xpic - not much point defining it. +DEFINES = -DXPIC -DMAGIC +############################################################# +CDEBUGFLAGS = -g +INCLUDES = -I$(XWSRC) -Ibitmaps +############################################################# +# Note - You need the HP widgets (Xw) for the X11 Toolkit +# These should be defined in an Imake.tmpl - except that the +# normal Imake.tmpl insists on these being compiled in the +# X directory tree. +# For X11R3, the HP widgets use the R2 Intrinsics, which are +# provided in with the HP src. +XWLIB=$(XWSRC)/lib/libXw.a +XTOOLLIB=$(XWSRC)/lib/libXt.a +# Sigh - we use sin(), cos(), atan2() for arrow. +MATHLIB=-lm + +OBJS1 = main.o windows.o xpic.o handlers.o input.o \ + event.o grid.o error.o spline.o arrow.o newfonts.o \ + util.o gels.o null.o obj_line.o obj_spline.o obj_text.o \ + obj_box.o obj_circ.o obj_ell.o obj_block.o obj_elem.o \ + updown.o text.o isqrt.o ask.o xtypeout.o Minibuf.o Window.o +SRCS1 = main.c windows.c xpic.c handlers.c input.c \ + event.c grid.c error.c spline.c arrow.c newfonts.c \ + util.c gels.c null.c obj_line.c obj_spline.c obj_text.c \ + obj_box.c obj_circ.c obj_ell.c obj_block.c obj_elem.c \ + updown.c text.c isqrt.c ask.c xtypeout.c Minibuf.c Window.c +############################################################# +OBJS2 = x2pic.o hash.o +SRCS2 = x2pic.c hash.c +############################################################# +OBJS3 = x2ps.o hash.o +SRCS3 = x2ps.c hash.c + +PROGRAMS = xpic x2ps x2pic + +/* + * ComplexProgramTarget(program, local libraries, system libraries) + * + * The difference between local libraries and system libraries is that + * the program will depend on the local libraries, so they must be + * filenames, while the system libraries are not dependencies, so + * you can use -l + */ +ComplexProgramTarget_1(xpic,$(XWLIB) $(XTOOLLIB) $(XLIB),$(MATHLIB)) + +/* + * SingleProgramTarget(program, objects, local libraries, system libraries) + * + * Note that this does not generate install: targets so we do that + * explicitly + */ +SingleProgramTarget(x2pic,$(OBJS2) $(MALLOC),,) +InstallProgram(x2ps, $(BINDIR)) +InstallManPage(x2ps, $(MANDIR)) + +SingleProgramTarget(x2ps,$(OBJS3) $(MALLOC),,$(MATHLIB)) +InstallProgram(x2pic, $(BINDIR)) +InstallManPage(x2pic, $(MANDIR)) + +/* + * This will install the script x2tex.script as $(BINDIR)/x2tex + */ +InstallScript(x2tex, $(BINDIR)) +InstallManPage(x2tex, $(MANDIR)) + +/* + * Some additional files we want to install. This is ordinary Make + * stuff, but we use Imake defined variables like $(INSTALL). + * $(INSTALLAPPFLAGS) is meant for normal text files. + */ + +install:: + -mkdir $(XPICLIBDIR) + $(INSTALL) $(INSTAPPFLAGS) x2ps.pro $(XPICLIBDIR) + $(INSTALL) $(INSTAPPFLAGS) x2ps.tra $(XPICLIBDIR) + -mkdir $(XPICLIBDIR)/fontdesc + $(INSTALL) $(INSTAPPFLAGS) fontdesc/xpic $(XPICLIBDIR)/fontdesc + $(INSTALL) $(INSTAPPFLAGS) fontdesc/x2pic $(XPICLIBDIR)/fontdesc + $(INSTALL) $(INSTAPPFLAGS) fontdesc/x2tpic $(XPICLIBDIR)/fontdesc + $(INSTALL) $(INSTAPPFLAGS) fontdesc/x2ps $(XPICLIBDIR)/fontdesc + +/* + * This is a trick that generates a .h file from the Makefile + * variables. We compare the newly generated file tune.h.new with + * the old one tune.h, and replace the old one with the new one only + * if it is different. This will prevent unnecessary compiles, and + * avoids the need to have .c files depend on the Makefile because + * you want them recompiled if a -D define changes + */ +tune.h: Makefile + echo \#define LIBDIR \"$(XPICLIBDIR)\" > tune.h.new + echo \#define PROGRAMNAME \"$(BINDIR)/xpic\" >> tune.h.new + echo \#define DUMPDIR \"$(DUMPDIR)\" >> tune.h.new + -cmp -s tune.h.new tune.h || cp tune.h.new tune.h +\end{verbatim} +\end{quote} + +\subsection{A library archive of object files} + +An Imakefile for a library looks something like: + +\begin{quote} +\begin{verbatim} +# +# This library contains miscellaneous utility routines and is not part +# of the Xlib standard. +# + + STD_DEFINES = LibraryDefines + CDEBUGFLAGS = LibraryCDebugFlags + INCLUDES = -I. -I$(TOP) -I$(TOP)/X11 + INSTALLFLAGS = $(INSTINCFLAGS) + LINTLIBS = $(LINTXLIB) + +#ifdef OsNameDefines +OS_NAME_DEFINES = OsNameDefines +#endif + +HEADERS = \ + Xmu.h + +SRCS = Atoms.c CrPixFBit.c CvtStdSel.c DefErrMsg.c DrRndRect.c FToCback.c \ + Lookup.c Lower.c RdBitF.c StrToBS.c StrToBmap.c StrToCurs.c \ + StrToJust.c StrToOrnt.c StrToWidg.c + +OBJS = Atoms.o CrPixFBit.o CvtStdSel.o DefErrMsg.o DrRndRect.o FToCback.o \ + Lookup.o Lower.o RdBitF.o StrToBS.o StrToBmap.o StrToCurs.o \ + StrToJust.o StrToOrnt.o StrToWidg.o + +all:: + +NormalLibraryTarget(Xmu,$(OBJS)) +LintLibraryTarget(Xmu,$(SRCS)) +InstallLibrary(Xmu,$(USRLIBDIR)) +InstallLintLibrary(Xmu,$(LINTLIBDIR)) + +InstallMultiple($(HEADERS),$(INCDIR)) + +DependTarget() + +NormalLintTarget($(SRCS)) + +\end{verbatim} +\end{quote} + +Sometimes, it is nice to be able to generate libraries compiled with +debugging on, and libraries compiled with profiling on, so that these +can be used by developers. Something like the following, added before +the {\tt NormalLibraryTarget} + +\begin{quote} +\begin{verbatim} +#if DebugLibXmu && ProfileLibXmu +DebuggedAndProfiledLibraryObjectRule() +#else +# if DebugLibXmu +DebuggedLibraryObjectRule() +# else +# if ProfileLibXmu +ProfiledLibraryObjectRule() +# else +NormalLibraryObjectRule() +# endif +# endif +#endif +\end{verbatim} +\end{quote} + +and something like the following added before the {\tt +InstallMultiple} would do the trick quite nicely. + +\begin{quote} +\begin{verbatim} +#if ProfileLibXmu +ProfiledLibraryTarget(Xmu,$(OBJS)) +InstallLibrary(Xmu_p,$(USRLIBDIR)) +#endif + +#if DebugLibXmu +DebuggedLibraryTarget(Xmu,$(OBJS)) +#endif +\end{verbatim} +\end{quote} + +If we wanted a debugging library, we'd define the symbol {\tt +DebugLibXmu} in the {\tt site.def} file, and the DebuggedLibraryRule +would ensure it generated a library target for {\tt lib}name{\tt \_d.a}, +while if we defined the {\tt ProfileLibXmu} symbol, we would get a +profiled library target for {\tt lib}name{\tt \_p.a}, in addition to +the usual {\tt lib}name{\tt .a}. This sort of configurability is very +hard to get from a vanilla makefile. + +\subsection{Subdirectories} + +The following Imakefile is for a directory that only contains +subdirectories, and we want to make each of the subdirectories: + +\begin{quote} +\begin{verbatim} +#define IHaveSubdirs +#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' + +SUBDIRS = X \ + oldX \ + Xt \ + Xmu \ + Xaw + +MakeSubdirs($(SUBDIRS)) +DependSubdirs($(SUBDIRS)) +MakeLintLibSubdirs($(SUBDIRS)) +MakeLintSubdirs($(SUBDIRS),install.ln,install.ln) + +\end{verbatim} +\end{quote} + +This will have the {\tt Makefiles} target defined as well as {\tt +Makefile} and using the {\tt make Makefiles} command will cause it to +regenerate the Makefiles in the subdirectories. It does this by +prepending a ``../'' in front of the {\tt TOP} variable, which +means that {\tt TOP} should be a relative path. (This is the only +reason for {\tt TOP} to be a relative path - if there are no +subdirectories, {\tt TOP} can easily be an absolute path. + +\section{Miscellaneous} + +{\em Imake} puts null comments of the form {\tt \/\*\*\/} in front of +normal {\em make} style comments i.e. the {\tt \#} to protect them +from the C preprocessor. They survive unscathed in the resulting +Makefile, while C style comments vanish. This provides a good way to +distinguish betwen Imakefile comments and comments that you want to +appear in the Makefile. + +However, it does not protect comments in the files that are included {\tt +(site.def, Imake.rules, machine.macros)} so if you want to use {\tt +\#} style comments in those files, you must protect them yourself with +{\tt \/\*\*\/} in front of them. + +\section{History} + +{\em Imake} was originally written by Todd Brunhoff (toddb@tekcrl.crl) +for X Windows Version 11 Release 1. The configurations for X Windows +Version 11 Releases 2, 3 and 4 were reworked considerably by Jim Fulton +(jim@expo.lcs.mit.edu) to isolate the rules, machine dependent +information, and site dependent information into separate files. + +\end{document} diff --git a/web/glasgow/lit2x-0.16/mkworld/docs/mkworld_guide/Jmakefile b/web/glasgow/lit2x-0.16/mkworld/docs/mkworld_guide/Jmakefile new file mode 100644 index 0000000000..21e70e9142 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/docs/mkworld_guide/Jmakefile @@ -0,0 +1,4 @@ +LitStuffNeededHere(docs depend) +InfoStuffNeededHere(docs) + +LitDocRootTarget(mkw_guide,lit) diff --git a/web/glasgow/lit2x-0.16/mkworld/docs/mkworld_guide/mkw_guide.lit b/web/glasgow/lit2x-0.16/mkworld/docs/mkworld_guide/mkw_guide.lit new file mode 100644 index 0000000000..2de7bf5199 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/docs/mkworld_guide/mkw_guide.lit @@ -0,0 +1,716 @@ +% +% $Header$ +% +\begin{onlystandalone} +\documentstyle[11pt,literate]{article} +\begin{document} +\title{The ``make world'' configuration system---a guide for the brave} +\author{The GRASP Team (scribe: Will Partain), \\ +Department of Computing Science, \\ +University of Glasgow, \\ +Glasgow, G12 8QQ, UK. \\ +\\ +Email: glasgow-haskell-\{bugs,request\}\@dcs.glasgow.ac.uk} +\maketitle +\begin{rawlatex} +\tableofcontents +\clearpage +\end{rawlatex} +\end{onlystandalone} + +%************************************************************************ +%* * +\section[make-world-tutorial]{An introduction to the ``make world'' configuration subsystem} +%* * +%************************************************************************ + +{\em [MEGA-NOTE: This subsystem needs SUBSTANTIAL REVISION; however, +the required time hasn't sprung/isn't springing free. Also, there is +no clear winner emerging in the How-to-Configure-Free-Software +sweepstakes. (Ideas welcome.) This documentation is only intended as +a ``survival guide'' in the interim.]} + +Our sources are manipulated with a variant of the ``imake'' system +that comes with the X Window System.\footnote{Actually, our variant is +a variant of Paul DuBois's ``imake for multiple projects,'' from the +Wisconsin Regional Primate Research Center. We are grateful to him +for making his work available to the world.} (We call our version of +the main program ``jmake,'' so things don't get mixed up.) Our +everyday term for the system is ``make world,'' because the system's +mission is to (re-)build {\em everything} correctly when you type +\tr{make world}. + +%************************************************************************ +%* * +\subsection[make-world-goals]{Goals of ``make world''} +%* * +%************************************************************************ + +The purpose of the ``make world'' subsystem is to help with these +configuration tasks: +\begin{itemize} +\item +Manipulating the system as a whole. We want to be able to do: +\begin{verbatim} +% cd ghc-<version> +% make <target> +\end{verbatim} + +and for the make \tr{<target>} to be built {\em throughout} the system +(e.g., \tr{make depend}, to build all make dependencies in the +distribution). The code to do this recursive make-ery must live in +one place and must {\em not} rely on (zillions of) hand-built +Makefiles to work. + +\item +Porting the system to a new machine platform. All machine dependencies +must be gathered together in one place and, again, must not be +distributed through zillions of Makefiles (just waiting to go wrong). + +\item +Customising the system for a particular site. Same rationale. + +\item +Customising the \Haskell{} compilation system that you build. Example +possibilities (not all relevant at this time): choosing one of several +parsers, choosing which optimisation passes to build in, choosing to +omit/include some debugging code, choosing which code generator(s) to +build in, choosing which C compiler to use in compiling +\Haskell{}-generated C files, what C compiler options to use in that +case, and on and on.... + +\item +Customising the installation of the compilation system. Where the +binaries go, where the library files go, ... + +\item +Supporting several builds/customisations ongoing simultaneously. + +\item +Supporting several people working from a master copy of the source. +\end{itemize} + +%************************************************************************ +%* * +\subsection[make-world-concepts]{Basic concepts of ``make world''} +%* * +%************************************************************************ + +The ``make world'' subsystem builds an ordinary \tr{Makefile} for each +directory in a system, from a set of system-wide configuration files +(in the \tr{mkworld/} directory) and a single directory-specific file, +called the \tr{Jmakefile}. Things the ``make world'' system needs to know +from you: +\begin{description} +\item[Machine architecture of the host you're building with:] +It normally figures this out for itself. + +\item[What project you're configuring for:] For the new Glasgow +Haskell compiler, use \tr{ghc}. + +\item[What setup of the project you're configuring for:] Unless you +have reason to do otherwise, use the \tr{std} setup. + +\item[The absolute pathname of the top of the source tree.] +\end{description} + +Armed with this information, the ``make world'' system will create +\tr{Makefiles} in all the subdirectories of a system. Each of the +Makefiles will be, in effect, a {\em database of configuration facts}. +Obviously, the program \tr{make} can then use these facts. You can +also use the utility program \tr{msub} to substitute these facts into +other source files. + +%************************************************************************ +%* * +\subsection[make-world-operation]{Basic operation of ``make world''} +%* * +%************************************************************************ + +Just like its ``imake'' ancestor for the X Window System, ``make +world'' is a {\em low-tech} solution to the tasks mentioned above. +The files involved are: +\begin{description} +\item[Platform-, site-, project-, and setup-dependent configuration files:] +{\em All} such information lives in {\em one} directory, notably the +top-level \tr{mkworld} directory. + +\item[Configuration file for a particular directory:] +This is what the one-per-directory \tr{Jmakefile}s are. +\end{description} + +All of the above files are a mixture of \tr{cpp} (C pre-processor) +directives and plain-vanilla make stuff (very plain vanilla---so it +will work with any make). The \tr{jmake} program simply feeds the +master template file (\tr{mkworld/Jmake.tmpl}) into \tr{cpp}, which +will then \tr{#include} all of the appropriate platform-, site-, +etc., dependent files, as well as the \tr{Jmakefile} for the directory +in question. \tr{cpp} expands all of the \tr{#define}d macros, and +what you are left with is an ordinary (but large and confusing) +\tr{Makefile}! + +Here is a small, possibly instructive example, from the \tr{Jmakefile} +for this document: +\begin{verbatim} +INeedLitStuffHere(all depend) + +LitDocRootTargetWithNamedOutput(root,lit,root-standalone) +\end{verbatim} + +The exact meanings of these \tr{cpp} macro-invocations are not +important;\footnote{They say that (1)~the literate stuff must be available +before doing \tr{make all} or \tr{make depend}, and (2)~we want to +build a literate document with provision for both standalone +processing and otherwise.} what is important is what you {\em don't} +see: hard-wired filenames about where to find the literate programs or +other tools, hardwired install directories, presuppositions about how +your man pages are arranged, what kind of hardware you have, +idiosyncratic (and probably inappropriate) \tr{make} suffix rules, +etc., etc. + +After expanding the master \tr{Jmake.tmpl} template with all of the +appropriate configuration files in \tr{mkworld/}, the above fragment +blows out into (in the real \tr{Makefile}):\footnote{Some long lines +truncated.} +\begin{verbatim} +all depend:: $(INFO) $(MAKEINFO) $(POSTMAKEINFO) + +$(INFO) $(MAKEINFO) $(POSTMAKEINFO): + @echo "checking $@ over in" $(INFOSRC) "first..."; \ + cd $(INFOSRC); $(MAKE) all; \ + echo "okay, continuing in $(CURRENT_DIR)" + +all depend:: $(LITSRC)/lit2pgm $(LITSRC)/lit2texi $(LITSRC)/lit2latex [...] + +$(LITSRC)/lit2pgm $(LITSRC)/lit2texi $(LITSRC)/lit2latex [...] + @(cd $(LITSRC); if [ -f lit2pgm ]; then \ + echo "checking $@ in $(LITSRC) first..."; $(MAKE) all; else \ + echo "bootstrapping $@ with lit2pgm.BOOT in $(LITSRC) first..."; \ + $(MAKE) LIT2PGM="lit2pgm.BOOT -Alit2pgm" lit-deatify all; fi; \ + echo "okay, continuing in $(CURRENT_DIR)") + +docs:: root.info root.dvi + +clean:: + $(RM) root.info root.dvi root.texi root.tex + +depend:: + $(MKDEPENDLIT) $(MKDEPENDLITFLAGS) root.lit + +root.info:: root.texi + $(RM) $@ + $(MAKEINFO) $(MAKEINFOFLAGS) root.texi \ + && $(POSTMAKEINFO) root.info + +root.dvi:: root.tex + $(RM) $@ + $(LTX) root.tex + +root.texi: root-standalone.itxi + $(RM) $@ + $(LIT2TEXI) -S $(LIT2TEXIFLAGS) -N root.info -o root.texi root-standalone.itxi + +root-standalone.itxi: root.lit + $(RM) $@ + $(LIT2TEXI) -S -c $(LIT2TEXIFLAGS) -o root-standalone.itxi root.lit + +root.tex: root-standalone.itex + $(RM) $@ + $(LIT2LATEX) -S $(LIT2LATEXFLAGS) -o root.tex root-standalone.itex + +root-standalone.itex: root.lit + $(RM) $@ + $(LIT2LATEX) -S -c $(LIT2LATEXFLAGS) -o root-standalone.itex root.lit +\end{verbatim} + +%************************************************************************ +%* * +\subsection[make-world-more-info]{More information about Imake (``make world'' ancestor)} +%* * +%************************************************************************ + +{\em As I say, the ``make world'' system is a clear candidate for +revision, so we aren't over-exerting ourselves to make this version +better.} + +I got the ``imake'' code that I turned into ``jmake'' (a.k.a. ``make +world'') from Paul DuBois, at the Wisconsin Regional Primate Research +Center. The principles of operation are {\em exactly} the same, so I +have put a copy of every known ``imake'' document in the +\tr{mkworld/doc/} subdirectory. + +%************************************************************************ +%* * +\subsection[config-file-org]{Organisation of the \tr{mkworld} configuration files} +%* * +%************************************************************************ + +The main Makefile template in \tr{mkworld/} is \tr{Jmake.tmpl}. It +first determines the machine type, then starts slurping these files +(all in \pl{mkworld/}) in this order (assume project \tr{project} and +setup \tr{setup}): +\begin{verbatim} +# find out things about the machine +<a platform-specific file> + +# now things about your site +site-project-setup.odef +site-project.odef +site.def + +# things all projects can use but that your project/setup might override +AllProjects-project-setup.otmpl +AllProjects-project.otmpl +AllProjects.tmpl + +# things just for your project +Project-project-setup.otmpl +Project-project.tmpl + +# the rules, or macro definitions, actually used in Jmakefiles +# (may be overidden [uncommon]) +Jmake-project-setup.orules +Jmake-project.orules +Jmake.rules + +# finally, the directory-specific what-you-want-to-happen info +Jmakefile +\end{verbatim} + +Notice how you can always use a \tr{*-project-setup.*} file to +override a \tr{*-project.*} file, which you can use to override the +general defaults... + +%************************************************************************ +%* * +\subsection[std-make-world-actions]{Standard actions in ``make world''} +%* * +%************************************************************************ + +The expected normal cycle of \tr{make}ing with a ``make world''-ified +project (once you're sure all your configuration files are set up +correctly!): +\begin{description} +\item[\tr{make Makefile}:] +Make the very topmost Makefile. It's crucial to get this right! +\item[\tr{make Makefiles}:] +Make all the other Makefiles (recursively). +\item[\tr{make depend}:] +Make all the automatically-generated dependencies (with +\tr{mkdependHS}, \tr{mkdependC}, \tr{mkdependlit} etc.). +\item[\tr{make all}:] +Build the system(s). +\item[\tr{make tags}:] +Make some Emacs-friendly TAGS files, if you believe in them. +\item[\tr{make runtests}:] +Run any test suite that you may have provided. +\item[\tr{make docs}:] +Make any documentation that goes with the system(s). +\item[\tr{make install}:] +Install the system(s). +\item[\tr{make install_docs}:] +Install the documentation. +\item[\tr{make clean}:] +Clean up after yourself. +\item[\tr{make veryclean}:] +If you really want to get rid of all machine-generated files... +\end{description} + +Another generally-supported make target is: \tr{make whoami} (echos +the project and setup strings). + +%************************************************************************ +%* * +\subsection[when-to-make-what]{When to use what \tr{make} target} +%* * +%************************************************************************ + +Several of the standard ``make world'' targets depend upon you to +re-run them at the right time. + +\begin{itemize} +\item +The normal thing you do 90\% of the time is just type: +\tr{make} (or, equivalently, \tr{make all}). + +\item +If you change a \tr{Jmakefile} (or the configuration files in the +\tr{mkworld/} directory), then you need to re-\tr{make Makefile}. + +\item +If you changed the configuration files in some globally-important way, +then you should re-\tr{make Makefiles}, {\em after} the +\tr{make Makefile}. + +\item +If you change anything from which make dependencies are automatically +generated (e.g., import declarations in \Haskell{} modules or +\tr{#include} directive in C programs), then you need to +re-\tr{make depend} before continuing with a regular \tr{make}. +\end{itemize} + +Rather than worry too much about these constraints, we re-run these +things every night: +\begin{verbatim} +% (make Makefile && make Makefiles && make depend) >& overnight.log +\end{verbatim} + +%************************************************************************ +%* * +\section[day-to-day-make-worlding]{Day-to-day use of ``make world'' (valuable tips!)} +%* * +%************************************************************************ + +%************************************************************************ +%* * +\subsection[bad-Makefile]{When you mess up your \tr{Makefile}} +%* * +%************************************************************************ + +The NUMBER ONE \tr{make}ing RULE: If, in running \tr{make Makefile} or +\tr{make depend} or {\em anything}, you get a message indicating your +\tr{Makefile} is rubbish, {\em immediately} (a)~save a copy to look +at, and (b)~restore a viable \tr{Makefile} with: +\begin{verbatim} +mv Makefile.bak Makefile +\end{verbatim} +That way, at least you will have a working (if out-of-date) +\tr{Makefile} while you consider your options! + +%************************************************************************ +%* * +\subsection[new-dir-in-mkworld]{Adding a directory to a ``make world'' source tree} +%* * +%************************************************************************ + +\begin{verbatim} +% mkdir new_dir + +% emacs ./Jmakefile + # Add "new_dir" to the list of SUBDIRS (in parent directory). + +% emacs new_dir/Jmakefile + # Create a Jmakefile for the new subdir; probably copy one from elsewhere. + # An empty Jmakefile works, and is sometimes useful. + +% make Makefile + # Tells current-directory's Makefile that it has a new subdirectory. + +% make SUBDIRS=new_dir Makefiles + # makes the Makefile (from the new Jmakefile) in "new_dir" +\end{verbatim} + +%************************************************************************ +%* * +\subsection[feeding-flags-with-mkworld]{Feeding command flags into ``make world''} +%* * +%************************************************************************ + +NOT DONE YET. + +%************************************************************************ +%* * +\subsection[overnight-mkworlding]{Nice ``mkworld'' things to do overnight} +%* * +%************************************************************************ + +Out-of-sync ``make world'' stuff spells eventual trouble. What we do +every night (at a minimum) is: +\begin{verbatim} +% cd top-of-your-world +% make Makefile +% make Makefiles +% make depend +% make all +\end{verbatim} + +%************************************************************************ +%* * +\subsection[fastmake-script]{Using the \tr{fastmake} script (to cheat)} +%* * +%************************************************************************ + +One rather great pain about the make-dependencies generated by +\tr{makedependHS} for the compiler is that there are zillions of them, +and quite innocuous changes to the source modules can spawn {\em +massive} recompilation. If you keep your wits about you, judicious +use of the \tr{fastmake} script (provided in \tr{utils/scripts}) can +help a lot. + +Typing \tr{fastmake -help} gets you the documentation for the script; +it also describes the only two uses that I would recommended: +(1)~Recompiling when interfaces are known to be stable [very common], and +(2)~Compiling a module that's just had functions {\em added} then +tweaking the \tr{.hi} file's timestamp so the change ``doesn't show''. + +%************************************************************************ +%* * +\subsection[using-sun4s-and-sun3s]{Using both Sun4s and Sun3s to compile} +%* * +%************************************************************************ + +[This is happily irrelevant in a Sun4-only compiling-with-HBC world. +It is most useful if compiling-for-Sun3s (prototype Glasgow compiler), +but you'd really rather use a Sun4 to do it [to go faster].] + +It is a pain to build the compilation system for Sun3s, +even though most of us have Sun4s. This is really only a +problem for the compiler proper (\tr{compiler/hsc}). Here's what we +do. (We assume you have a copy of the Sun4-to-Sun3 version of the +prototype compiler.) + +The basic idea, after doing \tr{cd compiler}, is to do \tr{(l|fast)make asms} +on a Sun4 (to make all the \tr{.s} assembler files) and then finish +the job on a Sun3 with \tr{make hsc} (or \tr{make all}). + +The problem is that the rest of the distribution has been built for a +Sun3, so when \tr{make} reaches out to run some other part of the +distribution (e.g., \tr{lit-deatify}, run by \tr{lit2pgm}), you'll be +trying to run a Sun3 binary on a Sun4. No go. + +There are two solutions. Both depend on {\em installing} at least the +literate-programming stuff, and perhaps the ``make world'' stuff, too. +(\tr{cd} to those subdirectories, and see if \tr{make install} does +what you want.) + +The first solution is to use the \tr{lmake} script, provided in +\tr{utils/scripts/lmake.sh}, when you are compiling with a Sun4. +This trivial script merely overrides \tr{make}'s default ideas about +where to find some programs. + +The second solution is to reconfigure your whole system to use +``installed utilities,'' a mysterious and murky `feature' of the +make-world system. Cd to the root directory of your source tree and +proceed just as described in the installation document, +with {\em one change}: Instead of the magic line: +\begin{verbatim} +make -f Makefile.BOOT BOOT_DEFINES="-P ghc -S std -DTopDirPwd=/h/me/ghc-0.06" +\end{verbatim} + +use this other even more magic line: + +\begin{verbatim} +mkworld/jmkmf -P ghc -S std -DTopDirPwd=/h/me/ghc-0.06 +\end{verbatim} +Then \tr{make Makefiles}, \tr{make depend}, etc., as before. After +all this, you should be able to \tr{make asms} on either a Sun3 or +Sun4, without problems. + +%************************************************************************ +%* * +\section[sharing-w-link-trees]{Sharing source code using symbolic-link trees} +%* * +%************************************************************************ + +If you want to build the system for several architectures, setups, or +whatever, but not duplicate the sources, you can make a {\em link tree} +of the distribution---that is, a ``clone'' of the distribution +directory structure but with each file represented by a symbolic link +to the real source file. + +If you make changes to the real source file, then you simply have to +re-\tr{make} in the link tree to rebuild for that arch/setup. +Contrariwise, things that happen in the link tree should not affect +the master sources. + +This is what we do at Glasgow, where several people are hacking on +bits of the compiler at any given time. These notes were written +mainly to help us remember what we did last time! + +%************************************************************************ +%* * +\subsection[link-tree-principles]{The objectives of working this way} +%* * +%************************************************************************ + +What we want to have on our disks: +\begin{enumerate} +\item +A single common more-or-less-stable source tree that everyone can +share (assumed to be about a half dozen people). ``Read-only.'' + +\item +A handful of common ``builds'' of the common source for various +machines, which people can share. These ``build trees'', also +``read-only,'' link into the common source tree (above). + +Out of the whole distribution, one person is likely to be interested +in a tiny part of it. There is no reason they should have a full set +of object files (which is probably huge). By linking into a common +build tree, all those objects can be shared. + +\item +Separate link trees for individuals, that they can play with and use +to prepare wadges of ``stable code'' --- to be fed back into the +``common source tree'' periodically. +\end{enumerate} + +What we want to do with them: + +%************************************************************************ +%* * +\subsection[basic-link-trees]{Creating link trees of object files for everyone to share} +%* * +%************************************************************************ + +Let's assume that the basic source tree is in \tr{~grasp/ghc}. + +Now, if everyone simply links to this and \tr{makes} thereafter, each +link tree will end up with a full set of objects, most of which will +be of no interest to the link-tree owner. + +So, we do a basic build for each architecture, and then link {\em into +those object-full trees}! Here goes: +\begin{verbatim} +% mkdir ghc-full-hbc-sun4 # full setup, compile w/ hbc, for sun4 +% cd ghc-full-hbc-sun4 +% lndir ~grasp/ghc # make the links + +% make -f Makefile.BOOT BOOT_DEFINES="-P ghc -S full -DTopDirPwd=/users/fp/grasp/ghc-full-hbc-sun4" +\end{verbatim} + +%************************************************************************ +%* * +\subsection[create-link-tree]{Creating a link-tree version of the compiler} +%* * +%************************************************************************ + +Suppose the source is in \tr{~grasp/ghc}. We want to make a link tree +called \tr{./ghc-sun4}, which will be used to do a build for Sun4s. +Here's how to set up the basic structure: +\begin{verbatim} +% mkdir ghc-fred +% cd ghc-fred +% lndir ~grasp/ghc +\end{verbatim} + +If you wish to be a bit tidier: +\begin{verbatim} +% cd ghc-fred +% zap-junk-links +\end{verbatim} + +Now fiddle the configuration stuff, as described in the installation +document. make your Makefiles and dependencies, ..., also as +described there. It will be something like: +\begin{verbatim} +% make -f Makefile.BOOT BOOT_DEFINES="-P ghc -S fred-setup -DTopDirPwd=/u/h/ghc-fred" +\end{verbatim} + +ToDo: we need to provide emacs-ery to ensure copying works right. + +We often build not-quite-full link trees: usually just a link tree of +the \tr{compiler/} directory. See the example not too far below +about building a new setup. + +%************************************************************************ +%* * +\subsection[chopping-down-link-trees]{Finding the good stuff in a link tree} +%* * +%************************************************************************ + +(NOT TESTED RECENTLY.) + +Suppose, as in the previous section, you had a link tree +\tr{./ghc-sun4}, linked to \tr{~grasp/ghc}. Suppose that, for some +reason, you have made changes in the \tr{./ghc-sun4} tree, and you +want to find those changes, so that they might be applied to the +(presumably) master source in \tr{~grasp/ghc}. +\begin{verbatim} +make veryclean +# remove the links +find . -type l -print | xargs rm +# remove the generated Makefiles +find . -name Makefile -print | xargs rm +# rm the generated .prl files and lit2stuff in ./literate ??? +# take the diffs +diff -rc2 ~grasp/ghc . +# Remove the fluff from the diffs, mangle, etc., etc. +# Watch particularly for files that exist _only_ in ghc-sun4! +# ... +# now apply them if you wish +cd ~grasp/ghc +patch -p0 < <the-diffs-file> +\end{verbatim} + +%************************************************************************ +%* * +\subsection[new-setup]{Building a new setup (configuration) of the system} +%* * +%************************************************************************ + +NOT DONE YET. (Not expected to be hard.) + +This is what I did when I created a special setup for trying to +bootstrap the compiler (compile it with itself). + +First, I created a directory for it: +\begin{verbatim} +% mkdir ~grasp/ghc-boot +\end{verbatim} + +I then made symbolic links to the master copy of all parts of the +compilation, except the compiler itself. There, I made a whole +symlink-tree. +\begin{verbatim} +% cd ~grasp/ghc-boot +% ln -s ~grasp/ghc/* . +% rm compiler # put in a real directory for this one piece +% mkdir compiler + +% cd compiler +% lndir ~grasp/ghc/compiler # make the link tree -- takes time! + +% mkdir tests # lndir doesn't mess w/ "tests" subdirs +% touch tests/Jmakefile +\end{verbatim} + +This is going to be a setup called \tr{boot} (still for the project +\tr{ghc}). The ``make world'' system requires that the following +files exist (they can be empty): +\begin{verbatim} +ghc% ll mkworld/*boot* +-rw-rw-r-- 1 partain grasp 0 Aug 6 20:36 mkworld/AllProjects-ghc-boot.otmpl +-rw-rw-r-- 1 partain grasp 0 Aug 6 20:35 mkworld/Jmake-ghc-boot.orules +-rw-rw-r-- 1 partain grasp 0 Aug 6 20:36 mkworld/Project-ghc-boot.otmpl +-rw-rw-r-- 1 partain grasp 133 Aug 6 20:50 mkworld/site-ghc-boot.odef +\end{verbatim} + +Now, we need to tell the ``make world'' system about this special setup and +to tell it about the new ``top of the world'' (\tr{~grasp/ghc-boot}), I do: +\begin{verbatim} +% cd ghc-boot/compiler +% rm Makefile +% ../mkworld/jmake -P ghc -S boot -I../mkworld -DTopDirPwd=/users/fp/grasp/ghc-boot -DTopDir=../. -DCurDir=./compiler +../mkworld/site-ghc.odef: 9: TopDirPwd redefined +\end{verbatim} +(It's brute force, but it works! The crucial bits are: \tr{-S boot}, +and \tr{-DTopDirPwd=/users/fp/grasp/ghc-boot}.) + +Test that your \tr{Makefile} stuff is OK by... +\begin{verbatim} +% make Makefile +% make Makefiles +% make clean # tidy up some of the junk: + # won't work until the Makefiles are properly made +\end{verbatim} + +I had to fiddle some of the ``make world'' flags mentioned above even +after I'd made my Makefiles. No problem---after the fiddles, just do: +\begin{verbatim} +% make Makefile +% make Makefiles +% make depend +\end{verbatim} +(All three should have been successfully at some point before getting +down to business.) + +In my case, getting down to business was something like... +\begin{verbatim} +% fastmake -k hcs +\end{verbatim} + +\begin{onlystandalone} +\printindex +\end{document} +\end{onlystandalone} diff --git a/web/glasgow/lit2x-0.16/mkworld/docs/mkworld_ref/Jmakefile b/web/glasgow/lit2x-0.16/mkworld/docs/mkworld_ref/Jmakefile new file mode 100644 index 0000000000..b04c8d2a70 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/docs/mkworld_ref/Jmakefile @@ -0,0 +1,6 @@ +LitStuffNeededHere(docs depend) +InfoStuffNeededHere(docs) + +GENLIT_OPTS = -I$(JMAKESRC) + +LitDocRootTarget(mkw_ref,lit) diff --git a/web/glasgow/lit2x-0.16/mkworld/docs/mkworld_ref/mkw_ref.lit b/web/glasgow/lit2x-0.16/mkworld/docs/mkworld_ref/mkw_ref.lit new file mode 100644 index 0000000000..5136c69543 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/docs/mkworld_ref/mkw_ref.lit @@ -0,0 +1,72 @@ +\begin{onlystandalone} +\documentstyle[11pt,literate,a4wide]{article} +\begin{document} +\title{``Make world'' configuration files} +\author{Will Partain} +\date{September 1992} +\maketitle +\begin{rawlatex} +\tableofcontents +\end{rawlatex} +\end{onlystandalone} + +\begin{onlypartofdoc} +\section[mkworld-files]{``Make world'' configuration files} +\downsection +\end{onlypartofdoc} + +% some intro needs to go here (ToDo) + +%---------------------------------------------------------------- +% template that shows the structure +\input{TEMPLATE.ljm} + +%---------------------------------------------------------------- +\section[mkworld-general]{General mkworld files} +\downsection + +\section[mkworld-gen-platform]{General platform-ish mkworld files} +\downsection +\input{plat-TRIGGERS.ljm} +\input{plat-DEF.ljm} +\upsection + +\section[mkworld-gen-site]{General site-ish mkworld files} +\downsection +\section[site.jm]{@site.jm@ is included HERE...} + +This is a file, prepared by hand, that records (a few) facts about the +local computing environment, e.g., where @perl@ lives, whether you +have the GNU C compiler, etc. + +\input{site-DEF.ljm} +\upsection + +\input{suffixes-GEN.ljm} +\input{macros-GEN.ljm} +\input{utils-GEN.ljm} +\upsection + +%---------------------------------------------------------------- +\section[mkworld-project-files]{Project-specific mkworld files} + +The @*.jm@ files specific to a project, or to a setup of a project, +can be used either to define brand-new stuff, or to override bits of +the general stuff in this document. + +You can get a ``literate source'' document for the @*.ljm@ files that +come with the @ghc@ and/or @nofib@ projects. Check in those projects' +individual \tr{mkworld/} directories. + +%\downsection +%\input{ghc/root.lit} +%\input{nofib/root.lit} +%\upsection + +\begin{onlypartofdoc} +\upsection +\end{onlypartofdoc} +\begin{onlystandalone} +\printindex +\end{document} +\end{onlystandalone} diff --git a/web/glasgow/lit2x-0.16/mkworld/install-GEN.jm b/web/glasgow/lit2x-0.16/mkworld/install-GEN.jm new file mode 100644 index 0000000000..64adf3044c --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/install-GEN.jm @@ -0,0 +1,139 @@ +# line 1 "install-GEN.ljm" +# line 8 "install-GEN.ljm" +/*# Where and how to install things (generally) */ +/*# [An individual project is likely to have its own ideas] */ +/*# WHERE: */ + +#ifndef InstRootDir +#define InstRootDir /usr/local +#endif +/* platform-specific binaries */ +#ifndef InstBinDir +#define InstBinDir $(INSTROOT)/bin/$(HOSTPLATFORM) +#endif +/* scripts are platform-independent executables */ +#ifndef InstScriptDir +#define InstScriptDir $(INSTROOT)/bin +#endif +/* "Lib" is where platform-specific stuff goes; + * "Data" is where platform-independent stuff goes. + * [arbitrary] + */ +#ifndef InstLibDir +#define InstLibDir $(INSTROOT)/lib/$(HOSTPLATFORM) +#endif +#ifndef InstDataDir +#define InstDataDir $(INSTROOT)/lib +#endif +INSTROOT = InstRootDir +INSTBINDIR = InstBinDir +INSTSCRIPTDIR = InstScriptDir +INSTLIBDIR = InstLibDir +INSTDATADIR = InstDataDir + +/* top of manual page tree to install in */ +/* NB: not necessarily the same place as to look for man pages (?) */ +#ifndef InstManRoot +#define InstManRoot ManDirectoryRoot +#endif +/* prefix for man page _sources_ (vs .../cat) */ +#ifndef InstManSrcRoot +#define InstManSrcRoot $(INSTMANROOT)/man +#endif +/* man pages for commands */ +#ifndef InstComManDir /* man pages for commands */ +#define InstComManDir CAT2($(INSTMANSRCROOT),$(COMMANSUFFIX)) +#endif +/* man pages for library routines */ +#ifndef InstLibManDir +#define InstLibManDir CAT2($(INSTMANSRCROOT),$(LIBMANSUFFIX)) +#endif +/* man pages for system commands */ +#ifndef InstSysManDir +#define InstSysManDir CAT2($(INSTMANSRCROOT),$(SYSMANSUFFIX)) +#endif + +/* suffix for installing commands'/etcs' man pages */ +#ifndef ComManSuffix +#define ComManSuffix l /* use just one tab or cpp will die */ +#endif +#ifndef LibManSuffix +#define LibManSuffix 3 /* use just one tab or cpp will die */ +#endif +#ifndef SysManSuffix +#define SysManSuffix 8 /* use just one tab or cpp will die */ +#endif +INSTMANROOT = InstManRoot +INSTMANSRCROOT = InstManSrcRoot +INSTCOMMANDIR = InstComManDir +INSTLIBMANDIR = InstLibManDir +INSTSYSMANDIR = InstSysManDir +COMMANSUFFIX = ComManSuffix +LIBMANSUFFIX = LibManSuffix +SYSMANSUFFIX = SysManSuffix + +#ifndef InstInfoDir +#define InstInfoDir $(INSTROOT)/info +#endif +INSTINFODIR = InstInfoDir + +/*# HOW: */ +/* this stuff about "who" does the installing doesn't have make vars + * as it is not intended to be runtime-changeable. + */ +#ifndef InstOwner +#ifdef Owner +#define InstOwner -o Owner +#else +#define InstOwner /* as nothing */ +#endif +#endif +#ifndef InstGroup +#ifdef Group +#define InstGroup -g Group +#else +#define InstGroup /* as nothing */ +#endif +#endif + +#ifndef InstFileFlags +#define InstFileFlags /* as nothing */ +#endif +#ifndef InstStrip +#define InstStrip /* as nothing */ +#endif +#ifndef InstBinFlags +#define InstBinFlags -m 0755 InstOwner InstGroup InstFileFlags InstStrip +#endif +/* + No strip flags on rest of these -- avoids message from install + about stripping non-binaries. +*/ +#ifndef InstScriptFlags +#define InstScriptFlags -m 0755 InstOwner InstGroup InstFileFlags +#endif +#ifndef InstLibFlags +#define InstLibFlags -m 0644 InstOwner InstGroup InstFileFlags +#endif +#ifndef InstDataLibFlags +#define InstDataLibFlags -m 0644 InstOwner InstGroup InstFileFlags +#endif +#ifndef InstIncFlags +#define InstIncFlags -m 0644 InstOwner InstGroup InstFileFlags +#endif +#ifndef InstDataFlags +#define InstDataFlags -m 0644 InstOwner InstGroup InstFileFlags +#endif +#ifndef InstManFlags +#define InstManFlags -m 0644 InstOwner InstGroup InstFileFlags +#endif +#ifndef InstRanlibFlags +#define InstRanlibFlags /*none*/ +#endif +INSTBINFLAGS = InstBinFlags +INSTSCRIPTFLAGS = InstScriptFlags +INSTLIBFLAGS = InstLibFlags +INSTINCFLAGS = InstIncFlags /* flags for include files */ +INSTDATAFLAGS = InstDataFlags +INSTMANFLAGS = InstManFlags +INSTRANLIBFLAGS = InstRanlibFlags diff --git a/web/glasgow/lit2x-0.16/mkworld/install-GEN.ljm b/web/glasgow/lit2x-0.16/mkworld/install-GEN.ljm new file mode 100644 index 0000000000..615223d66a --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/install-GEN.ljm @@ -0,0 +1,145 @@ +%************************************************************************ +%* * +\section[mkworld-install-GEN]{General stuff about installing things} +%* * +%************************************************************************ + +\begin{code} +/*# Where and how to install things (generally) */ +/*# [An individual project is likely to have its own ideas] */ +/*# WHERE: */ + +#ifndef InstRootDir +#define InstRootDir /usr/local +#endif +/* platform-specific binaries */ +#ifndef InstBinDir +#define InstBinDir $(INSTROOT)/bin/$(HOSTPLATFORM) +#endif +/* scripts are platform-independent executables */ +#ifndef InstScriptDir +#define InstScriptDir $(INSTROOT)/bin +#endif +/* "Lib" is where platform-specific stuff goes; + * "Data" is where platform-independent stuff goes. + * [arbitrary] + */ +#ifndef InstLibDir +#define InstLibDir $(INSTROOT)/lib/$(HOSTPLATFORM) +#endif +#ifndef InstDataDir +#define InstDataDir $(INSTROOT)/lib +#endif +INSTROOT = InstRootDir +INSTBINDIR = InstBinDir +INSTSCRIPTDIR = InstScriptDir +INSTLIBDIR = InstLibDir +INSTDATADIR = InstDataDir + +/* top of manual page tree to install in */ +/* NB: not necessarily the same place as to look for man pages (?) */ +#ifndef InstManRoot +#define InstManRoot ManDirectoryRoot +#endif +/* prefix for man page _sources_ (vs .../cat) */ +#ifndef InstManSrcRoot +#define InstManSrcRoot $(INSTMANROOT)/man +#endif +/* man pages for commands */ +#ifndef InstComManDir /* man pages for commands */ +#define InstComManDir CAT2($(INSTMANSRCROOT),$(COMMANSUFFIX)) +#endif +/* man pages for library routines */ +#ifndef InstLibManDir +#define InstLibManDir CAT2($(INSTMANSRCROOT),$(LIBMANSUFFIX)) +#endif +/* man pages for system commands */ +#ifndef InstSysManDir +#define InstSysManDir CAT2($(INSTMANSRCROOT),$(SYSMANSUFFIX)) +#endif + +/* suffix for installing commands'/etcs' man pages */ +#ifndef ComManSuffix +#define ComManSuffix l /* use just one tab or cpp will die */ +#endif +#ifndef LibManSuffix +#define LibManSuffix 3 /* use just one tab or cpp will die */ +#endif +#ifndef SysManSuffix +#define SysManSuffix 8 /* use just one tab or cpp will die */ +#endif +INSTMANROOT = InstManRoot +INSTMANSRCROOT = InstManSrcRoot +INSTCOMMANDIR = InstComManDir +INSTLIBMANDIR = InstLibManDir +INSTSYSMANDIR = InstSysManDir +COMMANSUFFIX = ComManSuffix +LIBMANSUFFIX = LibManSuffix +SYSMANSUFFIX = SysManSuffix + +#ifndef InstInfoDir +#define InstInfoDir $(INSTROOT)/info +#endif +INSTINFODIR = InstInfoDir + +/*# HOW: */ +/* this stuff about "who" does the installing doesn't have make vars + * as it is not intended to be runtime-changeable. + */ +#ifndef InstOwner +#ifdef Owner +#define InstOwner -o Owner +#else +#define InstOwner /* as nothing */ +#endif +#endif +#ifndef InstGroup +#ifdef Group +#define InstGroup -g Group +#else +#define InstGroup /* as nothing */ +#endif +#endif + +#ifndef InstFileFlags +#define InstFileFlags /* as nothing */ +#endif +#ifndef InstStrip +#define InstStrip /* as nothing */ +#endif +#ifndef InstBinFlags +#define InstBinFlags -m 0755 InstOwner InstGroup InstFileFlags InstStrip +#endif +/* + No strip flags on rest of these -- avoids message from install + about stripping non-binaries. +*/ +#ifndef InstScriptFlags +#define InstScriptFlags -m 0755 InstOwner InstGroup InstFileFlags +#endif +#ifndef InstLibFlags +#define InstLibFlags -m 0644 InstOwner InstGroup InstFileFlags +#endif +#ifndef InstDataLibFlags +#define InstDataLibFlags -m 0644 InstOwner InstGroup InstFileFlags +#endif +#ifndef InstIncFlags +#define InstIncFlags -m 0644 InstOwner InstGroup InstFileFlags +#endif +#ifndef InstDataFlags +#define InstDataFlags -m 0644 InstOwner InstGroup InstFileFlags +#endif +#ifndef InstManFlags +#define InstManFlags -m 0644 InstOwner InstGroup InstFileFlags +#endif +#ifndef InstRanlibFlags +#define InstRanlibFlags /*none*/ +#endif +INSTBINFLAGS = InstBinFlags +INSTSCRIPTFLAGS = InstScriptFlags +INSTLIBFLAGS = InstLibFlags +INSTINCFLAGS = InstIncFlags /* flags for include files */ +INSTDATAFLAGS = InstDataFlags +INSTMANFLAGS = InstManFlags +INSTRANLIBFLAGS = InstRanlibFlags +\end{code} diff --git a/web/glasgow/lit2x-0.16/mkworld/jmake.c b/web/glasgow/lit2x-0.16/mkworld/jmake.c new file mode 100644 index 0000000000..4fcb5557bc --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/jmake.c @@ -0,0 +1,922 @@ +/*****************************************************************************\ + BASED ON: + $XConsortium: imake.c,v 1.65 91/07/25 17:50:17 rws Exp $ + * * + * Porting Note * + * * + * Add the value of BOOTSTRAPCFLAGS to the cpp_argv table (in jmakemdep.h) * + * so that it will be passed to the template file. * + * * +\*****************************************************************************/ + +/* + * + * Copyright 1985, 1986, 1987 by the Massachusetts Institute of Technology + * + * Permission to use, copy, modify, and distribute this + * software and its documentation for any purpose and without + * fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in + * advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * Original Author: + * Todd Brunhoff + * Tektronix, inc. + * While a guest engineer at Project Athena, MIT + * + * jmake: the include-make program. + * + * Usage: jmake [-Idir] [-Ddefine] [-T] [-f jmakefile ] [-s] [-e] [-v] [make flags] + * + * Jmake takes a template makefile (TEMPLATE.jm) and runs cpp on it + * producing a temporary makefile in /tmp. It then runs make on + * this pre-processed makefile. + * Options: + * -D define. Same as cpp -D argument. + * -I Include directory. Same as cpp -I argument. + * -T template. Designate a template other + * than TEMPLATE.jm + * -s[F] show. Show the produced makefile on the standard + * output. Make is not run is this case. If a file + * argument is provided, the output is placed there. + * -e[F] execute instead of show; optionally name Makefile F + * -v verbose. Show the make command line executed. + * + * Environment variables: + * + * JMAKEINCLUDE Include directory to use in addition to "." + * JMAKECPP Cpp to use instead of /lib/cpp + * JMAKEMAKE make program to use other than what is + * found by searching the $PATH variable. + * Other features: + * jmake reads the entire cpp output into memory and then scans it + * for occurences of "@@". If it encounters them, it replaces it with + * a newline. It also trims any trailing white space on output lines + * (because make gets upset at them). This helps when cpp expands + * multi-line macros but you want them to appear on multiple lines. + * + * The macros MAKEFILE and MAKE are provided as macros + * to make. MAKEFILE is set to jmake's makefile (not the constructed, + * preprocessed one) and MAKE is set to argv[0], i.e. the name of + * the jmake program. + * + * Theory of operation: + * 1. Determine the name of the jmakefile from the command line (-f) + * or from the content of the current directory (Jmakefile or jmakefile). + * Call this <jmakefile>. This gets added to the arguments for + * make as MAKEFILE=<jmakefile>. + * 2. Determine the name of the template from the command line (-T) + * or the default, TEMPLATE.jm. Call this <template> + * 3. Start up cpp an provide it with three lines of input: + * #define JMAKE_TEMPLATE " <template> " + * #define INCLUDE_JMAKEFILE < <jmakefile> > + * #include JMAKE_TEMPLATE + * Note that the define for INCLUDE_JMAKEFILE is intended for + * use in the template file. This implies that the jmake is + * useless unless the template file contains at least the line + * #include INCLUDE_JMAKEFILE + * 4. Gather the output from cpp, and clean it up, expanding @@ to + * newlines, stripping trailing white space, cpp control lines, + * and extra blank lines. This cleaned output is placed in a + * temporary file. Call this <makefile>. + * 5. Start up make specifying <makefile> as its input. + * + * The design of the template makefile should therefore be: + * <set global macros like CFLAGS, etc.> + * <include machine dependent additions> + * #include INCLUDE_JMAKEFILE + * <add any global targets like 'clean' and long dependencies> + */ +#include <stdio.h> +#if (defined(SVR4) || defined(_IBMR2) || defined(SYSV386)) && __STDC__ +FILE * fdopen(); +#endif +#include <ctype.h> +/*partain: #include "Xosdefs.h"*/ +#ifndef X_NOT_POSIX +#ifndef _POSIX_SOURCE +#define _POSIX_SOURCE +#endif +#endif +#include <sys/types.h> +#include <fcntl.h> +#ifdef X_NOT_POSIX +#include <sys/file.h> +#else +#include <unistd.h> +#endif +#if defined(X_NOT_POSIX) || defined(_POSIX_SOURCE) +#include <signal.h> +#else +#define _POSIX_SOURCE +#include <signal.h> +#undef _POSIX_SOURCE +#endif +#include <sys/stat.h> +#ifndef X_NOT_POSIX +#ifdef _POSIX_SOURCE +#include <sys/wait.h> +#else +#define _POSIX_SOURCE +#include <sys/wait.h> +#undef _POSIX_SOURCE +#endif +#define waitCode(w) WEXITSTATUS(w) +#define waitSig(w) WTERMSIG(w) +typedef int waitType; +#else /* X_NOT_POSIX */ +#ifdef SYSV +#define waitCode(w) (((w) >> 8) & 0x7f) +#define waitSig(w) ((w) & 0xff) +typedef int waitType; +#else /* SYSV */ +#include <sys/wait.h> +#define waitCode(w) ((w).w_T.w_Retcode) +#define waitSig(w) ((w).w_T.w_Termsig) +typedef union wait waitType; +#endif +#ifndef WIFSIGNALED +#define WIFSIGNALED(w) waitSig(w) +#endif +#ifndef WIFEXITED +#define WIFEXITED(w) waitCode(w) +#endif +#endif /* X_NOT_POSIX */ +#ifndef X_NOT_STDC_ENV +#include <stdlib.h> +#else +char *malloc(), *realloc(); +void exit(); +#endif +#if defined(macII) && !defined(__STDC__) /* stdlib.h fails to define these */ +char *malloc(), *realloc(); +#endif /* macII */ +#ifdef X_NOT_STDC_ENV +extern char *getenv(); +#endif +#include <errno.h> +extern int errno; +#include "jmakemdep.h" + + +#define TRUE 1 +#define FALSE 0 + +#ifdef FIXUP_CPP_WHITESPACE +int InRule = FALSE; +#endif + +/* + * Some versions of cpp reduce all tabs in macro expansion to a single + * space. In addition, the escaped newline may be replaced with a + * space instead of being deleted. Blech. + */ +#ifndef FIXUP_CPP_WHITESPACE +#define KludgeOutputLine(arg) +#define KludgeResetRule() +#endif + +typedef unsigned char boolean; + +#ifndef DEFAULT_CPP +#ifdef USE_CC_E +#define DEFAULT_CPP "/bin/cc" +#else +#ifdef CPP_PROGRAM +#define DEFAULT_CPP CPP_PROGRAM +#else +#define DEFAULT_CPP "/lib/cpp" +#endif +#endif +#endif + +char *cpp = DEFAULT_CPP; + +char *tmpMakefile = "/tmp/Imf.XXXXXX"; +char *tmpJmakefile = "/tmp/IIf.XXXXXX"; +char *make_argv[ ARGUMENTS ] = { "make" }; + +int make_argindex; +int cpp_argindex; +char *make = NULL; +char *Jmakefile = NULL; +char *Makefile = "Makefile"; +char *Template = "TEMPLATE.jm"; +/* partain: SetupLabel and ProjectLabel are my additions */ +char *SetupLabel = "std"; +char *ProjectLabel = "none"; +char *ProjectMkworldDir = ""; +/* partain: net patch from dubois; orig: +char *program; +*/ +char *program = "jmake"; +char *FindJmakefile(); +char *ReadLine(); +char *CleanCppInput(); +char *Strdup(); +char *Emalloc(); + +boolean verbose = FALSE; +boolean show = TRUE; + +main(argc, argv) + int argc; + char **argv; +{ + FILE *tmpfd; + char makeMacro[ BUFSIZ ]; + char makefileMacro[ BUFSIZ ]; + + program = argv[0]; + init(); + SetOpts(argc, argv); +#ifdef USE_CC_E + AddCppArg("-"); +#endif + + Jmakefile = FindJmakefile(Jmakefile); + if (Makefile) + tmpMakefile = Makefile; + else { + tmpMakefile = Strdup(tmpMakefile); + (void) mktemp(tmpMakefile); + } + AddMakeArg("-f"); + AddMakeArg( tmpMakefile ); + sprintf(makeMacro, "MAKE=%s", program); + AddMakeArg( makeMacro ); + sprintf(makefileMacro, "MAKEFILE=%s", Jmakefile); + AddMakeArg( makefileMacro ); + + if ((tmpfd = fopen(tmpMakefile, "w+")) == NULL) + LogFatal("Cannot create temporary file %s.", tmpMakefile); + + cppit(Jmakefile, Template, tmpfd, tmpMakefile); + + if (show) { + if (Makefile == NULL) + showit(tmpfd); + } else + makeit(); + wrapup(); + exit(0); +} + +showit(fd) + FILE *fd; +{ + char buf[ BUFSIZ ]; + int red; + + fseek(fd, 0, 0); + while ((red = fread(buf, 1, BUFSIZ, fd)) > 0) + fwrite(buf, red, 1, stdout); + if (red < 0) + LogFatal("Cannot write stdout.", ""); +} + +wrapup() +{ + if (tmpMakefile != Makefile) + unlink(tmpMakefile); + unlink(tmpJmakefile); +} + +#ifdef SIGNALRETURNSINT +int +#else +void +#endif +catch(sig) + int sig; +{ + errno = 0; + LogFatalI("Signal %d.", sig); +} + +/* + * Initialize some variables. + */ +init() +{ + char *p; + + make_argindex=0; + while (make_argv[ make_argindex ] != NULL) + make_argindex++; + cpp_argindex = 0; + while (cpp_argv[ cpp_argindex ] != NULL) + cpp_argindex++; + + /* + * See if the standard include directory is different than + * the default. Or if cpp is not the default. Or if the make + * found by the PATH variable is not the default. + */ + if (p = getenv("JMAKEINCLUDE")) { + if (*p != '-' || *(p+1) != 'I') + LogFatal("Environment var JMAKEINCLUDE %s\n", + "must begin with -I"); + AddCppArg(p); + for (; *p; p++) + if (*p == ' ') { + *p++ = '\0'; + AddCppArg(p); + } + } + if (p = getenv("JMAKECPP")) + cpp = p; + if (p = getenv("JMAKEMAKE")) + make = p; + + if (signal(SIGINT, SIG_IGN) != SIG_IGN) + signal(SIGINT, catch); +} + +AddMakeArg(arg) + char *arg; +{ + errno = 0; + if (make_argindex >= ARGUMENTS-1) + LogFatal("Out of internal storage.", ""); + make_argv[ make_argindex++ ] = arg; + make_argv[ make_argindex ] = NULL; +} + +AddCppArg(arg) + char *arg; +{ + errno = 0; + if (cpp_argindex >= ARGUMENTS-1) + LogFatal("Out of internal storage.", ""); + cpp_argv[ cpp_argindex++ ] = arg; + cpp_argv[ cpp_argindex ] = NULL; +} + +SetOpts(argc, argv) + int argc; + char **argv; +{ + errno = 0; + /* + * Now gather the arguments for make + */ + for(argc--, argv++; argc; argc--, argv++) { + /* + * We intercept these flags. + */ + if (argv[0][0] == '-') { + if (argv[0][1] == 'D') { + AddCppArg(argv[0]); + } else if (argv[0][1] == 'I') { + AddCppArg(argv[0]); + } else if (argv[0][1] == 'f') { + if (argv[0][2]) + Jmakefile = argv[0]+2; + else { + argc--, argv++; + if (! argc) + LogFatal("No description arg after -f flag\n", ""); + Jmakefile = argv[0]; + } + } else if (argv[0][1] == 's') { + if (argv[0][2]) + Makefile = ((argv[0][2] == '-') && !argv[0][3]) ? + NULL : argv[0]+2; + else { + argc--, argv++; + if (!argc) + LogFatal("No description arg after -s flag\n", ""); + Makefile = ((argv[0][0] == '-') && !argv[0][1]) ? + NULL : argv[0]; + } + show = TRUE; + } else if (argv[0][1] == 'e') { + Makefile = (argv[0][2] ? argv[0]+2 : NULL); + show = FALSE; + } else if (argv[0][1] == 'T') { + if (argv[0][2]) + Template = argv[0]+2; + else { + argc--, argv++; + if (! argc) + LogFatal("No description arg after -T flag\n", ""); + Template = argv[0]; + } +/* partain added -P <project>, -S <setup>, and -C <dir> (project mkworld dir) options */ + } else if (argv[0][1] == 'P') { + if (argv[0][2]) + ProjectLabel = argv[0]+2; + else { + argc--, argv++; + if (! argc) + LogFatal("No description arg after -P flag\n", ""); + ProjectLabel = argv[0]; + } + } else if (argv[0][1] == 'S') { + if (argv[0][2]) + SetupLabel = argv[0]+2; + else { + argc--, argv++; + if (! argc) + LogFatal("No description arg after -S flag\n", ""); + SetupLabel = argv[0]; + } + } else if (argv[0][1] == 'C') { + if (argv[0][2]) + ProjectMkworldDir = argv[0]+2; + else { + argc--, argv++; + if (! argc) + LogFatal("No description arg after -C flag\n", ""); + ProjectMkworldDir = argv[0]; + } + { char *temp = Emalloc(4096); /* hack */ + strcat(temp, "-I"); + strcat(temp, ProjectMkworldDir); + AddCppArg(temp); + } +/* end of addition */ + } else if (argv[0][1] == 'v') { + verbose = TRUE; + } else + AddMakeArg(argv[0]); + } else + AddMakeArg(argv[0]); + } +} + +char *FindJmakefile(Jmakefile) + char *Jmakefile; +{ + int fd; + + if (Jmakefile) { + if ((fd = open(Jmakefile, O_RDONLY)) < 0) + LogFatal("Cannot open %s.", Jmakefile); + } else { + if ((fd = open("Jmakefile", O_RDONLY)) < 0) + LogFatal("No description file (Jmakefile).", ""); + else + Jmakefile = "Jmakefile"; + } + close (fd); + return(Jmakefile); +} + +LogFatalI(s, i) + char *s; + int i; +{ + /*NOSTRICT*/ + LogFatal(s, (char *)i); +} + +LogFatal(x0,x1) + char *x0, *x1; +{ + extern char *sys_errlist[]; + static boolean entered = FALSE; + + if (entered) + return; + entered = TRUE; + + fprintf(stderr, "%s: ", program); + if (errno) + fprintf(stderr, "%s: ", sys_errlist[ errno ]); + fprintf(stderr, x0,x1); + fprintf(stderr, " Stop.\n"); + wrapup(); + exit(1); +} + +showargs(argv) + char **argv; +{ + for (; *argv; argv++) + fprintf(stderr, "%s ", *argv); + fprintf(stderr, "\n"); +} + +cppit(Jmakefile, template, outfd, outfname) + char *Jmakefile; + char *template; + FILE *outfd; + char *outfname; +{ + FILE *pipeFile; + int pid, pipefd[2]; + waitType status; + char *cleanedJmakefile; + + /* + * Get a pipe. + */ + if (pipe(pipefd) < 0) + LogFatal("Cannot make a pipe.", ""); + + /* + * Fork and exec cpp + */ + pid = fork(); + if (pid < 0) + LogFatal("Cannot fork.", ""); + if (pid) { /* parent */ + close(pipefd[0]); + cleanedJmakefile = CleanCppInput(Jmakefile); + if ((pipeFile = fdopen(pipefd[1], "w")) == NULL) + LogFatalI("Cannot fdopen fd %d for output.", pipefd[1]); + + fprintf(pipeFile, "#define JMAKE_TEMPLATE\t\"%s\"\n", + template); + fprintf(pipeFile, "#define INCLUDE_JMAKEFILE\t<%s>\n", + cleanedJmakefile); + +/* partain added OVERRIDE_FILEs business */ + fprintf(pipeFile, "#define SetupLabel\t%s\n", SetupLabel); + fprintf(pipeFile, "#define SetupIsStd\t%d\n", (! strcmp("std", SetupLabel))); + fprintf(pipeFile, "#define ProjectLabel\t%s\n", ProjectLabel); + fprintf(pipeFile, "#define ProjectIsNone\t%d\n", (! strcmp("none", ProjectLabel))); + if (strcmp("", ProjectMkworldDir) != 0) { + fprintf(pipeFile, "#define HaveProjectMkworldDir\t1\n"); + fprintf(pipeFile, "#define ProjectMkworldDir\t%s\n", ProjectMkworldDir); + } + + fprintf(pipeFile, "#define SITE_SETUP_FILE\t\"site-%s-%s.jm\"\n", + ProjectLabel, SetupLabel); + fprintf(pipeFile, "#define SITE_PROJECT_FILE\t\"site-%s.jm\"\n", + ProjectLabel); + + fprintf(pipeFile, "#define ONLY4_SETUP_FILE\t\"only4-%s-%s.jm\"\n", + ProjectLabel, SetupLabel); + fprintf(pipeFile, "#define ONLY4_PROJECT_FILE\t\"only4-%s.jm\"\n", + ProjectLabel); + + fprintf(pipeFile, "#define SUFFIXES_SETUP_FILE\t\"suffixes-%s-%s.jm\"\n", + ProjectLabel, SetupLabel); + fprintf(pipeFile, "#define SUFFIXES_PROJECT_FILE\t\"suffixes-%s.jm\"\n", + ProjectLabel); + + fprintf(pipeFile, "#define MACROS_SETUP_FILE\t\"macros-%s-%s.jm\"\n", + ProjectLabel, SetupLabel); + fprintf(pipeFile, "#define MACROS_PROJECT_FILE\t\"macros-%s.jm\"\n", + ProjectLabel); + + fprintf(pipeFile, "#define UTILS_SETUP_FILE\t\"utils-%s-%s.jm\"\n", + ProjectLabel, SetupLabel); + fprintf(pipeFile, "#define UTILS_PROJECT_FILE\t\"utils-%s.jm\"\n", + ProjectLabel); + + fprintf(pipeFile, "#define INSTALLATION_SETUP_FILE\t\"install-%s-%s.jm\"\n", + ProjectLabel, SetupLabel); + fprintf(pipeFile, "#define INSTALLATION_PROJECT_FILE\t\"install-%s.jm\"\n", + ProjectLabel); +/* end of addition */ + + fprintf(pipeFile, "#include JMAKE_TEMPLATE\n"); + fclose(pipeFile); + while (wait(&status) > 0) { + errno = 0; + if (WIFSIGNALED(status)) + LogFatalI("Signal %d.", waitSig(status)); + if (WIFEXITED(status) && waitCode(status)) + LogFatalI("Exit code %d.", waitCode(status)); + } +#ifdef linux + freopen(outfname, "r+", outfd); +#endif + CleanCppOutput(outfd, outfname); + } else { /* child... dup and exec cpp */ + if (verbose) + showargs(cpp_argv); + dup2(pipefd[0], 0); + dup2(fileno(outfd), 1); + close(pipefd[1]); + execv(cpp, cpp_argv); + LogFatal("Cannot exec %s.", cpp); + } +} + +makeit() +{ + int pid; + waitType status; + + /* + * Fork and exec make + */ + pid = fork(); + if (pid < 0) + LogFatal("Cannot fork.", ""); + if (pid) { /* parent... simply wait */ + while (wait(&status) > 0) { + errno = 0; + if (WIFSIGNALED(status)) + LogFatalI("Signal %d.", waitSig(status)); + if (WIFEXITED(status) && waitCode(status)) + LogFatalI("Exit code %d.", waitCode(status)); + } + } else { /* child... dup and exec cpp */ + if (verbose) + showargs(make_argv); + if (make) + execv(make, make_argv); + else + execvp("make", make_argv); + LogFatal("Cannot exec %s.", make); + } +} + +char *CleanCppInput(Jmakefile) + char *Jmakefile; +{ + FILE *outFile = NULL; + int infd; + char *buf, /* buffer for file content */ + *pbuf, /* walking pointer to buf */ + *punwritten, /* pointer to unwritten portion of buf */ + *cleanedJmakefile = Jmakefile, /* return value */ + *ptoken, /* pointer to # token */ + *pend, /* pointer to end of # token */ + savec; /* temporary character holder */ + struct stat st; + + /* + * grab the entire file. + */ + if ((infd = open(Jmakefile, O_RDONLY)) < 0) + LogFatal("Cannot open %s for input.", Jmakefile); + fstat(infd, &st); + buf = Emalloc(st.st_size+1); + if (read(infd, buf, st.st_size) != st.st_size) + LogFatal("Cannot read all of %s:", Jmakefile); + close(infd); + buf[ st.st_size ] = '\0'; + + punwritten = pbuf = buf; + while (*pbuf) { + /* pad make comments for cpp */ + if (*pbuf == '#' && (pbuf == buf || pbuf[-1] == '\n')) { + + ptoken = pbuf+1; + while (*ptoken == ' ' || *ptoken == '\t') + ptoken++; + pend = ptoken; + while (*pend && *pend != ' ' && *pend != '\t' && *pend != '\n') + pend++; + savec = *pend; + *pend = '\0'; + if (strcmp(ptoken, "include") + && strcmp(ptoken, "define") + && strcmp(ptoken, "undef") + && strcmp(ptoken, "ifdef") + && strcmp(ptoken, "ifndef") + && strcmp(ptoken, "else") + && strcmp(ptoken, "endif") + && strcmp(ptoken, "if")) { + if (outFile == NULL) { + tmpJmakefile = Strdup(tmpJmakefile); + (void) mktemp(tmpJmakefile); + cleanedJmakefile = tmpJmakefile; + outFile = fopen(tmpJmakefile, "w"); + if (outFile == NULL) + LogFatal("Cannot open %s for write.\n", + tmpJmakefile); + } + fwrite(punwritten, sizeof(char), pbuf-punwritten, outFile); + fputs("/**/", outFile); + punwritten = pbuf; + } + *pend = savec; + } + pbuf++; + } + if (outFile) { + fwrite(punwritten, sizeof(char), pbuf-punwritten, outFile); + fclose(outFile); /* also closes the pipe */ + } + + return(cleanedJmakefile); +} + +CleanCppOutput(tmpfd, tmpfname) + FILE *tmpfd; + char *tmpfname; +{ + char *input; + int blankline = 0; + + while(input = ReadLine(tmpfd, tmpfname)) { + if (isempty(input)) { + if (blankline++) + continue; + KludgeResetRule(); + } else { + blankline = 0; + KludgeOutputLine(&input); + fputs(input, tmpfd); + } + putc('\n', tmpfd); + } + fflush(tmpfd); +#ifdef NFS_STDOUT_BUG + /* + * On some systems, NFS seems to leave a large number of nulls at + * the end of the file. Ralph Swick says that this kludge makes the + * problem go away. + */ + ftruncate (fileno(tmpfd), (off_t)ftell(tmpfd)); +#endif +} + +/* + * Determine of a line has nothing in it. As a side effect, we trim white + * space from the end of the line. Cpp magic cookies are also thrown away. + */ +isempty(line) + char *line; +{ + char *pend; + + /* + * Check for lines of the form + * # n "... + * or + * # line n "... + */ + if (*line == '#') { + pend = line+1; + if (*pend == ' ') + pend++; + if (strncmp(pend, "line ", 5) == 0) + pend += 5; + if (isdigit(*pend)) { + while (isdigit(*pend)) + pend++; + if (*pend++ == ' ' && *pend == '"') + return(TRUE); + } + } + + /* + * Find the end of the line and then walk back. + */ + for (pend=line; *pend; pend++) ; + + pend--; + while (pend >= line && (*pend == ' ' || *pend == '\t')) + pend--; + *++pend = '\0'; + return (*line == '\0'); +} + +/*ARGSUSED*/ +char *ReadLine(tmpfd, tmpfname) + FILE *tmpfd; + char *tmpfname; +{ + static boolean initialized = FALSE; + static char *buf, *pline, *end; + char *p1, *p2; + + if (! initialized) { + int total_red; + struct stat st; + + /* + * Slurp it all up. + */ + fseek(tmpfd, 0, 0); + fstat(fileno(tmpfd), &st); + pline = buf = Emalloc(st.st_size+1); +#ifdef linux + total_red = fread(buf, 1, st.st_size, tmpfd); +#else + total_red = read(fileno(tmpfd), buf, st.st_size); +#endif + if (total_red != st.st_size) + LogFatal("cannot read %s\n", tmpMakefile); + end = buf + st.st_size; + *end = '\0'; +#ifdef linux + fseek(tmpfd, 0, 0); +#else + lseek(fileno(tmpfd), 0, 0); +#endif +#ifdef SYSV + freopen(tmpfname, "w+", tmpfd); +#else /* !SYSV */ + ftruncate(fileno(tmpfd), 0); +#endif /* !SYSV */ + initialized = TRUE; + fprintf (tmpfd, "# Makefile generated by jmake -- DO NOT EDIT!!!\n"); + fprintf (tmpfd, "# (edit the Jmakefile instead)\n"); +/* partain: no thanks + fprintf (tmpfd, "# %s\n", + "$XConsortium: jmake.c,v 1.51 89/12/12 12:37:30 jim Exp $"); +*/ +#ifdef FIXUP_CPP_WHITESPACE + { + static char *cpp_warning[] = { +"#", +"# The cpp used on this machine replaces all newlines and multiple tabs and", +"# spaces in a macro expansion with a single space. Jmake tries to compensate", +"# for this, but is not always successful.", +"#", +NULL }; + char **cpp; + + for (cpp = cpp_warning; *cpp; cpp++) { + fprintf (tmpfd, "%s\n", *cpp); + } + } +#endif /* FIXUP_CPP_WHITESPACE */ + } + + for (p1 = pline; p1 < end; p1++) { + if (*p1 == '@' && *(p1+1) == '@') { /* soft EOL */ + *p1++ = '\0'; + p1++; /* skip over second @ */ + break; + } + else if (*p1 == '\n') { /* real EOL */ + *p1++ = '\0'; + break; + } + } + + /* + * return NULL at the end of the file. + */ + p2 = (pline == p1 ? NULL : pline); + pline = p1; + return(p2); +} + +writetmpfile(fd, buf, cnt) + FILE *fd; + int cnt; + char *buf; +{ + errno = 0; + if (fwrite(buf, cnt, 1, fd) != 1) + LogFatal("Cannot write to %s.", tmpMakefile); +} + +char *Emalloc(size) + int size; +{ + char *p; + + if ((p = malloc(size)) == NULL) + LogFatalI("Cannot allocate %d bytes\n", size); + return(p); +} + +#ifdef FIXUP_CPP_WHITESPACE +KludgeOutputLine(pline) + char **pline; +{ + char *p = *pline; + + switch (*p) { + case '#': /*Comment - ignore*/ + break; + case '\t': /*Already tabbed - ignore it*/ + break; + case ' ': /*May need a tab*/ + default: + for (; *p; p++) if (p[0] == ':' && + p > *pline && p[-1] != '\\') { + if (**pline == ' ') + (*pline)++; + InRule = TRUE; + break; + } + if (InRule && **pline == ' ') + **pline = '\t'; + break; + } +} + +KludgeResetRule() +{ + InRule = FALSE; +} +#endif /* FIXUP_CPP_WHITESPACE */ + +char *Strdup(cp) + register char *cp; +{ + register char *new = Emalloc(strlen(cp) + 1); + + strcpy(new, cp); + return new; +} diff --git a/web/glasgow/lit2x-0.16/mkworld/jmakemdep.h b/web/glasgow/lit2x-0.16/mkworld/jmakemdep.h new file mode 100644 index 0000000000..579ef097cc --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/jmakemdep.h @@ -0,0 +1,379 @@ +/* + * Based on: + * $XConsortium: imakemdep.h,v 1.38 91/08/25 11:36:39 rws Exp $ + * + * This file contains machine-dependent constants for the jmake utility. When + * porting jmake, read each of the steps below and add in any necessary + * definitions. Do *not* edit ccjmake.c or jmake.c! + */ + +#ifdef CCJMAKE +/* + * Step 1: jmake_ccflags + * Define any special flags that will be needed to get jmake.c to compile. + * These will be passed to the compile along with the contents of the + * make variable BOOTSTRAPCFLAGS. + */ +#ifdef hpux +#ifdef hp9000s800 +#define jmake_ccflags "-DSYSV" +#else +#define jmake_ccflags "-Wc,-Nd4000,-Ns3000 -DSYSV" +#endif +#endif + +#if defined(macII) || defined(_AUX_SOURCE) +#define jmake_ccflags "-DmacII -DSYSV" +#endif + +#ifdef stellar +#define jmake_ccflags "-DSYSV" +#endif + +#ifdef att +#define jmake_ccflags "-Xc -DSVR4" +#endif + +#ifdef sony +#ifdef SYSTYPE_SYSV +#define jmake_ccflags "-DSVR4" +#else +#include <sys/param.h> +#if NEWSOS < 41 +#define jmake_ccflags "-Dbsd43 -DNOSTDHDRS" +#else +#define jmake_ccflags "-Dbsd43" +#endif +#endif +#endif + +#ifdef CRAY +/* -DX_NOT_STDC_ENV is just so we can bootstrap with cc instead of scc */ +#define jmake_ccflags "-DSYSV -DUSG -DX_NOT_STDC_ENV" +#endif + +#ifdef _IBMR2 +#define jmake_ccflags "-Daix -DSYSV -D_IBMR2" +#else +#ifdef aix +#define jmake_ccflags "-Daix -DSYSV" +#endif +#endif + +#ifdef Mips +# if defined(SYSTYPE_BSD) || defined(BSD) || defined(BSD43) +# define jmake_ccflags "-DMips -DBSD43" +# else +# define jmake_ccflags "-DMips -DSYSV" +# endif +#endif + +/* OLD: +#ifdef mips +#ifdef SYSTYPE_SYSV +#define jmake_ccflags "-DSYSV -I/usr/include/bsd -lbsd" +#endif +#endif +*/ + +#ifdef is68k +#define jmake_ccflags "-Dluna -Duniosb" +#endif + +#ifdef SYSV386 +# ifdef SVR4 +# define jmake_ccflags "-Xc -DSVR4" +# else +# define jmake_ccflags "-DSYSV" +# endif +#endif + +#ifdef __convex__ +#define jmake_ccflags "-fn -tm c1" +#endif + +#ifdef apollo +#define jmake_ccflags "-DX_NOT_POSIX" +#endif + +#else /* not CCJMAKE */ +#ifndef MAKEDEPEND +/* + * Step 2: dup2 + * If your OS doesn't have a dup2() system call to duplicate one file + * descriptor onto another, define such a mechanism here (if you don't + * already fall under the existing category(ies). + */ +#if defined(SYSV) && !defined(CRAY) && !defined(Mips) +#define dup2(fd1,fd2) ((fd1 == fd2) ? fd1 : (close(fd2), \ + fcntl(fd1, F_DUPFD, fd2))) +#endif + + +/* + * Step 3: FIXUP_CPP_WHITESPACE + * If your cpp collapses tabs macro expansions into a single space and + * replaces escaped newlines with a space, define this symbol. This will + * cause jmake to attempt to patch up the generated Makefile by looking + * for lines that have colons in them (this is why the rules file escapes + * all colons). One way to tell if you need this is to see whether or not + * your Makefiles have no tabs in them and lots of @@ strings. + */ +#if defined(sun) \ + || defined(linux) \ + || defined(__alpha) +#define FIXUP_CPP_WHITESPACE +#endif + + +/* + * Step 4: DEFAULT_CPP + * If the C preprocessor does not live in /lib/cpp, set this symbol to + * the appropriate location. + */ +#ifdef apollo +#define DEFAULT_CPP "/usr/lib/cpp" +#endif +#if defined(_IBMR2) && !defined(DEFAULT_CPP) +#define DEFAULT_CPP "/usr/lpp/X11/Xamples/util/cpp/cpp" +#endif + +/* + * Step 5: cpp_argv + * The following table contains the cpp flags that should be passed to + * cpp whenever a Makefile is being generated. If your preprocessor + * doesn't predefine any unique symbols, choose one and add it to the + * end of this table. Then, do the following: + * + * a. Use this symbol at the top of Jmake.tmpl when setting MacroFile. + * b. Put this symbol in the definition of BootstrapCFlags in your + * <platform>.cf file. + * c. When doing a make World, always add "BOOTSTRAPCFLAGS=-Dsymbol" + * to the end of the command line. + * + * Note that you may define more than one symbols (useful for platforms + * that support multiple operating systems). + */ + +#define ARGUMENTS 50 /* number of arguments in various arrays */ +char *cpp_argv[ARGUMENTS] = { +#ifdef USE_CC_E + "cc", /* replaced by the actual cpp program to exec */ + "-E", +#else + "cpp", /* replaced by the actual cpp program to exec */ +#endif /* USE_CC_E */ + "-I.", /* add current directory to include path */ +#ifdef unix + "-Uunix", /* remove unix symbol so that filename unix.c okay */ +#endif +#ifdef M4330 + "-DM4330", /* Tektronix */ +#endif +#ifdef M4310 + "-DM4310", /* Tektronix */ +#endif +#if defined(macII) || defined(_AUX_SOURCE) + "-DmacII", /* Apple A/UX */ +#endif +#ifdef att + "-Datt", /* AT&T products */ +#endif +#ifdef sony + "-Dsony", /* Sony */ +#ifndef SYSTYPE_SYSV + "-Dbsd43", +#endif +#endif +#ifdef _IBMR2 + "-D_IBMR2", /* IBM RS-6000 (we ensured that aix is defined above) */ +#ifndef aix +#define aix /* allow BOOTSTRAPCFLAGS="-D_IBMR2" */ +#endif +#endif /* _IBMR2 */ +#ifdef aix + "-Daix", /* AIX instead of AOS */ +#ifndef ibm +#define ibm /* allow BOOTSTRAPCFLAGS="-Daix" */ +#endif +#endif /* aix */ +#ifdef ibm + "-Dibm", /* IBM PS/2 and RT under both AOS and AIX */ +#endif +#ifdef luna + "-Dluna", /* OMRON luna 68K and 88K */ +#ifdef luna1 + "-Dluna1", +#endif +#ifdef luna88k /* need not on UniOS-Mach Vers. 1.13 */ + "-traditional", /* for some older version */ +#endif /* instead of "-DXCOMM=\\#" */ +#ifdef uniosb + "-Duniosb", +#endif +#ifdef uniosu + "-Duniosu", +#endif +#endif /* luna */ +#ifdef CRAY /* Cray */ + "-Ucray", +#endif +#ifdef Mips + "-DMips", /* Define and use Mips for Mips Co. OS/mach. */ +# if defined(SYSTYPE_BSD) || defined(BSD) || defined(BSD43) + "-DBSD43", /* Mips RISCOS supports two environments */ +# else + "-DSYSV", /* System V environment is the default */ +# endif +#endif /* Mips */ +#ifdef MOTOROLA + "-DMOTOROLA", /* Motorola Delta Systems */ +# ifdef SYSV + "-DSYSV", +# endif +# ifdef SVR4 + "-DSVR4", +# endif +#endif /* MOTOROLA */ +#ifdef SYSV386 /* System V/386 folks */ + "-DSYSV386", +# ifdef SVR4 + "-DSVR4", +# endif +# ifdef ISC + "-DISC", /* ISC 2.2.1 */ +# endif +# ifdef SCO + "-DSCO", +# endif +# ifdef ESIX + "-DESIX", +# endif +# ifdef ATT + "-DATT", +# endif +# ifdef DELL + "-DDELL", +# endif +#endif +#ifdef linux + "-traditional", +#endif +#ifdef __alpha + "-traditional", +#endif +}; +#else /* else MAKEDEPEND */ +/* + * Step 6: predefs + * If your compiler and/or preprocessor define any specific symbols, add + * them to the the following table. The definition of struct symtab is + * in util/makedepend/def.h. + */ +struct symtab predefs[] = { +#ifdef apollo + {"apollo", "1"}, +#endif +#ifdef ibm032 + {"ibm032", "1"}, +#endif +#ifdef ibm + {"ibm", "1"}, +#endif +#ifdef aix + {"aix", "1"}, +#endif +#ifdef sun + {"sun", "1"}, +#endif +#ifdef hpux + {"hpux", "1"}, +#endif +#ifdef vax + {"vax", "1"}, +#endif +#ifdef VMS + {"VMS", "1"}, +#endif +#ifdef cray + {"cray", "1"}, +#endif +#ifdef CRAY + {"CRAY", "1"}, +#endif +#ifdef att + {"att", "1"}, +#endif +#ifdef mips + {"mips", "1"}, +#endif +#ifdef ultrix + {"ultrix", "1"}, +#endif +#ifdef stellar + {"stellar", "1"}, +#endif +#ifdef mc68000 + {"mc68000", "1"}, +#endif +#ifdef mc68020 + {"mc68020", "1"}, +#endif +#ifdef __GNUC__ + {"__GNUC__", "1"}, +#endif +#if __STDC__ + {"__STDC__", "1"}, +#endif +#ifdef __HIGHC__ + {"__HIGHC__", "1"}, +#endif +#ifdef CMU + {"CMU", "1"}, +#endif +#ifdef luna + {"luna", "1"}, +#ifdef luna1 + {"luna1", "1"}, +#endif +#ifdef luna2 + {"luna2", "1"}, +#endif +#ifdef luna88k + {"luna88k", "1"}, +#endif +#ifdef uniosb + {"uniosb", "1"}, +#endif +#ifdef uniosu + {"uniosu", "1"}, +#endif +#endif +#ifdef ieeep754 + {"ieeep754", "1"}, +#endif +#ifdef is68k + {"is68k", "1"}, +#endif +#ifdef m68k + {"m68k", "1"}, +#endif +#ifdef m88k + {"m88k", "1"}, +#endif +#ifdef bsd43 + {"bsd43", "1"}, +#endif +#ifdef hcx + {"hcx", 1}, +#endif +#if defined(alpha) || defined(__alpha) || defined(__alpha__) + {"__alpha__", 1}, +#endif + /* add any additional symbols before this line */ + {NULL, NULL} +}; + +#endif /* MAKEDEPEND */ +#endif /* CCJMAKE */ + diff --git a/web/glasgow/lit2x-0.16/mkworld/jmkmf.prl b/web/glasgow/lit2x-0.16/mkworld/jmkmf.prl new file mode 100644 index 0000000000..fe4dcd2edf --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/jmkmf.prl @@ -0,0 +1,130 @@ +# this *.prl file is shoved through "msub" +# +# generate a Makefile from a Jmakefile from _outside_ [only] the GHC +# sources! +# +# based on X11R4 xmkmf /bin/sh script via Paul DuBois +# +# uses: +# (1) a new project with no special jmake requirements; want to use +# installed "none"-project stuff: +# type% cd top-of-project-sources +# type% jmkmf +# +# (2) a new project with a "project-label" (and maybe a "setup-label") +# +# type% cd top-of-project-sources +# type% jmkmf -P project-label -S setup-label [-C project-config-dir] +# +# (3) for a project using installed utils, jmkmf will be invoked when +# "make Makefile" happens: +# +# jmkmf -P <proj-label> -S <setup-label> - -DTopDir=<foo> -DTopDirPwd=<bar> -DCurDir=<baz> +# +# The "-" separates the getopt-able options from the rest. +# +# The -S option may be omitted if "setup-label" is "std" and -C option +# may be omitted if the project's config files happen to live in the +# std place (see -A). +# +# The "-A allprojects-config-dir" option may be used to override +# jmkmf's built-in idea of where the jmake config files are installed. +# +# don't let people fiddle with TopDir and CurDir +# +$Pgm = $0; $Pgm =~ s/.*\/([^\/]+)$/\1/; +$Status = 0; +do 'getopts.pl' || die "Giant error 'do'ing getopts.pl: $@"; +$Usage = "usage: $Pgm ". + '[-v] '. + '[-P project-label] '. + '[-S setup-label] '. + '[-C project-config-dir] '. + '[-A alternate-installed-config-dir] '. + "[- args to pass on to jmake]\n"; + +$TopDir = '.'; +$CurDir = '.'; +$jmake_extra_args = ''; + +chop($TopDirPwd = `pwd`); +$TopDirPwd =~ s/^\/tmp_mnt//; # anti-NFS attack + +if ( ! &Getopts('A:C:P:S:v')) { + print STDERR $Usage; + exit 1; +} else { + while ($#ARGV >= 0) { + $_ = $ARGV[0]; shift(@ARGV); + next if /^-$/; + $TopDir = $1, next if /^-DTopDir=(.*)$/; + $TopDirPwd = $1, next if /^-DTopDirPwd=(.*)$/; + $CurDir = $1, next if /^-DCurDir=(.*)$/; + $jmake_extra_args .= " $_"; + } +} + +$Verbose = ($opt_v) ? 1 : 0; +$Project_label = ($opt_P) ? $opt_P : 'none'; +$Setup_label = ($opt_S) ? $opt_S : 'std'; +$Project_config_dir = ($opt_C) ? $opt_C : ''; +# the next line fixed up by msub +$Std_config_dir = ($opt_A) ? $opt_A + : (( $(INSTALLING) ) ? '$(INSTDATADIR_MKWORLD)' + : '$(TOP_PWD)/$(CURRENT_DIR)'); + +# chk that all the config and dirs files will be there if needed? + +# relative-ise Project_config_dir +$Have_project_config_dir = ''; +$Project_config_dir_is_relative = ''; +if ($Project_config_dir) { + $Have_project_config_dir = '-DHaveProjectConfigDir'; + $Real_project_config_dir = $Project_config_dir; + if ($Project_config_dir !~ /^\//) { + $Project_config_dir_is_relative = '-DRelativeProjectConfigDir'; + if (! $TopDir) { + print STDERR "$Pgm: I don't know what TopDir is\n"; + } else { + $Real_project_config_dir= "$TopDir/$Project_config_dir"; + } + } + # tidy the name + $Project_config_dir =~ s/^(\.\/)+/\.\//; +} + +# do it +if ( -f Makefile ) { + print STDERR "mv Makefile Makefile.bak\n"; + $Makefile_moved = 1; + (system('mv -f Makefile Makefile.bak') >> 8) && die "$Pgm: mv -f Makefile Makefile.bak: failed\n"; +} else { + $Makefile_moved = 0; +} + +# should this always -DUseInstalledUtils? + +$jmake_args = "-DUseInstalledUtils -P $Project_label -S $Setup_label"; + +$jmake_args .= " $Have_project_config_dir"; +$jmake_args .= " $Project_config_dir_is_relative"; +if ($Project_config_dir) { + $jmake_args .= " -DProjectConfigDir=$Project_config_dir -I$Real_project_config_dir"; +} +$jmake_args .= " -I$Std_config_dir"; +$jmake_args .= " -DTopDir=$TopDir -DTopDirPwd=$TopDirPwd -DCurDir=$CurDir"; +$jmake_args .= $jmake_extra_args; + +print STDERR "jmake $jmake_args\n"; +if (system("jmake $jmake_args") >> 8) { + if ($Makefile_moved) { + print STDERR "$Pgm: trying to restore Makefile...\n"; + rename('Makefile.bak','Makefile') || die "$Pgm: mv Makefile.bak Makefile: failed\n"; + } else { + unlink('Makefile'); # don't want to confuse the issue + } + exit(1); +} +# chmod 0444, 'Makefile'; +exit 0; + diff --git a/web/glasgow/lit2x-0.16/mkworld/jrestoredeps b/web/glasgow/lit2x-0.16/mkworld/jrestoredeps new file mode 100644 index 0000000000..510185f727 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/jrestoredeps @@ -0,0 +1,63 @@ +eval "exec perl -S $0 $*" + if $running_under_some_random_shell; +# +$Verbose = 0; +if ($ARGV[0] eq '-v') { + $Verbose++; + shift(@ARGV); +} +# assuming we've just saved a Makefile as Makefile.bak +# and run "jmake" to make a new Makefile, we now want +# to grab all the old "make depend" stuff from Makefile.bak and +# re-glue it onto the new Makefile. + +open(MKF, "< Makefile") || die "Can't open Makefile\n"; +open(NEW, "> Makefile.new") || die "Can't open Makefile.new\n"; +while (<MKF>) { + # don't go past a "# DO NOT DELETE" line + last if /^# DO NOT DELETE/; + + # major HACK (to sidestep whitespace kludgery in jmake) + # IF a Makefile line starts with a tab + # AND IF it uses a make-variable followed by a backslashed semi-colon, + # THEN un-backslash the semi-colon. MEGA-SIGH + if (/^\t/ && /\$\([A-Z][A-Z_]*\\:/) { + s/(\$\([A-Z][A-Z_]*)\\:/\1:/g; + } + + # while here, we may as well tidy up some mess that + # an ANSI cpp can cause: + s/\$\(\s*([_A-Z]+)\s\)/\$\(\1\)/g; + + # while we're here, we might as well tidy up any directory names... + # s|/[^/.][^/]*/\.\.||g; # nuke: /<dir>/.. + # s|/\.[^.][^/]*/\.\.||g; # nuke: /./.. (and others) + # s| \./| |; + + print NEW $_; +} +close(MKF); + +open(BAK, "< Makefile.bak") || exit(0); # die "Can't open Makefile.bak\n"; + +# skip to "# DO NOT DELETE" +$_ = <BAK>; +while ($_ && ! /^# DO NOT DELETE/ ) { + $_ = <BAK>; +} +if (! $_) { + print STDERR "No old dependencies to restore were found in Makefile.bak\n" + if $Verbose; +} else { + # copy through "DO NOT DELETE" line + print NEW $_; + + # copy through the rest + while (<BAK>) { print NEW $_; } + + close(NEW); + close(BAK); +} + +# now rename Makefile.new to Makefile. +rename('Makefile.new', 'Makefile'); diff --git a/web/glasgow/lit2x-0.16/mkworld/macros-GEN.jm b/web/glasgow/lit2x-0.16/mkworld/macros-GEN.jm new file mode 100644 index 0000000000..42c950824d --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/macros-GEN.jm @@ -0,0 +1,853 @@ +# line 19 "../../mkworld/macros-GEN.ljm" +#ifndef CDependTarget +#define CDependTarget(deps) @@\ +MkDependCNeededHere(depend) @@\ + @@\ +depend:: deps @@\ + $(MKDEPENDC) $(MKDEPENDCFLAGS) -- $(CFLAGS) -- deps +#endif /* CDependTarget */ +# line 31 "../../mkworld/macros-GEN.ljm" +#ifndef HaskellDependTarget +#define HaskellDependTarget(deps) @@\ +MkDependHSNeededHere(depend) @@\ + @@\ +depend:: deps @@\ + $(MKDEPENDHS) $(MKDEPENDHSFLAGS) -- $(HCFLAGS) -- deps +#endif /* HaskellDependTarget */ +# line 43 "../../mkworld/macros-GEN.ljm" +#ifndef LitDependTarget +#define LitDependTarget(root,rootext) @@\ + @@\ +depend:: @@\ + $(MKDEPENDLIT) $(MKDEPENDLITFLAGS) root.rootext +#endif /* LitDependTarget */ +# line 61 "../../mkworld/macros-GEN.ljm" +#ifndef AllTarget +#define AllTarget(depends) @@\ +all:: depends +#endif +# line 71 "../../mkworld/macros-GEN.ljm" +#ifndef LinkTarget +#define LinkTarget(target,linkto) @@\ +AllTarget(target) @@\ +ExtraStuffToClean(target) @@\ +target:: linkto @@\ + RemoveTarget(target) @@\ + ${LN} linkto target +#endif +# line 101 "../../mkworld/macros-GEN.ljm" +#ifndef BuildPgm +#define BuildPgm(program,compiler,compileropts,objs,libs,deplibs) @@\ +AllTarget(program) @@\ +ExtraStuffToClean(program) @@\ +program:: objs deplibs @@\ + RemoveTarget($@) @@\ + compiler -o $@ compileropts $(LDOPTIONS) objs libs +#endif /* BuildPgm */ +# line 121 "../../mkworld/macros-GEN.ljm" +#ifndef BuildPgmFromCFiles +#define BuildPgmFromCFiles(program,objs,libs,deplibs) @@\ +BuildPgm(program,$(CC),$(CFLAGS),objs,libs,deplibs) +#endif + +#ifndef BuildPgmFromOneCFile +#define BuildPgmFromOneCFile(program) @@\ +SRCS_C = program.c @@\ +OBJS_C = program.o @@\ +BuildPgm(program,$(CC),$(CFLAGS),$(OBJS_C),/**/,/**/) +#endif +# line 137 "../../mkworld/macros-GEN.ljm" +/*ToDo: cmp => $(CMP)*/ + +#ifndef YaccRunWithExpectMsg +#define YaccRunWithExpectMsg(srcfile,ss,rs) @@\ +srcfile.tab.c : srcfile.y @@\ + $(RM) srcfile.tab.c srcfile.tab.h-SAVE y.tab.c y.tab.h y.output @@\ + @if [ -f srcfile.tab.h ] ; then $(MV) -f srcfile.tab.h srcfile.tab.h-SAVE ; fi @@\ + @echo expect ss shift/reduce conflicts and rs reduce/reduce conflicts @@\ + $(YACC) $(YFLAGS) srcfile.y @@\ + @if cmp -s srcfile.tab.h-SAVE y.tab.h ; then \ @@\ + $(MV) -f srcfile.tab.h-SAVE srcfile.tab.h ; \ @@\ + else \ @@\ + echo $(MV) -f y.tab.h srcfile.tab.h ; \ @@\ + $(MV) -f y.tab.h srcfile.tab.h ; \ @@\ + chmod 444 srcfile.tab.h ; \ @@\ + fi @@\ + @$(RM) y.tab.h @@\ + $(MV) y.tab.c srcfile.tab.c @@\ + @chmod 444 srcfile.tab.c @@\ + @@\ +srcfile.tab.h : srcfile.tab.c @@\ + @echo -n "" /* no-op */ +#endif +# line 182 "../../mkworld/macros-GEN.ljm" +#ifndef BuildPgmFromHaskellModules +#define BuildPgmFromHaskellModules(program,objs,libs,deplibs) @@\ +BuildPgm(program,$(HC),$(HCFLAGS),objs,libs,deplibs) +#endif + +#ifndef BuildPgmFromOneHaskellModule +#define BuildPgmFromOneHaskellModule(program,module,isuf) @@\ +SRCS_HS = module.isuf @@\ +OBJS_HS = module.o @@\ +BuildPgm(program,$(HC),$(HCFLAGS),$(OBJS_HS),,) +#endif +# line 197 "../../mkworld/macros-GEN.ljm" +#if HaveGlasgowHaskell == YES && UseGlasgowHaskell == YES + +#define _body_HaskellCompileWithSpecifiedFlags(module_isuf,module,isuf,flags) @@\ + $(RM) $@ \ + HaskellCompilePreProcessing(module_isuf,module,isuf) @@\ + $(HC) flags module_isuf -o module.o \ + HaskellCompilePostProcessing(module_isuf,module,isuf) + + +#elif HaveChalmersHBC == YES && UseChalmersHBC == YES + +#define _body_HaskellCompileWithSpecifiedFlags(module_isuf,module,isuf,flags) @@\ + @echo $(RM) $@; \ @@\ + $(RM) $@; \ \ + HaskellCompilePreProcessing(module_isuf,module,isuf) @@\ + iface=`basename module_isuf .isuf`.hi ; \ @@\ + if [ -f $(@D)/$$iface ] ; then \ @@\ + $(RM) $(@D)/$$iface-SAVE ; \ @@\ + $(MV) -f $(@D)/$$iface $(@D)/$$iface-SAVE ; \ @@\ + fi ; \ @@\ + set +e; \ @@\ + echo $(HC) flags module_isuf -o module.o; \ @@\ + $(HC) flags module_isuf -o module.o; \ @@\ + if [ $$? -ne 0 ] ; then \ @@\ + $(MV) -f $(@D)/$$iface-SAVE $(@D)/$$iface ; \ @@\ + exit 1; \ @@\ + fi ; \ @@\ + if cmp -s $(@D)/$$iface-SAVE $(@D)/$$iface ; then \ @@\ + $(MV) -f $(@D)/$$iface-SAVE $(@D)/$$iface ; \ @@\ + else \ @@\ + if [ -f $(@D)/$$iface-SAVE ] ; then \ @@\ + diff -c1 $(@D)/$$iface-SAVE $(@D)/$$iface ; \ @@\ + $(RM) $(@D)/$$iface-SAVE ; \ @@\ + fi ; \ @@\ + fi \ + HaskellCompilePostProcessing(module_isuf,module,isuf) + +#else /* not GHC or HBC; presumably prototype Glasgow compiler (nhc) */ + +#define _body_HaskellCompileWithSpecifiedFlags(module_isuf,module,isuf,flags) @@\ + @echo $(RM) $@; \ @@\ + $(RM) $@; \ \ + HaskellCompilePreProcessing(module_isuf,module,isuf) @@\ + iface=`basename module_isuf .isuf`.hi ; \ @@\ + if [ -f $(@D)/$$iface ] ; then \ @@\ + $(RM) $(@D)/$$iface-SAVE ; \ @@\ + $(MV) -f $(@D)/$$iface $(@D)/$$iface-SAVE ; \ @@\ + cp -p $(@D)/$$iface-SAVE $(@D)/$$iface ; \ @@\ + chmod u+w $(@D)/$$iface ; \ @@\ + fi ; \ @@\ + set +e; \ @@\ + echo $(HC) flags module_isuf -o module.o; \ @@\ + $(HC) flags module_isuf -o module.o; \ @@\ + if [ $$? -ne 0 ] ; then \ @@\ + $(RM) STAT ; \ @@\ + $(MV) -f $(@D)/$$iface-SAVE $(@D)/$$iface ; \ @@\ + exit 1; \ @@\ + fi ; \ @@\ + if [ -f STAT ] ; then $(MV) STAT module.STAT ; fi ; \ @@\ + if [ \( $(@D) != '.' \) -a \( $(@D) != './' \) ] ; then \ @@\ + iface=`basename module_isuf .isuf`.hi ; \ @@\ + $(UPDATEIFACE) $$iface $(@D)/$$iface ; \ @@\ + $(RM) $(@D)/$$iface-SAVE ; \ @@\ + fi \ + HaskellCompilePostProcessing(module_isuf,module,isuf) + +#endif /* ! ChalmersHBC or GHC */ +# line 270 "../../mkworld/macros-GEN.ljm" +#ifndef HaskellCompilePreProcessing +#define HaskellCompilePreProcessing(module_isuf,module,isuf) /* nothing */ +#endif /* ! HaskellCompilePreProcessing */ + +#ifndef HaskellCompilePostProcessing +#define HaskellCompilePostProcessing(module_isuf,module,isuf) /* nothing */ +#endif /* ! HaskellCompilePostProcessing */ +# line 281 "../../mkworld/macros-GEN.ljm" +#ifndef HaskellCompileWithSpecifiedFlags +#define HaskellCompileWithSpecifiedFlags(module,isuf,flags) @@\ +module.o : module.isuf \ +_body_HaskellCompileWithSpecifiedFlags(module.isuf,module,isuf,flags) +#endif /* HaskellCompileWithSpecifiedFlags */ + +#ifndef HaskellCompileWithExtraFlags +#define HaskellCompileWithExtraFlags(module,isuf,flags) @@\ +HaskellCompileWithSpecifiedFlags(module,isuf,-c $(HCFLAGS) flags) +#endif /* HaskellCompileWithExtraFlags */ + +#ifndef HaskellCompile +#define HaskellCompile(module,isuf) @@\ +HaskellCompileWithSpecifiedFlags(module,isuf,-c $(HCFLAGS)) +#endif /* HaskellCompile */ +# line 301 "../../mkworld/macros-GEN.ljm" +#ifndef HaskellCompileWithMoreHeapAndStack +#define HaskellCompileWithMoreHeapAndStack(module,isuf,heapsize,stksize) @@\ +HaskellCompileWithSpecifiedFlags(module,isuf,-c $(HCFLAGS) HaskellCompilerHeapSize(heapsize) HaskellCompilerStkSize(stksize)) +#endif /* HaskellCompileWithMoreHeapAndStack */ + +#ifndef HaskellCompileWithMoreHeap +#define HaskellCompileWithMoreHeap(module,isuf,heapsize) @@\ +HaskellCompileWithSpecifiedFlags(module,isuf,-c $(HCFLAGS) HaskellCompilerHeapSize(heapsize)) +#endif /* HaskellCompileWithMoreHeap */ +# line 314 "../../mkworld/macros-GEN.ljm" +#if HaveGlasgowHaskell == YES && UseGlasgowHaskell == YES +#define HaskellCompilerHeapSize(size) -Rmax-heapsize size +#define HaskellCompilerStkSize(size) -Rmax-stksize size +#define HaskellCompilerRunCpp() -cpp +#define HaskellEndRTSFlags() /*none*/ + +#elif HaveChalmersHBC == YES && UseChalmersHBC == YES +#define HaskellCompilerHeapSize(size) CAT2(-H,size) +#define HaskellCompilerStkSize(size) CAT2(-V,size) +#define HaskellCompilerRunCpp() -M +#define HaskellEndRTSFlags() - + +#else /* not GHC or HBC; assume nhc */ +#define HaskellCompilerHeapSize(size) CAT2(-H,size) +#define HaskellCompilerStkSize(size) /*cant set stksize*/ +#define HaskellCompilerRunCpp() /*none*/ +#define HaskellEndRTSFlags() - + +#endif /* not GHC or HBC */ +# line 342 "../../mkworld/macros-GEN.ljm" +#ifndef ProgramScriptTarget +#if HasExecableScripts /* can use #! */ +#define ProgramScriptTarget(prog,dst,src,deplist) @@\ +AllTarget(dst) @@\ +ExtraStuffToClean(dst) @@\ +dst:: src deplist @@\ + $(RM) $@ @@\ + echo "#!"prog > $@ @@\ + cat src >> $@ @@\ + chmod a+x $@ +#else +#define ProgramScriptTarget(prog,dst,src,deplist) @@\ +AllTarget(dst) @@\ +ExtraStuffToClean(dst) @@\ +dst:: src deplist @@\ + $(RM) $@ @@\ + echo \: > $@ @@\ + echo 'x=/tmp/xx$$$$' >> $@ @@\ + echo "cat > "'$$x'" << 'EOF'" >> $@ @@\ + cat src >> $@ @@\ + echo EOF >> $@ @@\ + echo prog '$$x' '$$@' >> $@ @@\ + echo $(RM) '$$x' >> $@ @@\ + chmod a+x $@ +#endif /* HasExecableScripts */ +#endif /* ProgramScriptTarget */ +# line 372 "../../mkworld/macros-GEN.ljm" +#ifndef MsubTarget +#define MsubTarget(dst,src,flags,deplist) @@\ +AllTarget(dst) @@\ +ExtraStuffToClean(dst) @@\ +dst:: src deplist @@\ + $(MSUB) flags src > dst +#endif +# line 388 "../../mkworld/macros-GEN.ljm" +#ifndef MsubProgramScriptTarget +#if HasExecableScripts /* can use #! */ +#define MsubProgramScriptTarget(prog,dst,src,flags,deplist) @@\ +AllTarget(dst) @@\ +ExtraStuffToClean(dst) @@\ +dst:: src deplist @@\ + $(RM) $@ @@\ + echo "#!"prog > $@ @@\ + ${MSUB} flags src >> $@ @@\ + chmod a+x $@ +#else +#define MsubProgramScriptTarget(prog,dst,src,flags,deplist) @@\ +AllTarget(dst) @@\ +ExtraStuffToClean(dst) @@\ +dst:: src deplist @@\ + $(RM) $@ @@\ + echo \: > $@ @@\ + echo 'x=/tmp/xx$$$$' >> $@ @@\ + echo "cat > "'$$x'" << 'EOF'" >> $@ @@\ + ${MSUB} flags src >> $@ @@\ + echo EOF >> $@ @@\ + echo prog '$$x' '$$@' >> $@ @@\ + echo $(RM) '$$x' >> $@ @@\ + chmod a+x $@ +#endif /* HasExecableScripts */ +#endif /* MsubProgramScriptTarget */ +# line 420 "../../mkworld/macros-GEN.ljm" +#ifndef MsubMakefileDependentProgramScriptTarget +#define MsubMakefileDependentProgramScriptTarget(prog,dst,src,flags,deplist) @@\ +MsubProgramScriptTarget(prog,dst,src,flags,deplist) @@\ + @@\ +Makefile:: @@\ + $(RM) dst +#endif +# line 430 "../../mkworld/macros-GEN.ljm" +#ifndef MsubScriptTarget +#define MsubScriptTarget(dst,src,flags,deplist) @@\ +MsubProgramScriptTarget(${SHELL},dst,src,flags,deplist) +#endif +# line 445 "../../mkworld/macros-GEN.ljm" +#ifndef NormalLibraryTarget +#define NormalLibraryTarget(libname,objlist) @@\ +AllTarget(CAT2(lib,libname.a)) @@\ +ExtraStuffToClean(CAT2(lib,libname.a)) @@\ +CAT2(lib,libname.a):: objlist @@\ + $(RM) $@ @@\ + $(AR) $@ objlist @@\ + $(RANLIB) $@ +#endif /* NormalLibraryTarget */ +# line 465 "../../mkworld/macros-GEN.ljm" +#ifndef RuntestsTarget +#define RuntestsTarget(depends) @@\ +runtests:: CAT2(runtest_,depends) +#endif + +#ifndef RunStdTestTimeCmd +#define RunStdTestTimeCmd /*none*/ +#endif + +#ifndef RunStdTest +#define RunStdTest(name,prog,teststuff) @@\ +RuntestsTarget(name) @@\ +CAT2(runtest_,name):: @@\ + @RunStdTestTimeCmd $(RUNSTDTEST) prog $(RUNSTDTEST_FLAGS) teststuff +#endif /* RunStdTest */ + +#ifndef AsPartOfTest +#define AsPartOfTest(test,cmdline) @@\ +RuntestsTarget(test) @@\ +CAT2(runtest_,test):: @@\ + cmdline +#endif /* AsPartOfTest */ +# line 499 "../../mkworld/macros-GEN.ljm" +#ifndef InstallMsubbedScriptTarget +#if HasExecableScripts /* can use #! */ +#define InstallMsubbedScriptTarget(prog,dst,src,installdir) @@\ +dst-tmp: src @@\ + $(RM) $@ @@\ + echo "#!"prog > $@ @@\ + ${MSUB} INSTALLING=1 src >> $@ @@\ + chmod a+x $@ @@\ + @@\ +InstallTargetWithNameAndFlags(dst-tmp,installdir,dst,) @@\ +install:: @@\ + $(RM) dst-tmp +#else +#define InstallMsubbedScriptTarget(prog,dst,src,installdir) @@\ +dst-tmp: src @@\ + $(RM) $@ @@\ + echo \: > $@ @@\ + echo 'x=/tmp/xx$$$$' >> $@ @@\ + echo "cat > "'$$x'" << 'EOF'" >> $@ @@\ + ${MSUB} INSTALLING=1 src >> $@ @@\ + echo EOF >> $@ @@\ + echo prog '$$x' '$$@' >> $@ @@\ + echo $(RM) '$$x' >> $@ @@\ + chmod a+x $@ @@\ + @@\ +InstallTargetWithNameAndFlags(dst-tmp,installdir,dst,) @@\ +install:: @@\ + $(RM) dst-tmp +#endif /* HasExecableScripts */ +#endif /* InstallMsubbedScriptTarget */ + +/* + INSTALLATION RULES. InstallTarget() should be a part of nearly + all of these, to add the target to the "install" rule. +*/ + +#ifndef InstallTarget +#define InstallTarget(depends) @@\ +install:: CAT2(install_,depends) +#endif + +#ifndef InstallDocTarget +#define InstallDocTarget(depends) @@\ +install_docs:: CAT2(install_doc_,depends) +#endif + +/* + Install a target specifying the flags to use. Many of the following + installation rules are instantiated as a particular expansion of this. +*/ + +#ifndef InstallTargetWithNameAndFlags +#define InstallTargetWithNameAndFlags(target,destdir,new_name,flags) @@\ +InstallTarget(new_name) @@\ +CAT2(install_,new_name):: target @@\ + $(INSTALL) -c flags target destdir/new_name +#endif + +#ifndef InstallTargetWithFlags +#define InstallTargetWithFlags(target,dest,flags) @@\ +InstallTargetWithNameAndFlags(target,dest,target,flags) +#endif + +#ifndef InstallDocTargetWithFlags +#define InstallDocTargetWithFlags(src,presuff,target,postsuff,dest,flags) @@\ +InstallDocTarget(CAT3(target,_,postsuff)) @@\ +CAT4(install_doc_,target,_,postsuff):: src.presuff @@\ + $(INSTALL) -c flags src.presuff dest/target.postsuff +#endif + +/* + Install a program +*/ + +#ifndef InstallBinaryTarget +#define InstallBinaryTarget(program,dest) @@\ +InstallTargetWithFlags(program,dest,$(INSTBINFLAGS)) +#endif + +/* Install a setuid/setgid/etc program -- DELETED (partain) +*/ + +/* + Install an executable script +*/ + +#ifndef InstallScriptTarget +#define InstallScriptTarget(script,dest) @@\ +InstallTargetWithFlags(script,dest,$(INSTSCRIPTFLAGS)) +#endif + +/* + Install a library (platform-dependent) +*/ + +#ifndef InstallLibraryTarget +#define InstallLibraryTarget(libname,dest) @@\ +InstallTargetWithFlags(CAT2(lib,libname).a,dest,$(INSTLIBFLAGS)) @@\ + ${RANLIB} dest/CAT2(lib,libname).a +#endif + +/* + Install an include file +*/ + +#ifndef InstallIncludeTarget +#define InstallIncludeTarget(file,dest) @@\ +InstallTargetWithFlags(file,dest,$(INSTINCFLAGS)) +#endif + +/* + Install a non-executable or data file (these are equivalent) +*/ + +#ifndef InstallDataTarget +#define InstallDataTarget(file,dest) @@\ +InstallTargetWithFlags(file,dest,$(INSTDATAFLAGS)) +#endif + +/* + Install a set of non-executable files + + DUMP THIS SOMETIME. +*/ + +#ifndef InstallMultNonExecTargets +#define InstallMultNonExecTargets(rule,targets,dest) @@\ +CAT2(install_,rule):: rule @@\ + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ @@\ + for i in targets ;\ @@\ + do \ @@\ + echo $(INSTALL) -c $(INSTDATAFLAGS) $$i dest/$$i; \ @@\ + $(INSTALL) -c $(INSTDATAFLAGS) $$i dest/$$i; \ @@\ + done +#endif + +/* + Install a man page. + + THIS IS WRONG - rules in Jmakefiles don't have suffix! + + file srcsuffix destdir dstsuffix ??? +*/ + +#ifndef InstallManPageTarget +#define InstallManPageTarget(file,destdir,suffix) @@\ +InstallDocTargetWithFlags(file,man,file,suffix,destdir,$(INSTMANFLAGS)) +#endif + +#ifndef InstallInfoFileTarget +#define InstallInfoFileTarget(src,target,destdir) @@\ +InstallDocTargetWithFlags(src,info,target,info,destdir,$(INSTMANFLAGS)) +#endif + +#ifndef InstallLinkTarget +#define InstallLinkTarget(target, linkto, dir) @@\ +InstallTarget(target) @@\ +CAT2(install_,target):: CAT2(install_,linkto) @@\ + RemoveTarget(dir/target) @@\ + ${LN} dir/linkto dir/target +#endif + +/* + Fake install rules for things not installed anywhere +*/ + +#ifndef FakeInstallTarget +#define FakeInstallTarget(target) @@\ +InstallTarget(target) @@\ +CAT2(install_,target):: target @@\ + @echo target is not installed anywhere. +#endif + +#ifndef FakeInstallLibrary +#define FakeInstallLibrary(libname) @@\ +InstallTarget(CAT2(lib,libname).a) @@\ +CAT2(install_lib,libname).a:: CAT2(lib,libname).a @@\ + @echo CAT2(lib,libname).a is not installed anywhere. +#endif +# line 689 "../../mkworld/macros-GEN.ljm" +#ifndef DocsTarget +#define DocsTarget(depends) @@\ +docs:: depends +#endif + +/* putting the InfoStuffNeededHere in semi-presumes that + LitDocRootTarget is only used once per directory (?) +*/ +#ifndef LitDocRootTargetWithNamedOutput +#define LitDocRootTargetWithNamedOutput(rootroot,rootext,rootout) @@\ +DocsTarget(rootroot.info rootroot.dvi) @@\ +ExtraStuffToClean(rootroot.info rootroot.dvi rootroot.texi rootroot.tex) @@\ +LitDependTarget(rootroot,rootext) @@\ + @@\ +rootroot.info:: rootroot.texi @@\ + RemoveTarget($@) @@\ + $(MAKEINFO) $(MAKEINFOFLAGS) rootroot.texi \ @@\ + && $(POSTMAKEINFO) rootroot.info @@\ + @@\ +rootroot.dvi:: rootroot.tex @@\ + RemoveTarget($@) @@\ + $(LTX) rootroot.tex @@\ + @@\ +rootroot.texi: rootout.itxi @@\ + RemoveTarget($@) @@\ + $(LIT2TEXI) -S $(LIT2TEXIFLAGS) -N rootroot.info -o rootroot.texi rootout.itxi @@\ + @@\ +rootout.itxi: rootroot.rootext @@\ + RemoveTarget($@) @@\ + $(LIT2TEXI) -S -c $(LIT2TEXIFLAGS) -o rootout.itxi rootroot.rootext @@\ + @@\ +rootroot.tex: rootout.itex @@\ + RemoveTarget($@) @@\ + $(LIT2LATEX) -S $(LIT2LATEXFLAGS) -o rootroot.tex rootout.itex @@\ + @@\ +rootout.itex: rootroot.rootext @@\ + RemoveTarget($@) @@\ + $(LIT2LATEX) -S -c $(LIT2LATEXFLAGS) -o rootout.itex rootroot.rootext +#endif /* LitDocRootTargetWithNamedOutput */ + +#ifndef LitDocRootTarget +#define LitDocRootTarget(rootroot,rootext) \ +LitDocRootTargetWithNamedOutput(rootroot,rootext,rootroot) +#endif /* LitDocRootTarget */ + +#ifndef VerbatimAndTibTarget +#define VerbatimAndTibTarget(root) @@\ +VerbatimNeededHere(docs root.tex) @@\ +DocsTarget(root.dvi) @@\ +ExtraStuffToClean(root.dvi root.tex) +#endif /* VerbatimAndTibTarget */ +# line 755 "../../mkworld/macros-GEN.ljm" +#ifndef ExtraStuffToClean +#define ExtraStuffToClean(extra) @@\ +clean:: @@\ + $(RM) extra +#endif /* ExtraStuffToClean */ + +#ifndef ExtraStuffToBeVeryClean +#define ExtraStuffToBeVeryClean(extra) @@\ +veryclean:: @@\ + $(RM) extra +#endif /* ExtraStuffToBeVeryClean */ + +#ifndef RemoveTarget +#if RemoveTargetByMoving +#define RemoveTarget(program) \ +$(RM) program; if [ -f program ]; then $(MV) program CAT2(program,~); fi +#else +#define RemoveTarget(program) $(RM) program +#endif /* ! RemoveTargetByMoving */ +#endif /* RemoveTarget */ +/* + * CleanTarget - generate rules to remove any garbage files; the #* is here + * instead of in the definition of CLEAN_CMD because System V would treat a + * pound sign in the CLEAN_CMD variable as a comment. + */ +#ifndef CleanTarget +#define CleanTarget() @@\ +clean:: @@\ + $(CLEAN_CMD) \#* +#endif /* CleanTarget */ + +/* + * VeryCleanTarget - generate rules for "make veryclean"; the idea is + * that "make clean" does what "you almost always want" and "make + * veryclean" removes ALL generated files. + */ +#ifndef VeryCleanTarget +#define VeryCleanTarget() @@\ +veryclean:: @@\ + $(CLEAN_CMD) \#* +#endif /* VeryCleanTarget */ +# line 805 "../../mkworld/macros-GEN.ljm" +/* this should normally precede <>TagsTarget commands */ +/* those commands *append* to the TAGS file */ +#ifndef ClearTagsFile +#define ClearTagsFile() @@\ +tags:: @@\ + $(RM) TAGS; touch TAGS +#endif + +/* + * CTagsTarget - generate rules to compute tags files for C source code. + * (specified as an arg) + * partain: we really expect "etags" to be used... + */ +#ifndef CTagsTarget +#define CTagsTarget(srcs) @@\ +tags:: @@\ + $(CTAGS) -a $(CTAGSFLAGS) srcs +#endif /* CTagsTarget */ + +/* Similarly for Perl and Haskell */ +#ifndef PerlTagsTarget +#define PerlTagsTarget(srcs) @@\ +tags:: @@\ + $(PERLTAGS) $(PERLTAGSFLAGS) srcs +#endif /* PerlTagsTarget */ + +#ifndef HsTagsTarget +#define HsTagsTarget(srcs) @@\ +tags:: @@\ + $(HSTAGS) $(HSTAGSFLAGS) srcs +#endif /* HsTagsTarget */ +# line 850 "../../mkworld/macros-GEN.ljm" +#ifndef BuildMakefileTarget +#define BuildMakefileTarget() @@\ +JmakeNeededHere(Makefile) @@\ + @@\ +Makefile:: $(MYJCONFIGFILES) @@\ + @@\ +Makefile:: @@\ + -@if [ -f Makefile ]; then \ @@\ + echo " $(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \ @@\ + $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ @@\ + else exit 0; fi @@\ + $(JMAKE_CMD) -DTopDirPwd=$(TOP_PWD) -DTopDir=$(TOP) -DCurDir=$(CURRENT_DIR) @@\ + $(JRESTOREDEPS) @@\ + @if cmp -s Makefile Makefile.bak; then $(RM) Makefile.bak ; fi @@\ + @chmod 444 Makefile @@\ + @echo ==== The new Makefile is for\: ==== @@\ + @$(MAKE) whoami || \ @@\ + ( echo 'Putting old Makefile back (see Makefile.bad)...' && \ @@\ + $(MV) Makefile Makefile.bad && \ @@\ + $(MV) Makefile.bak Makefile ) @@\ + @@\ +whoami:: @@\ + @echo $(PROJECTNAME), version $(PROJECTVERSION) @@\ + @echo project\: $(PROJECTLABEL)\; setup\: $(SETUPLABEL) @@\ + @echo now building on a \`$(BUILDPLATFORM)\' host @@\ + @echo hoping to run on a \`$(HOSTPLATFORM)\' host +#endif /* BuildMakefileTarget */ +# line 881 "../../mkworld/macros-GEN.ljm" +#ifndef MakefileTarget +#define MakefileTarget() @@\ +BuildMakefileTarget() +#endif /* MakefileTarget */ +# line 894 "../../mkworld/macros-GEN.ljm" +#ifndef GenerateOptionsMakeVars +#define GenerateOptionsMakeVars(PGM,THINGS,AllProjectsPgmThings,PlatformPgmThings,ProjectPgmThings,SetupPgmThings) @@\ +CAT4(GLUED_,PGM,_,THINGS) = AllProjectsPgmThings PlatformPgmThings ProjectPgmThings SetupPgmThings $(CAT3(PGM,_,THINGS)) $(CAT4(EXTRA_,PGM,_,THINGS)) +#endif +# line 912 "../../mkworld/macros-GEN.ljm" +#ifndef NamedTargetSubdirs +#define NamedTargetSubdirs(name,dirs,verb,flags,subname) @@\ +name:: @@\ + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ @@\ + for i in dirs ;\ @@\ + do \ @@\ + (cd $$i ; echo verb "in $(CURRENT_DIR)/$$i..."; \ @@\ + $(MAKE) $(MFLAGS) flags subname); \ @@\ + done +#endif +# line 935 "../../mkworld/macros-GEN.ljm" +#ifndef NamedMakeSubdirs +#define NamedMakeSubdirs(name,dirs) \ +NamedTargetSubdirs(name,dirs,"making" name,PassCDebugFlags,all) +#endif /* NamedMakeSubdirs */ +# line 947 "../../mkworld/macros-GEN.ljm" +#ifndef DependSubdirs +#define DependSubdirs(dirs) \ +NamedTargetSubdirs(depend,dirs,"making dependencies",/**/,depend) +#endif /* DependSubdirs */ +# line 962 "../../mkworld/macros-GEN.ljm" +#ifndef ProjectMakeVarsForAllinSubdirs +#define ProjectMakeVarsForAllinSubdirs /*none*/ +#endif + +#ifndef SetupMakeVarsForAllinSubdirs +#define SetupMakeVarsForAllinSubdirs /*none*/ +#endif + +#ifndef DoAllinSubdirs +#define DoAllinSubdirs(dirs) \ +NamedTargetSubdirs(all,dirs,"making all",ProjectMakeVarsForAllinSubdirs SetupMakeVarsForAllinSubdirs,all) +#endif /* DoAllinSubdirs */ +# line 979 "../../mkworld/macros-GEN.ljm" +#ifndef DoDocsinSubdirs +#define DoDocsinSubdirs(dirs) \ +NamedTargetSubdirs(docs,dirs,"making docs",/*no make flags*/,docs) +#endif /* DoDocsinSubdirs */ +# line 990 "../../mkworld/macros-GEN.ljm" +#ifndef ProjectMakeVarsForRunTestsinSubdirs +#define ProjectMakeVarsForRunTestsinSubdirs /*none*/ +#endif + +#ifndef SetupMakeVarsForRunTestsinSubdirs +#define SetupMakeVarsForRunTestsinSubdirs /*none*/ +#endif + +#ifndef RunTestsSubdirs +#define RunTestsSubdirs(dirs) \ +NamedTargetSubdirs(runtests,dirs,"running tests",ProjectMakeVarsForRunTestsinSubdirs SetupMakeVarsForRunTestsinSubdirs,runtests) +#endif /* RunTestsSubdirs */ +# line 1007 "../../mkworld/macros-GEN.ljm" +#ifndef InstallSubdirs +#define InstallSubdirs(dirs) \ +NamedTargetSubdirs(install,dirs,"installing",INSTROOT='$(INSTROOT)',install) +#endif /* InstallSubdirs */ +# line 1016 "../../mkworld/macros-GEN.ljm" +#ifndef InstallDocsSubdirs +#define InstallDocsSubdirs(dirs) \ +NamedTargetSubdirs(install_docs,dirs,"installing documentation",INSTROOT='$(INSTROOT)',install_docs) +#endif /* InstallDocsSubdirs */ +# line 1025 "../../mkworld/macros-GEN.ljm" +#ifndef NamedCleanSubdirs +#define NamedCleanSubdirs(name,dirs) \ +NamedTargetSubdirs(name,dirs,"cleaning",RM='$(RM)',clean) +#endif /* NamedCleanSubdirs */ + +#ifndef CleanSubdirs +#define CleanSubdirs(dirs) \ +NamedCleanSubdirs(clean,dirs) +#endif +# line 1039 "../../mkworld/macros-GEN.ljm" +#ifndef NamedVeryCleanSubdirs +#define NamedVeryCleanSubdirs(name,dirs) \ +NamedTargetSubdirs(name,dirs,"being veryclean",RM='$(RM)',veryclean) +#endif /* NamedCleanSubdirs */ + +#ifndef VeryCleanSubdirs +#define VeryCleanSubdirs(dirs) \ +NamedVeryCleanSubdirs(veryclean,dirs) +#endif +# line 1053 "../../mkworld/macros-GEN.ljm" +#ifndef NamedTagSubdirs +#define NamedTagSubdirs(name,dirs) \ +NamedTargetSubdirs(name,dirs,"making tags",,tags) +#endif /* TagSubdirs */ + +#ifndef TagSubdirs +#define TagSubdirs(dirs) \ +NamedTagSubdirs(tags,dirs) +#endif +# line 1072 "../../mkworld/macros-GEN.ljm" +#ifndef MakeMakeSubdirs +#define MakeMakeSubdirs(dirs,target) @@\ +target:: @@\ + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ @@\ + for i in dirs ;\ @@\ + do \ @@\ + echo "making Makefiles in $(CURRENT_DIR)/$$i..."; \ @@\ + case "$$i" in \ @@\ + ./?*/?*/?*/?*) newtop=../../../../ sub=subsubsubsub;; \ @@\ + ./?*/?*/?*) newtop=../../../ sub=subsubsub;; \ @@\ + ./?*/?*) newtop=../../ sub=subsub;; \ @@\ + ./?*) newtop=../ sub=sub;; \ @@\ + */?*/?*/?*) newtop=../../../../ sub=subsubsubsub;; \ @@\ + */?*/?*) newtop=../../../ sub=subsubsub;; \ @@\ + */?*) newtop=../../ sub=subsub;; \ @@\ + *) newtop=../ sub=sub;; \ @@\ + esac; \ @@\ + case "$(TOP)" in \ @@\ + /?*) newtop= upprefix= ;; \ @@\ + *) upprefix=../ ;; \ @@\ + esac; \ @@\ + $(MAKE) $${sub}dirMakefiles UPPREFIX=$$upprefix NEWTOP=$$newtop \ @@\ + MAKEFILE_SUBDIR=$$i NEW_CURRENT_DIR=$(CURRENT_DIR)/$$i;\ @@\ + done +#endif /* MakeMakeSubdirs */ +# line 1104 "../../mkworld/macros-GEN.ljm" +#ifndef MakeNsubdirMakefiles +#define MakeNsubdirMakefiles() @@\ +subdirMakefiles: @@\ + $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak @@\ + -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \ @@\ + echo " $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \ @@\ + $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@\ + else exit 0; fi @@\ + cd $(MAKEFILE_SUBDIR); $(JMAKE_CMD) -DTopDirPwd=$(TOP_PWD) -DTopDir=$(UPPREFIX)$(TOP) -DCurDir=$(NEW_CURRENT_DIR); \ @@\ + $(NEWTOP)$(JRESTOREDEPS); \ @@\ + $(MAKE) $(MFLAGS) NEWTOP= Makefile Makefiles @@\ + @@\ +subsubdirMakefiles: @@\ + $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak @@\ + -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \ @@\ + echo " $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \ @@\ + $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@\ + else exit 0; fi @@\ + cd $(MAKEFILE_SUBDIR); $(JMAKE_CMD) -DTopDirPwd=$(TOP_PWD) -DTopDir=$(UPPREFIX)$(UPPREFIX)$(TOP) -DCurDir=$(NEW_CURRENT_DIR); \ @@\ + $(NEWTOP)$(JRESTOREDEPS); \ @@\ + $(MAKE) $(MFLAGS) NEWTOP= Makefile Makefiles @@\ + @@\ +subsubsubdirMakefiles: @@\ + $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak @@\ + -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \ @@\ + echo " $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \ @@\ + $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@\ + else exit 0; fi @@\ + cd $(MAKEFILE_SUBDIR); $(JMAKE_CMD) -DTopDirPwd=$(TOP_PWD) -DTopDir=$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(TOP) -DCurDir=$(NEW_CURRENT_DIR); \ @@\ + $(NEWTOP)$(JRESTOREDEPS); \ @@\ + $(MAKE) $(MFLAGS) NEWTOP= Makefile Makefiles @@\ + @@\ +subsubsubsubdirMakefiles: @@\ + $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak @@\ + -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \ @@\ + echo " $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \ @@\ + $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@\ + else exit 0; fi @@\ + cd $(MAKEFILE_SUBDIR); $(JMAKE_CMD) -DTopDirPwd=$(TOP_PWD) -DTopDir=$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(TOP) -DCurDir=$(NEW_CURRENT_DIR); \ @@\ + $(NEWTOP)$(JRESTOREDEPS); \ @@\ + $(MAKE) $(MFLAGS) NEWTOP= Makefile Makefiles +#endif /* MakeNsubdirMakefiles */ +# line 1153 "../../mkworld/macros-GEN.ljm" +#ifndef MakefileSubdirs +#define MakefileSubdirs(dirs) @@\ +MakeMakeSubdirs(dirs,Makefiles) @@\ + @@\ +MakeNsubdirMakefiles() +#endif /* MakefileSubdirs */ +# line 1162 "../../mkworld/macros-GEN.ljm" +#ifndef MakeDirectories +#define MakeDirectories(step,dirs) @@\ +step:: @@\ + $(MKDIRHIER) dirs +#endif +# line 1170 "../../mkworld/macros-GEN.ljm" +#ifndef LinkDirectories +#define LinkDirectories(step,dirs,todir) @@\ +step:: @@\ + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ @@\ + for i in dirs ; \ @@\ + do \ @@\ + echo "linking $$i to" todir; \ @@\ + $(LNDIR) todir $$i; \ @@\ + done +#endif diff --git a/web/glasgow/lit2x-0.16/mkworld/macros-GEN.ljm b/web/glasgow/lit2x-0.16/mkworld/macros-GEN.ljm new file mode 100644 index 0000000000..ec87a7d444 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/macros-GEN.ljm @@ -0,0 +1,1180 @@ +%************************************************************************ +%* * +\section[mkworld-macros-GEN]{Mkworld CPP macros for the masses} +%* * +%************************************************************************ + +%************************************************************************ +%* * +\subsection[mkworld-macros-depend]{Macros related to \tr{depend} std target} +%* * +%************************************************************************ + +These \tr{*DependTarget} rules assume the relevant programs are in +their proper places. They won't reach out and build them for you. + +@CDependTarget@: generate rules to compute dependencies for all C files +in @deps@. +\begin{code} +#ifndef CDependTarget +#define CDependTarget(deps) @@\ +MkDependCNeededHere(depend) @@\ + @@\ +depend:: deps @@\ + $(MKDEPENDC) $(MKDEPENDCFLAGS) -- $(CFLAGS) -- deps +#endif /* CDependTarget */ +\end{code} + +@HaskellDependTarget@: generate rules to compute dependencies for all +Haskell files in @deps@. +\begin{code} +#ifndef HaskellDependTarget +#define HaskellDependTarget(deps) @@\ +MkDependHSNeededHere(depend) @@\ + @@\ +depend:: deps @@\ + $(MKDEPENDHS) $(MKDEPENDHSFLAGS) -- $(HCFLAGS) -- deps +#endif /* HaskellDependTarget */ +\end{code} + +@LitDependTarget@: generate rules to compute dependencies for the +specified ``literate root file''. +\begin{code} +#ifndef LitDependTarget +#define LitDependTarget(root,rootext) @@\ + @@\ +depend:: @@\ + $(MKDEPENDLIT) $(MKDEPENDLITFLAGS) root.rootext +#endif /* LitDependTarget */ +\end{code} + +%************************************************************************ +%* * +\subsection[mkworld-macros-all]{Macros related to \tr{all} std target} +%* * +%************************************************************************ + +First, so easy ones. @AllTarget()@ should be a part of most of these +to automatically add the target to the \tr{all} rule. + +\begin{code} +#ifndef AllTarget +#define AllTarget(depends) @@\ +all:: depends +#endif +\end{code} + +Make a link to a target. Used when several targets use +the same object under different names. + +\begin{code} +#ifndef LinkTarget +#define LinkTarget(target,linkto) @@\ +AllTarget(target) @@\ +ExtraStuffToClean(target) @@\ +target:: linkto @@\ + RemoveTarget(target) @@\ + ${LN} linkto target +#endif +\end{code} + +%************************************************************************ +%* * +\subsubsection[mkworld-macros-bld-pgms]{Compiling modules/files and linking programs} +%* * +%************************************************************************ + +%************************************************************************ +%* * +\subsubsubsection{General macros} +%* * +%************************************************************************ + +@BuildPgm@: generate rules to compile and link the +indicated program; since it does not use any default object files, it +may be used for multiple programs in the same @Jmakefile@. + +This target is the general interface for building a single program +(perhaps one of many in the @Makefile@). + +\begin{code} +#ifndef BuildPgm +#define BuildPgm(program,compiler,compileropts,objs,libs,deplibs) @@\ +AllTarget(program) @@\ +ExtraStuffToClean(program) @@\ +program:: objs deplibs @@\ + RemoveTarget($@) @@\ + compiler -o $@ compileropts $(LDOPTIONS) objs libs +#endif /* BuildPgm */ +\end{code} +ToDo: not sure all ``compilers'' will like that -o above... + +%************************************************************************ +%* * +\subsubsubsection{Compile C files, build C programs} +%* * +%************************************************************************ + +These depend on suitable suffix rules existing. + +\begin{code} +#ifndef BuildPgmFromCFiles +#define BuildPgmFromCFiles(program,objs,libs,deplibs) @@\ +BuildPgm(program,$(CC),$(CFLAGS),objs,libs,deplibs) +#endif + +#ifndef BuildPgmFromOneCFile +#define BuildPgmFromOneCFile(program) @@\ +SRCS_C = program.c @@\ +OBJS_C = program.o @@\ +BuildPgm(program,$(CC),$(CFLAGS),$(OBJS_C),/**/,/**/) +#endif +\end{code} + +This rule is formulated, esp \tr{*.tab.h} part, in case you have more +than one @YaccRunWithExpectMsg@ in a given directory. +\begin{code} +/*ToDo: cmp => $(CMP)*/ + +#ifndef YaccRunWithExpectMsg +#define YaccRunWithExpectMsg(srcfile,ss,rs) @@\ +srcfile.tab.c : srcfile.y @@\ + $(RM) srcfile.tab.c srcfile.tab.h-SAVE y.tab.c y.tab.h y.output @@\ + @if [ -f srcfile.tab.h ] ; then $(MV) -f srcfile.tab.h srcfile.tab.h-SAVE ; fi @@\ + @echo expect ss shift/reduce conflicts and rs reduce/reduce conflicts @@\ + $(YACC) $(YFLAGS) srcfile.y @@\ + @if cmp -s srcfile.tab.h-SAVE y.tab.h ; then \ @@\ + $(MV) -f srcfile.tab.h-SAVE srcfile.tab.h ; \ @@\ + else \ @@\ + echo $(MV) -f y.tab.h srcfile.tab.h ; \ @@\ + $(MV) -f y.tab.h srcfile.tab.h ; \ @@\ + chmod 444 srcfile.tab.h ; \ @@\ + fi @@\ + @$(RM) y.tab.h @@\ + $(MV) y.tab.c srcfile.tab.c @@\ + @chmod 444 srcfile.tab.c @@\ + @@\ +srcfile.tab.h : srcfile.tab.c @@\ + @echo -n "" /* no-op */ +#endif +\end{code} + +%************************************************************************ +%* * +\subsubsubsection{Compile Haskell modules, build Haskell programs} +%* * +%************************************************************************ + +Defined here... +\begin{description} +\item[@BuildPgmFromHaskellModules@:] + +\item[@BuildPgmFromOneHaskellModule@:] + +\item[@HaskellCompileWithSpecifiedFlags@:] +\item[@HaskellCompileWithExtraFlags@:] +\item[@HaskellCompileWithMoreHeapAndStack@:] +\item[@HaskellCompileWithMoreHeap@:] +\item[@HaskellCompile@:] +\end{description} + +\begin{code} +#ifndef BuildPgmFromHaskellModules +#define BuildPgmFromHaskellModules(program,objs,libs,deplibs) @@\ +BuildPgm(program,$(HC),$(HCFLAGS),objs,libs,deplibs) +#endif + +#ifndef BuildPgmFromOneHaskellModule +#define BuildPgmFromOneHaskellModule(program,module,isuf) @@\ +SRCS_HS = module.isuf @@\ +OBJS_HS = module.o @@\ +BuildPgm(program,$(HC),$(HCFLAGS),$(OBJS_HS),,) +#endif +\end{code} + +First, we define just the body of a hs-to-o rule... +\begin{code} +#if HaveGlasgowHaskell == YES && UseGlasgowHaskell == YES + +#define _body_HaskellCompileWithSpecifiedFlags(module_isuf,module,isuf,flags) @@\ + $(RM) $@ \ + HaskellCompilePreProcessing(module_isuf,module,isuf) @@\ + $(HC) flags module_isuf -o module.o \ + HaskellCompilePostProcessing(module_isuf,module,isuf) + + +#elif HaveChalmersHBC == YES && UseChalmersHBC == YES + +#define _body_HaskellCompileWithSpecifiedFlags(module_isuf,module,isuf,flags) @@\ + @echo $(RM) $@; \ @@\ + $(RM) $@; \ \ + HaskellCompilePreProcessing(module_isuf,module,isuf) @@\ + iface=`basename module_isuf .isuf`.hi ; \ @@\ + if [ -f $(@D)/$$iface ] ; then \ @@\ + $(RM) $(@D)/$$iface-SAVE ; \ @@\ + $(MV) -f $(@D)/$$iface $(@D)/$$iface-SAVE ; \ @@\ + fi ; \ @@\ + set +e; \ @@\ + echo $(HC) flags module_isuf -o module.o; \ @@\ + $(HC) flags module_isuf -o module.o; \ @@\ + if [ $$? -ne 0 ] ; then \ @@\ + $(MV) -f $(@D)/$$iface-SAVE $(@D)/$$iface ; \ @@\ + exit 1; \ @@\ + fi ; \ @@\ + if cmp -s $(@D)/$$iface-SAVE $(@D)/$$iface ; then \ @@\ + $(MV) -f $(@D)/$$iface-SAVE $(@D)/$$iface ; \ @@\ + else \ @@\ + if [ -f $(@D)/$$iface-SAVE ] ; then \ @@\ + diff -c1 $(@D)/$$iface-SAVE $(@D)/$$iface ; \ @@\ + $(RM) $(@D)/$$iface-SAVE ; \ @@\ + fi ; \ @@\ + fi \ + HaskellCompilePostProcessing(module_isuf,module,isuf) + +#else /* not GHC or HBC; presumably prototype Glasgow compiler (nhc) */ + +#define _body_HaskellCompileWithSpecifiedFlags(module_isuf,module,isuf,flags) @@\ + @echo $(RM) $@; \ @@\ + $(RM) $@; \ \ + HaskellCompilePreProcessing(module_isuf,module,isuf) @@\ + iface=`basename module_isuf .isuf`.hi ; \ @@\ + if [ -f $(@D)/$$iface ] ; then \ @@\ + $(RM) $(@D)/$$iface-SAVE ; \ @@\ + $(MV) -f $(@D)/$$iface $(@D)/$$iface-SAVE ; \ @@\ + cp -p $(@D)/$$iface-SAVE $(@D)/$$iface ; \ @@\ + chmod u+w $(@D)/$$iface ; \ @@\ + fi ; \ @@\ + set +e; \ @@\ + echo $(HC) flags module_isuf -o module.o; \ @@\ + $(HC) flags module_isuf -o module.o; \ @@\ + if [ $$? -ne 0 ] ; then \ @@\ + $(RM) STAT ; \ @@\ + $(MV) -f $(@D)/$$iface-SAVE $(@D)/$$iface ; \ @@\ + exit 1; \ @@\ + fi ; \ @@\ + if [ -f STAT ] ; then $(MV) STAT module.STAT ; fi ; \ @@\ + if [ \( $(@D) != '.' \) -a \( $(@D) != './' \) ] ; then \ @@\ + iface=`basename module_isuf .isuf`.hi ; \ @@\ + $(UPDATEIFACE) $$iface $(@D)/$$iface ; \ @@\ + $(RM) $(@D)/$$iface-SAVE ; \ @@\ + fi \ + HaskellCompilePostProcessing(module_isuf,module,isuf) + +#endif /* ! ChalmersHBC or GHC */ +\end{code} + +The default for the ``pre-'' and/or ``post-processing'' part (possibly +swizzling around profiling/statistics files) is, of course, to do no +such thing. +\begin{code} +#ifndef HaskellCompilePreProcessing +#define HaskellCompilePreProcessing(module_isuf,module,isuf) /* nothing */ +#endif /* ! HaskellCompilePreProcessing */ + +#ifndef HaskellCompilePostProcessing +#define HaskellCompilePostProcessing(module_isuf,module,isuf) /* nothing */ +#endif /* ! HaskellCompilePostProcessing */ +\end{code} + +Now we just use the \tr{_body_*} thing above... +\begin{code} +#ifndef HaskellCompileWithSpecifiedFlags +#define HaskellCompileWithSpecifiedFlags(module,isuf,flags) @@\ +module.o : module.isuf \ +_body_HaskellCompileWithSpecifiedFlags(module.isuf,module,isuf,flags) +#endif /* HaskellCompileWithSpecifiedFlags */ + +#ifndef HaskellCompileWithExtraFlags +#define HaskellCompileWithExtraFlags(module,isuf,flags) @@\ +HaskellCompileWithSpecifiedFlags(module,isuf,-c $(HCFLAGS) flags) +#endif /* HaskellCompileWithExtraFlags */ + +#ifndef HaskellCompile +#define HaskellCompile(module,isuf) @@\ +HaskellCompileWithSpecifiedFlags(module,isuf,-c $(HCFLAGS)) +#endif /* HaskellCompile */ +\end{code} + +Asking for extra heap: the amount requested is the SEMI-SPACE size; +the actual amount of heap memory used will be twice that. +\begin{code} +#ifndef HaskellCompileWithMoreHeapAndStack +#define HaskellCompileWithMoreHeapAndStack(module,isuf,heapsize,stksize) @@\ +HaskellCompileWithSpecifiedFlags(module,isuf,-c $(HCFLAGS) HaskellCompilerHeapSize(heapsize) HaskellCompilerStkSize(stksize)) +#endif /* HaskellCompileWithMoreHeapAndStack */ + +#ifndef HaskellCompileWithMoreHeap +#define HaskellCompileWithMoreHeap(module,isuf,heapsize) @@\ +HaskellCompileWithSpecifiedFlags(module,isuf,-c $(HCFLAGS) HaskellCompilerHeapSize(heapsize)) +#endif /* HaskellCompileWithMoreHeap */ +\end{code} + +But we need those per-compiler HeapSize/StkSize/RunCpp macros... +\begin{code} +#if HaveGlasgowHaskell == YES && UseGlasgowHaskell == YES +#define HaskellCompilerHeapSize(size) -Rmax-heapsize size +#define HaskellCompilerStkSize(size) -Rmax-stksize size +#define HaskellCompilerRunCpp() -cpp +#define HaskellEndRTSFlags() /*none*/ + +#elif HaveChalmersHBC == YES && UseChalmersHBC == YES +#define HaskellCompilerHeapSize(size) CAT2(-H,size) +#define HaskellCompilerStkSize(size) CAT2(-V,size) +#define HaskellCompilerRunCpp() -M +#define HaskellEndRTSFlags() - + +#else /* not GHC or HBC; assume nhc */ +#define HaskellCompilerHeapSize(size) CAT2(-H,size) +#define HaskellCompilerStkSize(size) /*cant set stksize*/ +#define HaskellCompilerRunCpp() /*none*/ +#define HaskellEndRTSFlags() - + +#endif /* not GHC or HBC */ +\end{code} + +%************************************************************************ +%* * +\subsubsection[mkworld-macros-scripts]{Processing scripts into ``executables''} +%* * +%************************************************************************ + +\begin{code} +#ifndef ProgramScriptTarget +#if HasExecableScripts /* can use #! */ +#define ProgramScriptTarget(prog,dst,src,deplist) @@\ +AllTarget(dst) @@\ +ExtraStuffToClean(dst) @@\ +dst:: src deplist @@\ + $(RM) $@ @@\ + echo "#!"prog > $@ @@\ + cat src >> $@ @@\ + chmod a+x $@ +#else +#define ProgramScriptTarget(prog,dst,src,deplist) @@\ +AllTarget(dst) @@\ +ExtraStuffToClean(dst) @@\ +dst:: src deplist @@\ + $(RM) $@ @@\ + echo \: > $@ @@\ + echo 'x=/tmp/xx$$$$' >> $@ @@\ + echo "cat > "'$$x'" << 'EOF'" >> $@ @@\ + cat src >> $@ @@\ + echo EOF >> $@ @@\ + echo prog '$$x' '$$@' >> $@ @@\ + echo $(RM) '$$x' >> $@ @@\ + chmod a+x $@ +#endif /* HasExecableScripts */ +#endif /* ProgramScriptTarget */ +\end{code} + +Create a target by running it through @msub@: +\begin{code} +#ifndef MsubTarget +#define MsubTarget(dst,src,flags,deplist) @@\ +AllTarget(dst) @@\ +ExtraStuffToClean(dst) @@\ +dst:: src deplist @@\ + $(MSUB) flags src > dst +#endif +\end{code} + +@MsubProgramScriptTarget@: generate rules to create a script for an +arbitrary program by running the input through @msub@. If +@HasExecableScripts@ isn't @YES@, then make sure that the first line +begins with a colon and write the script into a temp file, have the +program execute that, and remove the temp file when done. Ugly ugly +ugly... @prog@ must be a full pathname... +\begin{code} +#ifndef MsubProgramScriptTarget +#if HasExecableScripts /* can use #! */ +#define MsubProgramScriptTarget(prog,dst,src,flags,deplist) @@\ +AllTarget(dst) @@\ +ExtraStuffToClean(dst) @@\ +dst:: src deplist @@\ + $(RM) $@ @@\ + echo "#!"prog > $@ @@\ + ${MSUB} flags src >> $@ @@\ + chmod a+x $@ +#else +#define MsubProgramScriptTarget(prog,dst,src,flags,deplist) @@\ +AllTarget(dst) @@\ +ExtraStuffToClean(dst) @@\ +dst:: src deplist @@\ + $(RM) $@ @@\ + echo \: > $@ @@\ + echo 'x=/tmp/xx$$$$' >> $@ @@\ + echo "cat > "'$$x'" << 'EOF'" >> $@ @@\ + ${MSUB} flags src >> $@ @@\ + echo EOF >> $@ @@\ + echo prog '$$x' '$$@' >> $@ @@\ + echo $(RM) '$$x' >> $@ @@\ + chmod a+x $@ +#endif /* HasExecableScripts */ +#endif /* MsubProgramScriptTarget */ +\end{code} + +For an @msub@ target that really slurps things out of the +\tr{Makefile}, we delete it as part of \tr{make Makefile(s)}, so that +it will be re-made. +\begin{code} +#ifndef MsubMakefileDependentProgramScriptTarget +#define MsubMakefileDependentProgramScriptTarget(prog,dst,src,flags,deplist) @@\ +MsubProgramScriptTarget(prog,dst,src,flags,deplist) @@\ + @@\ +Makefile:: @@\ + $(RM) dst +#endif +\end{code} + +\begin{code} +#ifndef MsubScriptTarget +#define MsubScriptTarget(dst,src,flags,deplist) @@\ +MsubProgramScriptTarget(${SHELL},dst,src,flags,deplist) +#endif +\end{code} + +%************************************************************************ +%* * +\subsubsection[mkworld-macros-bld-libs]{Linking modules/files into libraries} +%* * +%************************************************************************ + +@NormalLibraryTarget@: generate rules to create a library. + +\begin{code} +#ifndef NormalLibraryTarget +#define NormalLibraryTarget(libname,objlist) @@\ +AllTarget(CAT2(lib,libname.a)) @@\ +ExtraStuffToClean(CAT2(lib,libname.a)) @@\ +CAT2(lib,libname.a):: objlist @@\ + $(RM) $@ @@\ + $(AR) $@ objlist @@\ + $(RANLIB) $@ +#endif /* NormalLibraryTarget */ +\end{code} + +%************************************************************************ +%* * +\subsection[mkworld-macros-runtests]{Macros related to \tr{runtests} std target} +%* * +%************************************************************************ + +Rules to do with standard @runtests@ target. + +\begin{code} +#ifndef RuntestsTarget +#define RuntestsTarget(depends) @@\ +runtests:: CAT2(runtest_,depends) +#endif + +#ifndef RunStdTestTimeCmd +#define RunStdTestTimeCmd /*none*/ +#endif + +#ifndef RunStdTest +#define RunStdTest(name,prog,teststuff) @@\ +RuntestsTarget(name) @@\ +CAT2(runtest_,name):: @@\ + @RunStdTestTimeCmd $(RUNSTDTEST) prog $(RUNSTDTEST_FLAGS) teststuff +#endif /* RunStdTest */ + +#ifndef AsPartOfTest +#define AsPartOfTest(test,cmdline) @@\ +RuntestsTarget(test) @@\ +CAT2(runtest_,test):: @@\ + cmdline +#endif /* AsPartOfTest */ +\end{code} + +%************************************************************************ +%* * +\subsection[mkworld-macros-install]{Macros related to \tr{install} std target} +%* * +%************************************************************************ + +Run script through @msub@ with \tr{INSTALLING=1}, +putting result in a tmp file (don't mess w/ the @dst@ file here); +install that tmp file in the right place. +\begin{code} +#ifndef InstallMsubbedScriptTarget +#if HasExecableScripts /* can use #! */ +#define InstallMsubbedScriptTarget(prog,dst,src,installdir) @@\ +dst-tmp: src @@\ + $(RM) $@ @@\ + echo "#!"prog > $@ @@\ + ${MSUB} INSTALLING=1 src >> $@ @@\ + chmod a+x $@ @@\ + @@\ +InstallTargetWithNameAndFlags(dst-tmp,installdir,dst,) @@\ +install:: @@\ + $(RM) dst-tmp +#else +#define InstallMsubbedScriptTarget(prog,dst,src,installdir) @@\ +dst-tmp: src @@\ + $(RM) $@ @@\ + echo \: > $@ @@\ + echo 'x=/tmp/xx$$$$' >> $@ @@\ + echo "cat > "'$$x'" << 'EOF'" >> $@ @@\ + ${MSUB} INSTALLING=1 src >> $@ @@\ + echo EOF >> $@ @@\ + echo prog '$$x' '$$@' >> $@ @@\ + echo $(RM) '$$x' >> $@ @@\ + chmod a+x $@ @@\ + @@\ +InstallTargetWithNameAndFlags(dst-tmp,installdir,dst,) @@\ +install:: @@\ + $(RM) dst-tmp +#endif /* HasExecableScripts */ +#endif /* InstallMsubbedScriptTarget */ + +/* + INSTALLATION RULES. InstallTarget() should be a part of nearly + all of these, to add the target to the "install" rule. +*/ + +#ifndef InstallTarget +#define InstallTarget(depends) @@\ +install:: CAT2(install_,depends) +#endif + +#ifndef InstallDocTarget +#define InstallDocTarget(depends) @@\ +install_docs:: CAT2(install_doc_,depends) +#endif + +/* + Install a target specifying the flags to use. Many of the following + installation rules are instantiated as a particular expansion of this. +*/ + +#ifndef InstallTargetWithNameAndFlags +#define InstallTargetWithNameAndFlags(target,destdir,new_name,flags) @@\ +InstallTarget(new_name) @@\ +CAT2(install_,new_name):: target @@\ + $(INSTALL) -c flags target destdir/new_name +#endif + +#ifndef InstallTargetWithFlags +#define InstallTargetWithFlags(target,dest,flags) @@\ +InstallTargetWithNameAndFlags(target,dest,target,flags) +#endif + +#ifndef InstallDocTargetWithFlags +#define InstallDocTargetWithFlags(src,presuff,target,postsuff,dest,flags) @@\ +InstallDocTarget(CAT3(target,_,postsuff)) @@\ +CAT4(install_doc_,target,_,postsuff):: src.presuff @@\ + $(INSTALL) -c flags src.presuff dest/target.postsuff +#endif + +/* + Install a program +*/ + +#ifndef InstallBinaryTarget +#define InstallBinaryTarget(program,dest) @@\ +InstallTargetWithFlags(program,dest,$(INSTBINFLAGS)) +#endif + +/* Install a setuid/setgid/etc program -- DELETED (partain) +*/ + +/* + Install an executable script +*/ + +#ifndef InstallScriptTarget +#define InstallScriptTarget(script,dest) @@\ +InstallTargetWithFlags(script,dest,$(INSTSCRIPTFLAGS)) +#endif + +/* + Install a library (platform-dependent) +*/ + +#ifndef InstallLibraryTarget +#define InstallLibraryTarget(libname,dest) @@\ +InstallTargetWithFlags(CAT2(lib,libname).a,dest,$(INSTLIBFLAGS)) @@\ + ${RANLIB} dest/CAT2(lib,libname).a +#endif + +/* + Install an include file +*/ + +#ifndef InstallIncludeTarget +#define InstallIncludeTarget(file,dest) @@\ +InstallTargetWithFlags(file,dest,$(INSTINCFLAGS)) +#endif + +/* + Install a non-executable or data file (these are equivalent) +*/ + +#ifndef InstallDataTarget +#define InstallDataTarget(file,dest) @@\ +InstallTargetWithFlags(file,dest,$(INSTDATAFLAGS)) +#endif + +/* + Install a set of non-executable files + + DUMP THIS SOMETIME. +*/ + +#ifndef InstallMultNonExecTargets +#define InstallMultNonExecTargets(rule,targets,dest) @@\ +CAT2(install_,rule):: rule @@\ + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ @@\ + for i in targets ;\ @@\ + do \ @@\ + echo $(INSTALL) -c $(INSTDATAFLAGS) $$i dest/$$i; \ @@\ + $(INSTALL) -c $(INSTDATAFLAGS) $$i dest/$$i; \ @@\ + done +#endif + +/* + Install a man page. + + THIS IS WRONG - rules in Jmakefiles don't have suffix! + + file srcsuffix destdir dstsuffix ??? +*/ + +#ifndef InstallManPageTarget +#define InstallManPageTarget(file,destdir,suffix) @@\ +InstallDocTargetWithFlags(file,man,file,suffix,destdir,$(INSTMANFLAGS)) +#endif + +#ifndef InstallInfoFileTarget +#define InstallInfoFileTarget(src,target,destdir) @@\ +InstallDocTargetWithFlags(src,info,target,info,destdir,$(INSTMANFLAGS)) +#endif + +#ifndef InstallLinkTarget +#define InstallLinkTarget(target, linkto, dir) @@\ +InstallTarget(target) @@\ +CAT2(install_,target):: CAT2(install_,linkto) @@\ + RemoveTarget(dir/target) @@\ + ${LN} dir/linkto dir/target +#endif + +/* + Fake install rules for things not installed anywhere +*/ + +#ifndef FakeInstallTarget +#define FakeInstallTarget(target) @@\ +InstallTarget(target) @@\ +CAT2(install_,target):: target @@\ + @echo target is not installed anywhere. +#endif + +#ifndef FakeInstallLibrary +#define FakeInstallLibrary(libname) @@\ +InstallTarget(CAT2(lib,libname).a) @@\ +CAT2(install_lib,libname).a:: CAT2(lib,libname).a @@\ + @echo CAT2(lib,libname).a is not installed anywhere. +#endif +\end{code} + +%************************************************************************ +%* * +\subsection[mkworld-macros-docs]{Macros related to \tr{docs} std target} +%* * +%************************************************************************ + +Need rules just to make a man page or info file. + +\begin{code} +#ifndef DocsTarget +#define DocsTarget(depends) @@\ +docs:: depends +#endif + +/* putting the InfoStuffNeededHere in semi-presumes that + LitDocRootTarget is only used once per directory (?) +*/ +#ifndef LitDocRootTargetWithNamedOutput +#define LitDocRootTargetWithNamedOutput(rootroot,rootext,rootout) @@\ +DocsTarget(rootroot.info rootroot.dvi) @@\ +ExtraStuffToClean(rootroot.info rootroot.dvi rootroot.texi rootroot.tex) @@\ +LitDependTarget(rootroot,rootext) @@\ + @@\ +rootroot.info:: rootroot.texi @@\ + RemoveTarget($@) @@\ + $(MAKEINFO) $(MAKEINFOFLAGS) rootroot.texi \ @@\ + && $(POSTMAKEINFO) rootroot.info @@\ + @@\ +rootroot.dvi:: rootroot.tex @@\ + RemoveTarget($@) @@\ + $(LTX) rootroot.tex @@\ + @@\ +rootroot.texi: rootout.itxi @@\ + RemoveTarget($@) @@\ + $(LIT2TEXI) -S $(LIT2TEXIFLAGS) -N rootroot.info -o rootroot.texi rootout.itxi @@\ + @@\ +rootout.itxi: rootroot.rootext @@\ + RemoveTarget($@) @@\ + $(LIT2TEXI) -S -c $(LIT2TEXIFLAGS) -o rootout.itxi rootroot.rootext @@\ + @@\ +rootroot.tex: rootout.itex @@\ + RemoveTarget($@) @@\ + $(LIT2LATEX) -S $(LIT2LATEXFLAGS) -o rootroot.tex rootout.itex @@\ + @@\ +rootout.itex: rootroot.rootext @@\ + RemoveTarget($@) @@\ + $(LIT2LATEX) -S -c $(LIT2LATEXFLAGS) -o rootout.itex rootroot.rootext +#endif /* LitDocRootTargetWithNamedOutput */ + +#ifndef LitDocRootTarget +#define LitDocRootTarget(rootroot,rootext) \ +LitDocRootTargetWithNamedOutput(rootroot,rootext,rootroot) +#endif /* LitDocRootTarget */ + +#ifndef VerbatimAndTibTarget +#define VerbatimAndTibTarget(root) @@\ +VerbatimNeededHere(docs root.tex) @@\ +DocsTarget(root.dvi) @@\ +ExtraStuffToClean(root.dvi root.tex) +#endif /* VerbatimAndTibTarget */ +\end{code} + +%************************************************************************ +%* * +\subsection[mkworld-macros-install-docs]{Macros related to \tr{install_docs} std target} +%* * +%************************************************************************ + +%************************************************************************ +%* * +\subsection[mkworld-macros-cleaning]{Macros related to \tr{clean} (and \tr{veryclean}) std targets} +%* * +%************************************************************************ + +\begin{code} +#ifndef ExtraStuffToClean +#define ExtraStuffToClean(extra) @@\ +clean:: @@\ + $(RM) extra +#endif /* ExtraStuffToClean */ + +#ifndef ExtraStuffToBeVeryClean +#define ExtraStuffToBeVeryClean(extra) @@\ +veryclean:: @@\ + $(RM) extra +#endif /* ExtraStuffToBeVeryClean */ + +#ifndef RemoveTarget +#if RemoveTargetByMoving +#define RemoveTarget(program) \ +$(RM) program; if [ -f program ]; then $(MV) program CAT2(program,~); fi +#else +#define RemoveTarget(program) $(RM) program +#endif /* ! RemoveTargetByMoving */ +#endif /* RemoveTarget */ +/* + * CleanTarget - generate rules to remove any garbage files; the #* is here + * instead of in the definition of CLEAN_CMD because System V would treat a + * pound sign in the CLEAN_CMD variable as a comment. + */ +#ifndef CleanTarget +#define CleanTarget() @@\ +clean:: @@\ + $(CLEAN_CMD) \#* +#endif /* CleanTarget */ + +/* + * VeryCleanTarget - generate rules for "make veryclean"; the idea is + * that "make clean" does what "you almost always want" and "make + * veryclean" removes ALL generated files. + */ +#ifndef VeryCleanTarget +#define VeryCleanTarget() @@\ +veryclean:: @@\ + $(CLEAN_CMD) \#* +#endif /* VeryCleanTarget */ +\end{code} + +%************************************************************************ +%* * +\subsection[mkworld-macros-tags]{Macros related to \tr{tags} std target} +%* * +%************************************************************************ + +\begin{code} +/* this should normally precede <>TagsTarget commands */ +/* those commands *append* to the TAGS file */ +#ifndef ClearTagsFile +#define ClearTagsFile() @@\ +tags:: @@\ + $(RM) TAGS; touch TAGS +#endif + +/* + * CTagsTarget - generate rules to compute tags files for C source code. + * (specified as an arg) + * partain: we really expect "etags" to be used... + */ +#ifndef CTagsTarget +#define CTagsTarget(srcs) @@\ +tags:: @@\ + $(CTAGS) -a $(CTAGSFLAGS) srcs +#endif /* CTagsTarget */ + +/* Similarly for Perl and Haskell */ +#ifndef PerlTagsTarget +#define PerlTagsTarget(srcs) @@\ +tags:: @@\ + $(PERLTAGS) $(PERLTAGSFLAGS) srcs +#endif /* PerlTagsTarget */ + +#ifndef HsTagsTarget +#define HsTagsTarget(srcs) @@\ +tags:: @@\ + $(HSTAGS) $(HSTAGSFLAGS) srcs +#endif /* HsTagsTarget */ +\end{code} + +%************************************************************************ +%* * +\subsection[mkworld-macros-Makefile]{Macros related to \tr{make Makefile}} +%* * +%************************************************************************ + +@BuildMakefileTarget@: generate rules to build a \tr{Makefile} from a +\tr{Jmakefile} (and, in the past, any special jmake flags). This is +generally done automatically by the template or by any special +Jmakefiles. + +\begin{code} +#ifndef BuildMakefileTarget +#define BuildMakefileTarget() @@\ +JmakeNeededHere(Makefile) @@\ + @@\ +Makefile:: $(MYJCONFIGFILES) @@\ + @@\ +Makefile:: @@\ + -@if [ -f Makefile ]; then \ @@\ + echo " $(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \ @@\ + $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ @@\ + else exit 0; fi @@\ + $(JMAKE_CMD) -DTopDirPwd=$(TOP_PWD) -DTopDir=$(TOP) -DCurDir=$(CURRENT_DIR) @@\ + $(JRESTOREDEPS) @@\ + @if cmp -s Makefile Makefile.bak; then $(RM) Makefile.bak ; fi @@\ + @chmod 444 Makefile @@\ + @echo ==== The new Makefile is for\: ==== @@\ + @$(MAKE) whoami || \ @@\ + ( echo 'Putting old Makefile back (see Makefile.bad)...' && \ @@\ + $(MV) Makefile Makefile.bad && \ @@\ + $(MV) Makefile.bak Makefile ) @@\ + @@\ +whoami:: @@\ + @echo $(PROJECTNAME), version $(PROJECTVERSION) @@\ + @echo project\: $(PROJECTLABEL)\; setup\: $(SETUPLABEL) @@\ + @echo now building on a \`$(BUILDPLATFORM)\' host @@\ + @echo hoping to run on a \`$(HOSTPLATFORM)\' host +#endif /* BuildMakefileTarget */ +\end{code} + +@MakefileTarget@: generate rules to build a normal \tr{Makefile}. +\begin{code} +#ifndef MakefileTarget +#define MakefileTarget() @@\ +BuildMakefileTarget() +#endif /* MakefileTarget */ +\end{code} + +%************************************************************************ +%* * +\subsection[mkworld-macros-MISC]{MISCELLANEOUS macros} +%* * +%************************************************************************ + +\begin{code} +#ifndef GenerateOptionsMakeVars +#define GenerateOptionsMakeVars(PGM,THINGS,AllProjectsPgmThings,PlatformPgmThings,ProjectPgmThings,SetupPgmThings) @@\ +CAT4(GLUED_,PGM,_,THINGS) = AllProjectsPgmThings PlatformPgmThings ProjectPgmThings SetupPgmThings $(CAT3(PGM,_,THINGS)) $(CAT4(EXTRA_,PGM,_,THINGS)) +#endif +\end{code} + + +%************************************************************************ +%* * +\subsection[mkworld-macros-subdir]{Sub-directories: things for std targets...} +%* * +%************************************************************************ + +\subsubsection{@NamedTargetSubdirs@} + +Recursively make a series of steps. + +\begin{code} +#ifndef NamedTargetSubdirs +#define NamedTargetSubdirs(name,dirs,verb,flags,subname) @@\ +name:: @@\ + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ @@\ + for i in dirs ;\ @@\ + do \ @@\ + (cd $$i ; echo verb "in $(CURRENT_DIR)/$$i..."; \ @@\ + $(MAKE) $(MFLAGS) flags subname); \ @@\ + done +#endif +\end{code} + +\subsubsection{@NamedMakeSubdirs@} + +Generate rules to do makes in the given subdirectories. If you want +@CDEBUGFLAGS@ passed along to subdirectories, provide a line like the +following in the appropriate @Jmakefile@: + +\begin{verbatim} +#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' +\end{verbatim} + +\begin{code} +#ifndef NamedMakeSubdirs +#define NamedMakeSubdirs(name,dirs) \ +NamedTargetSubdirs(name,dirs,"making" name,PassCDebugFlags,all) +#endif /* NamedMakeSubdirs */ +\end{code} + +\subsubsection{@DependSubdirs@} + +Generate rules to recursively compute dependencies as +part of the make depend step. + +\begin{code} +#ifndef DependSubdirs +#define DependSubdirs(dirs) \ +NamedTargetSubdirs(depend,dirs,"making dependencies",/**/,depend) +#endif /* DependSubdirs */ +\end{code} + + + +\subsubsection{@DoAllinSubdirs@} + +Generate rules to recursively \tr{make all}. The +\tr{...MakeVarsForAll...} things can be set to have certain +make-variable setting passed downwards. + +\begin{code} +#ifndef ProjectMakeVarsForAllinSubdirs +#define ProjectMakeVarsForAllinSubdirs /*none*/ +#endif + +#ifndef SetupMakeVarsForAllinSubdirs +#define SetupMakeVarsForAllinSubdirs /*none*/ +#endif + +#ifndef DoAllinSubdirs +#define DoAllinSubdirs(dirs) \ +NamedTargetSubdirs(all,dirs,"making all",ProjectMakeVarsForAllinSubdirs SetupMakeVarsForAllinSubdirs,all) +#endif /* DoAllinSubdirs */ +\end{code} + +\subsubsection{@DoDocsinSubdirs@} +Generate rules to recursively \tr{make docs}. +\begin{code} +#ifndef DoDocsinSubdirs +#define DoDocsinSubdirs(dirs) \ +NamedTargetSubdirs(docs,dirs,"making docs",/*no make flags*/,docs) +#endif /* DoDocsinSubdirs */ +\end{code} + +\subsubsection{@RunTestsSubdirs@} + +Generate rules to recursively \tr{make runtests}. + +\begin{code} +#ifndef ProjectMakeVarsForRunTestsinSubdirs +#define ProjectMakeVarsForRunTestsinSubdirs /*none*/ +#endif + +#ifndef SetupMakeVarsForRunTestsinSubdirs +#define SetupMakeVarsForRunTestsinSubdirs /*none*/ +#endif + +#ifndef RunTestsSubdirs +#define RunTestsSubdirs(dirs) \ +NamedTargetSubdirs(runtests,dirs,"running tests",ProjectMakeVarsForRunTestsinSubdirs SetupMakeVarsForRunTestsinSubdirs,runtests) +#endif /* RunTestsSubdirs */ +\end{code} + +\subsubsection{@InstallSubdirs@} +Generate rules to recursively \tr{make install}. +\begin{code} +#ifndef InstallSubdirs +#define InstallSubdirs(dirs) \ +NamedTargetSubdirs(install,dirs,"installing",INSTROOT='$(INSTROOT)',install) +#endif /* InstallSubdirs */ +\end{code} + +\subsubsection{@InstallDocsSubdirs@} +Generate rules to recursively \tr{make install_docs}. +\begin{code} +#ifndef InstallDocsSubdirs +#define InstallDocsSubdirs(dirs) \ +NamedTargetSubdirs(install_docs,dirs,"installing documentation",INSTROOT='$(INSTROOT)',install_docs) +#endif /* InstallDocsSubdirs */ +\end{code} + +\subsubsection{@CleanSubdirs@} +Generate rules to recursively \tr{make clean}. +\begin{code} +#ifndef NamedCleanSubdirs +#define NamedCleanSubdirs(name,dirs) \ +NamedTargetSubdirs(name,dirs,"cleaning",RM='$(RM)',clean) +#endif /* NamedCleanSubdirs */ + +#ifndef CleanSubdirs +#define CleanSubdirs(dirs) \ +NamedCleanSubdirs(clean,dirs) +#endif +\end{code} + +\subsubsection{@VeryCleanSubdirs@} +Generate rules to recursively \tr{make veryclean}. +\begin{code} +#ifndef NamedVeryCleanSubdirs +#define NamedVeryCleanSubdirs(name,dirs) \ +NamedTargetSubdirs(name,dirs,"being veryclean",RM='$(RM)',veryclean) +#endif /* NamedCleanSubdirs */ + +#ifndef VeryCleanSubdirs +#define VeryCleanSubdirs(dirs) \ +NamedVeryCleanSubdirs(veryclean,dirs) +#endif +\end{code} + +\subsubsection{@TagSubdirs@} +Generate rules to recursively \tr{make tags} (create TAGS files). +\begin{code} +#ifndef NamedTagSubdirs +#define NamedTagSubdirs(name,dirs) \ +NamedTargetSubdirs(name,dirs,"making tags",,tags) +#endif /* TagSubdirs */ + +#ifndef TagSubdirs +#define TagSubdirs(dirs) \ +NamedTagSubdirs(tags,dirs) +#endif +\end{code} + +\subsubsection{@MakeMakeSubdirs@} + +Generate rules to recursively recreate Makefiles as part of the +specified step in the build. If @$(TOP)@ is set to an absolute +path, don't prepend the @../@ prefix. This makes running things +outside of the source tree much easier. + +\begin{code} +#ifndef MakeMakeSubdirs +#define MakeMakeSubdirs(dirs,target) @@\ +target:: @@\ + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ @@\ + for i in dirs ;\ @@\ + do \ @@\ + echo "making Makefiles in $(CURRENT_DIR)/$$i..."; \ @@\ + case "$$i" in \ @@\ + ./?*/?*/?*/?*) newtop=../../../../ sub=subsubsubsub;; \ @@\ + ./?*/?*/?*) newtop=../../../ sub=subsubsub;; \ @@\ + ./?*/?*) newtop=../../ sub=subsub;; \ @@\ + ./?*) newtop=../ sub=sub;; \ @@\ + */?*/?*/?*) newtop=../../../../ sub=subsubsubsub;; \ @@\ + */?*/?*) newtop=../../../ sub=subsubsub;; \ @@\ + */?*) newtop=../../ sub=subsub;; \ @@\ + *) newtop=../ sub=sub;; \ @@\ + esac; \ @@\ + case "$(TOP)" in \ @@\ + /?*) newtop= upprefix= ;; \ @@\ + *) upprefix=../ ;; \ @@\ + esac; \ @@\ + $(MAKE) $${sub}dirMakefiles UPPREFIX=$$upprefix NEWTOP=$$newtop \ @@\ + MAKEFILE_SUBDIR=$$i NEW_CURRENT_DIR=$(CURRENT_DIR)/$$i;\ @@\ + done +#endif /* MakeMakeSubdirs */ +\end{code} + +\subsubsection{@MakeNsubdirMakefiles@} + +Generate rules to create sub Makefiles. + +\begin{code} +#ifndef MakeNsubdirMakefiles +#define MakeNsubdirMakefiles() @@\ +subdirMakefiles: @@\ + $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak @@\ + -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \ @@\ + echo " $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \ @@\ + $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@\ + else exit 0; fi @@\ + cd $(MAKEFILE_SUBDIR); $(JMAKE_CMD) -DTopDirPwd=$(TOP_PWD) -DTopDir=$(UPPREFIX)$(TOP) -DCurDir=$(NEW_CURRENT_DIR); \ @@\ + $(NEWTOP)$(JRESTOREDEPS); \ @@\ + $(MAKE) $(MFLAGS) NEWTOP= Makefile Makefiles @@\ + @@\ +subsubdirMakefiles: @@\ + $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak @@\ + -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \ @@\ + echo " $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \ @@\ + $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@\ + else exit 0; fi @@\ + cd $(MAKEFILE_SUBDIR); $(JMAKE_CMD) -DTopDirPwd=$(TOP_PWD) -DTopDir=$(UPPREFIX)$(UPPREFIX)$(TOP) -DCurDir=$(NEW_CURRENT_DIR); \ @@\ + $(NEWTOP)$(JRESTOREDEPS); \ @@\ + $(MAKE) $(MFLAGS) NEWTOP= Makefile Makefiles @@\ + @@\ +subsubsubdirMakefiles: @@\ + $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak @@\ + -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \ @@\ + echo " $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \ @@\ + $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@\ + else exit 0; fi @@\ + cd $(MAKEFILE_SUBDIR); $(JMAKE_CMD) -DTopDirPwd=$(TOP_PWD) -DTopDir=$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(TOP) -DCurDir=$(NEW_CURRENT_DIR); \ @@\ + $(NEWTOP)$(JRESTOREDEPS); \ @@\ + $(MAKE) $(MFLAGS) NEWTOP= Makefile Makefiles @@\ + @@\ +subsubsubsubdirMakefiles: @@\ + $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak @@\ + -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \ @@\ + echo " $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \ @@\ + $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@\ + else exit 0; fi @@\ + cd $(MAKEFILE_SUBDIR); $(JMAKE_CMD) -DTopDirPwd=$(TOP_PWD) -DTopDir=$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(TOP) -DCurDir=$(NEW_CURRENT_DIR); \ @@\ + $(NEWTOP)$(JRESTOREDEPS); \ @@\ + $(MAKE) $(MFLAGS) NEWTOP= Makefile Makefiles +#endif /* MakeNsubdirMakefiles */ +\end{code} + +\subsubsection{@MakefileSubdirs@} + +Generate rules to create \tr{Makefiles}. + +\begin{code} +#ifndef MakefileSubdirs +#define MakefileSubdirs(dirs) @@\ +MakeMakeSubdirs(dirs,Makefiles) @@\ + @@\ +MakeNsubdirMakefiles() +#endif /* MakefileSubdirs */ +\end{code} + +\begin{code} +#ifndef MakeDirectories +#define MakeDirectories(step,dirs) @@\ +step:: @@\ + $(MKDIRHIER) dirs +#endif +\end{code} + +\begin{code} +#ifndef LinkDirectories +#define LinkDirectories(step,dirs,todir) @@\ +step:: @@\ + @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ @@\ + for i in dirs ; \ @@\ + do \ @@\ + echo "linking $$i to" todir; \ @@\ + $(LNDIR) todir $$i; \ @@\ + done +#endif +\end{code} diff --git a/web/glasgow/lit2x-0.16/mkworld/plat-DEF.jm b/web/glasgow/lit2x-0.16/mkworld/plat-DEF.jm new file mode 100644 index 0000000000..bcdbb93eea --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/plat-DEF.jm @@ -0,0 +1,27 @@ +# line 8 "plat-DEF.ljm" +#ifndef OSMajorVersion +#define OSMajorVersion 0 +#endif +#ifndef OSMinorVersion +#define OSMinorVersion 0 +#endif + +#ifndef HasExecableScripts +#define HasExecableScripts YES /* can execute scripts with #! */ +#endif + +#ifndef ConstructMFLAGS +#define ConstructMFLAGS NO /* build MFLAGS from MAKEFLAGS */ +#endif +#if ConstructMFLAGS +MFLAGS = -$(MAKEFLAGS) +#endif + +#ifndef BourneShell /* to force shell in Makefile */ +#define BourneShell /bin/sh +#endif +SHELL = BourneShell +# line 35 "plat-DEF.ljm" +#ifndef CppHaveSysVishTimesH +#define CppHaveSysVishTimesH /*nothing*/ +#endif diff --git a/web/glasgow/lit2x-0.16/mkworld/plat-DEF.ljm b/web/glasgow/lit2x-0.16/mkworld/plat-DEF.ljm new file mode 100644 index 0000000000..a4d1051222 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/plat-DEF.ljm @@ -0,0 +1,38 @@ +%************************************************************************ +%* * +\section[mkworld-plat-GEN]{{\em Defaults} for platform-specific things} +%* * +%************************************************************************ + +\begin{code} +#ifndef OSMajorVersion +#define OSMajorVersion 0 +#endif +#ifndef OSMinorVersion +#define OSMinorVersion 0 +#endif + +#ifndef HasExecableScripts +#define HasExecableScripts YES /* can execute scripts with #! */ +#endif + +#ifndef ConstructMFLAGS +#define ConstructMFLAGS NO /* build MFLAGS from MAKEFLAGS */ +#endif +#if ConstructMFLAGS +MFLAGS = -$(MAKEFLAGS) +#endif + +#ifndef BourneShell /* to force shell in Makefile */ +#define BourneShell /bin/sh +#endif +SHELL = BourneShell +\end{code} + +Have System V-ish \tr{times.h}, with \tr{times} routine, rather than +Berkeley-style \tr{time.h} with \tr{ftime}, etc. +\begin{code} +#ifndef CppHaveSysVishTimesH +#define CppHaveSysVishTimesH /*nothing*/ +#endif +\end{code} diff --git a/web/glasgow/lit2x-0.16/mkworld/plat-TRIGGERS.jm b/web/glasgow/lit2x-0.16/mkworld/plat-TRIGGERS.jm new file mode 100644 index 0000000000..4ccac86ea8 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/plat-TRIGGERS.jm @@ -0,0 +1,50 @@ +# line 1 "plat-TRIGGERS.ljm" +# line 29 "plat-TRIGGERS.ljm" +#ifdef sun +#define PlatformFile plat-sun.jm +#define PlatformIncludeFile <plat-sun.jm> + +#undef sun +#define SunArchitecture +#endif /* sun */ +# line 45 "plat-TRIGGERS.ljm" +#ifdef linux +#define PlatformFile plat-linux.jm +#define PlatformIncludeFile <plat-linux.jm> + +#undef linux +#define LinuxArchitecture +#endif /* linux */ +# line 61 "plat-TRIGGERS.ljm" +#if defined(__alpha) && defined(__osf__) +#define PlatformFile plat-alpha.jm +#define PlatformIncludeFile <plat-alpha.jm> + +#undef __alpha +#undef __osf__ +#define AlphaArchitecture +#endif /* alpha */ +# line 85 "plat-TRIGGERS.ljm" +#ifdef mipsriscos +#define PlatformFile plat-mipsriscos.jm +#define PlatformIncludeFile <plat-mipsriscos.jm> + +#undef mipsriscos +#undef mips +#define MipsRiscosArchitecture /* for OS type */ +#define MipsArchitecture /* for chipset type */ +/* now a dubious HostPlatform definition (there are various "mips" machines) ... */ + +/* ToDo: I admit these are done to suit the Glasgow /bin/arch */ +/* It should probably be "umips" or "umipse[bl]", as appropriate */ +#ifdef SYSTYPE_SYSV +#define HostPlatform mips3000 +#else +#define HostPlatform mips +#endif +#endif /* mipsriscos */ +# line 258 "plat-TRIGGERS.ljm" +#ifndef PlatformIncludeFile +#define PlatformFile could-not-determine-the-platform-from-trigger-symbols +#define PlatformIncludeFile PlatformFile +#endif diff --git a/web/glasgow/lit2x-0.16/mkworld/plat-TRIGGERS.ljm b/web/glasgow/lit2x-0.16/mkworld/plat-TRIGGERS.ljm new file mode 100644 index 0000000000..74fbc927d9 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/plat-TRIGGERS.ljm @@ -0,0 +1,290 @@ +%************************************************************************ +%* * +\section[mkworld-plat-TRIGGERS]{Detecting the ``trigger symbol'' for this platform} +%* * +%************************************************************************ + +See the end of this section for how to add support for another platform. + +Note: Only a handful of platforms have been tested with these +configuration files (ToDo). + +You do basically three things here: +\begin{enumerate} +\item +Set @PlatformFile@, etc. +\item +Turn {\em off} any vendor-supplied ``this-is-a-BLAH'' symbol(s). +\item +Turn {\em on} our own ``this-is-a-FOO-Architecture'' symbol(s). +\end{enumerate} + +%************************************************************************ +%* * +\subsection[trigger-Sun]{Trigger stuff for Suns} +%* * +%************************************************************************ + +\begin{code} +#ifdef sun +#define PlatformFile plat-sun.jm +#define PlatformIncludeFile <plat-sun.jm> + +#undef sun +#define SunArchitecture +#endif /* sun */ +\end{code} + +%************************************************************************ +%* * +\subsection[trigger-Linux]{Trigger stuff for Linux} +%* * +%************************************************************************ + +\begin{code} +#ifdef linux +#define PlatformFile plat-linux.jm +#define PlatformIncludeFile <plat-linux.jm> + +#undef linux +#define LinuxArchitecture +#endif /* linux */ +\end{code} + +%************************************************************************ +%* * +\subsection[trigger-Alpha]{Trigger stuff for DEC Alpha running OSF1} +%* * +%************************************************************************ + +\begin{code} +#if defined(__alpha) && defined(__osf__) +#define PlatformFile plat-alpha.jm +#define PlatformIncludeFile <plat-alpha.jm> + +#undef __alpha +#undef __osf__ +#define AlphaArchitecture +#endif /* alpha */ +\end{code} + +%************************************************************************ +%* * +\subsection[trigger-MIPS-RiscOS]{Trigger stuff for MIPS machines running RISCos} +%* * +%************************************************************************ + +OLD: OLD: OLD: + +@mipsriscos@ used instead of @riscos@ because another company (Acorn +Computers Ltd in the UK) has a RISC OS... MIPS RISC/os cpp has no +unique symbol: build @jmake@ with +@BOOTSTRAPCFLAGS=-Dmipsriscos@ + +\begin{code} +#ifdef mipsriscos +#define PlatformFile plat-mipsriscos.jm +#define PlatformIncludeFile <plat-mipsriscos.jm> + +#undef mipsriscos +#undef mips +#define MipsRiscosArchitecture /* for OS type */ +#define MipsArchitecture /* for chipset type */ +/* now a dubious HostPlatform definition (there are various "mips" machines) ... */ + +/* ToDo: I admit these are done to suit the Glasgow /bin/arch */ +/* It should probably be "umips" or "umipse[bl]", as appropriate */ +#ifdef SYSTYPE_SYSV +#define HostPlatform mips3000 +#else +#define HostPlatform mips +#endif +#endif /* mipsriscos */ +\end{code} + +%************************************************************************ +%* * +\subsection[triggers-UNTESTED]{Untested trigger stuff for other machines} +%* * +%************************************************************************ + +COMPLETELY UNTESTED (and so commented out): + +\begin{pseudocode} +#ifdef ultrix +#define PlatformIncludeFile <ultrix.cf> +#define PlatformFile ultrix.cf +#ifdef vax +#undef vax +#define VaxArchitecture +/* hypothetical HostPlatform; we do not have one */ +#define HostPlatform vax +#endif /* vax */ +#ifdef mips +#undef mips +#define MipsArchitecture +/* hypothetical HostPlatform; we do not have one */ +#define HostPlatform pmax +#endif /* mips */ +#undef ultrix +#define UltrixArchitecture +#endif /* ultrix */ + +#if defined(vax) && !defined(UltrixArchitecture) +#define PlatformIncludeFile <bsd.cf> +#define PlatformFile bsd.cf +#undef vax +#define VaxArchitecture +#endif +\end{pseudocode} + +\begin{pseudocode} +#ifdef hpux +#define PlatformIncludeFile <hp.cf> +#define PlatformFile hp.cf +#undef hpux +#define HPArchitecture +#endif /* hpux */ + +#ifdef att +#define PlatformIncludeFile <att.cf> +#define PlatformFile att.cf +#undef att +#define ATTArchitecture +#endif /* att */ + +#ifdef apollo +#define PlatformIncludeFile <apollo.cf> +#define PlatformFile apollo.cf +#undef apollo +#define ApolloArchitecture +#endif /* apollo */ + +#ifdef sony +#define PlatformIncludeFile <sony.cf> +#define PlatformFile sony.cf +#undef sony +#define SonyArchitecture +#endif /* sony */ + +#ifdef M4310 +#define PlatformIncludeFile <pegasus.cf> +#define PlatformFile pegasus.cf +#undef M4310 +#define PegasusArchitecture +#endif /* M4310 */ + +#ifdef M4330 +#define PlatformIncludeFile <m4330.cf> +#define PlatformFile m4330.cf +#undef M4330 +#define M4330Architecture +#endif /* M4330 */ + +#ifdef macII +/* A/UX cpp has no unique symbol: build jmake with BOOTSTRAPCFLAGS=-DmacII */ +#define PlatformIncludeFile <macII.cf> +#define PlatformFile macII.cf +#undef macII +#define MacIIArchitecture +#endif /* macII */ + +#ifdef CRAY +#define PlatformIncludeFile <cray.cf> +#define PlatformFile cray.cf +#undef cray +#undef CRAY +#define CrayArchitecture +#endif /* CRAY */ + +#ifdef sgi +#define PlatformIncludeFile <sgi.cf> +#define PlatformFile sgi.cf +#undef sgi +#define SGIArchitecture +#undef mips +#define MipsArchitecture +#endif + +#ifdef stellar +#define PlatformIncludeFile <stellar.cf> +#define PlatformFile stellar.cf +#undef stellar +#define StellarArchitecture +#endif + +/* + * A convenience for people running on rt's since they define ibm032, and for + * people running AIX (note that AOS will no longer be supported by IBM). + */ +#if defined(ibm032) && !defined(ibm) +#define ibm +#endif + +#if defined(aix) && !defined(ibm) +#define ibm +#endif + +#if defined(ibm) +#define PlatformIncludeFile <ibm.cf> +#define PlatformFile ibm.cf +#undef ibm +#define IBMArchitecture +#ifdef i386 +#undef i386 +#define PS2Architecture +#endif +#ifdef ibm032 +#undef ibm032 +#define RtArchitecture +#endif +#ifdef aix +#undef aix +#define AIXArchitecture +#endif +#endif /* ibm */ +\end{pseudocode} + +%************************************************************************ +%* * +\subsection[triggers-failed]{If no trigger symbol worked...} +%* * +%************************************************************************ + +We don't allow guessing at the platform: this will bomb gruesomely in +short order; it might mean that @BOOTSTRAPCFLAGS@ was not set when +building @jmake@. +\begin{code} +#ifndef PlatformIncludeFile +#define PlatformFile could-not-determine-the-platform-from-trigger-symbols +#define PlatformIncludeFile PlatformFile +#endif +\end{code} + +%************************************************************************ +%* * +\subsection[triggers-adding-platform]{To add support for another platform...} +%* * +%************************************************************************ + +\begin{enumerate} +\item +Identify a machine-specific CPP (``trigger'') symbol. If your preprocessor +doesn't have any built in, you'll need to add the symbol to the +@cpp_argv@ table in \tr{utils/jmake/jmake.c} and rebuild @jmake@ with the +@BOOTSTRAPCFLAGS@ variable set (see the macII for an example). + +\item +Add all machine-specific CPP symbols (either defined by you or by +the preprocessor or compiler) to the @predefs@ table in +@util/makedepend/main.c@. + +\item +Put a new \tr{#ifdef} block above that defines @PlatformIncludeFile@, +@PlatformFile@, etc., for your new platform and then @#undefs@ the +machine-specific preprocessor symbols (to avoid problems with file +names). + +\item +Create suitable \tr{*.jm} files (or ``literate'' equivalents). +\end{enumerate} diff --git a/web/glasgow/lit2x-0.16/mkworld/plat-alpha.jm b/web/glasgow/lit2x-0.16/mkworld/plat-alpha.jm new file mode 100644 index 0000000000..47c16c49d6 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/plat-alpha.jm @@ -0,0 +1,20 @@ +# line 8 "plat-alpha.ljm" +#define HostPlatform alpha + +#define OSName OSF1 +#define OSMajorVersion 1 +#define OSMinorVersion 2 + +#define HasSysVishArAndRanlib YES + +#define CppHaveSysVishTimesH -DHAVE_SYSV_ISH_TIMES_H + +BUILDPLATFORM=HostPlatform + +/* Whenever we run the "std C compiler", give it this flag + (not really platform-ish, but a convenient place to put it) +*/ +#define PlatformCcOpts -ansi -Wall /* full ANSI, please */ + +/* temp: just for debugging */ +#define GhcNormalHighLevelAsmDefaultOpts ('-ansi') diff --git a/web/glasgow/lit2x-0.16/mkworld/plat-alpha.ljm b/web/glasgow/lit2x-0.16/mkworld/plat-alpha.ljm new file mode 100644 index 0000000000..e06129c19b --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/plat-alpha.ljm @@ -0,0 +1,27 @@ +%************************************************************************ +%* * +\section[mkworld-plat-alpha]{Platform configuration stuff for DEC Alpha} +%* * +%************************************************************************ + +\begin{code} +#define HostPlatform alpha + +#define OSName OSF1 +#define OSMajorVersion 1 +#define OSMinorVersion 2 + +#define HasSysVishArAndRanlib YES + +#define CppHaveSysVishTimesH -DHAVE_SYSV_ISH_TIMES_H + +BUILDPLATFORM=HostPlatform + +/* Whenever we run the "std C compiler", give it this flag + (not really platform-ish, but a convenient place to put it) +*/ +#define PlatformCcOpts -ansi -Wall /* full ANSI, please */ + +/* temp: just for debugging */ +#define GhcNormalHighLevelAsmDefaultOpts ('-ansi') +\end{code} diff --git a/web/glasgow/lit2x-0.16/mkworld/plat-linux.jm b/web/glasgow/lit2x-0.16/mkworld/plat-linux.jm new file mode 100644 index 0000000000..56969a3aab --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/plat-linux.jm @@ -0,0 +1,26 @@ +# line 11 "plat-linux.ljm" +#undef i386 /* move to trigger file? (ToDo) */ + +#define iX86Architecture YES +#define i486Architecture YES + +#define HostPlatform i486 + +#define LinuxOSPlatform YES +#define OSName Linux 0.99 +#define OSMajorVersion 0 +#define OSMinorVersion 99 +#define HaveGcc YES /* nothing else on linux... */ + +BUILDPLATFORM=HostPlatform + +/* Whenever we run the "std C compiler", give it this flag */ +#define PlatformCcOpts -m486 + +/*----------------------------------------------------------------------------- + Added by simonm... +-----------------------------------------------------------------------------*/ + +#define MakeCmd make -r /* make ignores implicit rules */ + +/* #define UseFlexForLexCmd we've only got flex on Linux */ diff --git a/web/glasgow/lit2x-0.16/mkworld/plat-linux.ljm b/web/glasgow/lit2x-0.16/mkworld/plat-linux.ljm new file mode 100644 index 0000000000..d176614831 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/plat-linux.ljm @@ -0,0 +1,36 @@ +%************************************************************************ +%* * +\section[mkworld-plat-linus]{Linux-specific configuration stuff} +%* * +%************************************************************************ + +[This file prepared by Andr\'e Santos, the Linux Functional +Programming King (andre\@dcs.glasgow.ac.uk).] + +\begin{code} +#undef i386 /* move to trigger file? (ToDo) */ + +#define iX86Architecture YES +#define i486Architecture YES + +#define HostPlatform i486 + +#define LinuxOSPlatform YES +#define OSName Linux 0.99 +#define OSMajorVersion 0 +#define OSMinorVersion 99 +#define HaveGcc YES /* nothing else on linux... */ + +BUILDPLATFORM=HostPlatform + +/* Whenever we run the "std C compiler", give it this flag */ +#define PlatformCcOpts -m486 + +/*----------------------------------------------------------------------------- + Added by simonm... +-----------------------------------------------------------------------------*/ + +#define MakeCmd make -r /* make ignores implicit rules */ + +/* #define UseFlexForLexCmd we've only got flex on Linux */ +\end{code} diff --git a/web/glasgow/lit2x-0.16/mkworld/plat-mipsriscos.jm b/web/glasgow/lit2x-0.16/mkworld/plat-mipsriscos.jm new file mode 100644 index 0000000000..472a264fa7 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/plat-mipsriscos.jm @@ -0,0 +1,51 @@ +# line 50 "plat-mipsriscos.ljm" +/* + SET VERSION NUMBERS BEFORE MAKING MAKEFILES +*/ + +#define OSMajorVersion 4 +#define OSMinorVersion 51 + +#define CCompilerMajorVersion 2 +#define CCompilerMinorVersion 11 + + +#define BootstrapCFlags -Dmipsriscos + +/* + For BSD environment, need -ltermcap for v?printf. It's not in + the BSD C library! (Yet.) +*/ + +#define InstallCmd /etc/mipsinstall +#define InstFileFlags -f + +#ifndef UsrLibDir +#if SystemV +#define UsrLibDir /usr/lib +#else +#define UsrLibDir /usr/bsd43/usr/lib +#endif +#endif + +#ifndef IncludeRoot +#if SystemV +#define IncludeRoot /usr/include +#else +#define IncludeRoot /usr/include/bsd43 +#endif +#endif + +#define HasVarargs YES +/* + Make sure to use signal semantics that are consistent with + the compilation environment. +*/ +#if SystemV +#define HasVoidSignalReturn YES +#else +#define HasVoidSignalReturn NO +#endif + +/* does this work? or can it be done better? ToDo */ +BUILDPLATFORM=HostPlatform diff --git a/web/glasgow/lit2x-0.16/mkworld/plat-mipsriscos.ljm b/web/glasgow/lit2x-0.16/mkworld/plat-mipsriscos.ljm new file mode 100644 index 0000000000..1bb5496856 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/plat-mipsriscos.ljm @@ -0,0 +1,100 @@ +%************************************************************************ +%* * +\section[mkworld-plat-mipsriscos]{Configuration stuff for MIPS machines running RISCos} +%* * +%************************************************************************ + +Derived from the Paul DuBois's configuration stuff. + +NOTES: + +The MIPS RISC/os modifications are for MIPS machines running RISC/os 4.0 +or later. + +To make makefiles for RISC/os you MUST set your environment +variable JMAKEINCLUDE: + setenv JMAKEINCLUDE "-I. -Dmipsriscos -DSYSTYPE_SYSV" + (or) setenv JMAKEINCLUDE "-I. -Dmipsriscos -DSYSTYPE_BSD" +as appropriate. Cpp does not set these on RISC/os; cc does, but cc is not used +with jmake. + +For RISC/os it is important that the compiler, linker, include files and +libraries be compatible with each other. This can mostly be taken care of +by specifying the -systype {sysv,bsd43} option in the definition of CcCmd, +which will alert the compiler which versions of itself, the linker and +libraries are to be used, and for the most part, the proper include files. +This works whether your PATH setting causes /bin/cc or /usr/bsd43/bin/cc +to be found first. (-systype cannot be specified in StandardCppDefines, +because those get passed to makedepend, and makedepend gets confused +because -systype takes a following argument.) + +If installed versions of jmake or makedepend are used, it is important +that they have been compiled in the same environment as that used to +compile this project, or you will get sysv/bsd conflicts. It may be +best to compile them for both environments and install in /usr/bin and +/bsd43/usr/bin as appropriate. + +The compiled version of makedepend works properly subject to the above +caveat, and is much faster than the script version. The script version +(define UseCCMakeDepend) always works and needs no special hacking to know +about compilation environment, but it's slower. It also generates warnings +about "--" and -O which can be ignored. util/makedepend/Jmakefile was hacked +from the X11R4 release to recognize how to set INCLUDEDIR properly for RISC/os. + +The Jmakefiles contain commands to format the man pages and install them as +required; however since RISC/os does not include nroff this will typically +not be effective. If you have the BSD or DWB packages installed, you may +be in better shape. + +\begin{code} +/* + SET VERSION NUMBERS BEFORE MAKING MAKEFILES +*/ + +#define OSMajorVersion 4 +#define OSMinorVersion 51 + +#define CCompilerMajorVersion 2 +#define CCompilerMinorVersion 11 + + +#define BootstrapCFlags -Dmipsriscos + +/* + For BSD environment, need -ltermcap for v?printf. It's not in + the BSD C library! (Yet.) +*/ + +#define InstallCmd /etc/mipsinstall +#define InstFileFlags -f + +#ifndef UsrLibDir +#if SystemV +#define UsrLibDir /usr/lib +#else +#define UsrLibDir /usr/bsd43/usr/lib +#endif +#endif + +#ifndef IncludeRoot +#if SystemV +#define IncludeRoot /usr/include +#else +#define IncludeRoot /usr/include/bsd43 +#endif +#endif + +#define HasVarargs YES +/* + Make sure to use signal semantics that are consistent with + the compilation environment. +*/ +#if SystemV +#define HasVoidSignalReturn YES +#else +#define HasVoidSignalReturn NO +#endif + +/* does this work? or can it be done better? ToDo */ +BUILDPLATFORM=HostPlatform +\end{code} diff --git a/web/glasgow/lit2x-0.16/mkworld/plat-sun.jm b/web/glasgow/lit2x-0.16/mkworld/plat-sun.jm new file mode 100644 index 0000000000..7c4a98b539 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/plat-sun.jm @@ -0,0 +1,32 @@ +# line 8 "plat-sun.ljm" +#define SunOSPlatform YES /* set to NO if not running SunOS */ +#define OSName SunOS 4.1 +#define OSMajorVersion 4 +#define OSMinorVersion 1 + +#if OSMajorVersion >=4 && OSMinorVersion >= 1 +#define ConstructMFLAGS 1 +#endif + +#if OSMajorVersion >= 4 +#define HasSunOSSharedLibraries YES +#endif + +#if defined(sparc) || defined(__sparc) || defined(__sparc__) +#undef sparc +#undef __sparc +#undef __sparc__ + +#define SparcArchitecture +/* HostPlatform should probably be "sparc" but this suits Glasgow /bin/arch */ +#define HostPlatform sun4 + +#else /* ! sparc */ + +/* OK, a wild guess ... */ +#define m68kArchitecture +#define HostPlatform sun3 + +#endif /* ! sparc */ + +BUILDPLATFORM=HostPlatform diff --git a/web/glasgow/lit2x-0.16/mkworld/plat-sun.ljm b/web/glasgow/lit2x-0.16/mkworld/plat-sun.ljm new file mode 100644 index 0000000000..1b11184366 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/plat-sun.ljm @@ -0,0 +1,39 @@ +%************************************************************************ +%* * +\section[mkworld-plat-sun]{Sun-specific configuration stuff} +%* * +%************************************************************************ + +\begin{code} +#define SunOSPlatform YES /* set to NO if not running SunOS */ +#define OSName SunOS 4.1 +#define OSMajorVersion 4 +#define OSMinorVersion 1 + +#if OSMajorVersion >=4 && OSMinorVersion >= 1 +#define ConstructMFLAGS 1 +#endif + +#if OSMajorVersion >= 4 +#define HasSunOSSharedLibraries YES +#endif + +#if defined(sparc) || defined(__sparc) || defined(__sparc__) +#undef sparc +#undef __sparc +#undef __sparc__ + +#define SparcArchitecture +/* HostPlatform should probably be "sparc" but this suits Glasgow /bin/arch */ +#define HostPlatform sun4 + +#else /* ! sparc */ + +/* OK, a wild guess ... */ +#define m68kArchitecture +#define HostPlatform sun3 + +#endif /* ! sparc */ + +BUILDPLATFORM=HostPlatform +\end{code} diff --git a/web/glasgow/lit2x-0.16/mkworld/site-DEF.jm b/web/glasgow/lit2x-0.16/mkworld/site-DEF.jm new file mode 100644 index 0000000000..4e9fab42a9 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/site-DEF.jm @@ -0,0 +1,45 @@ +# line 1 "site-DEF.ljm" +# line 8 "site-DEF.ljm" +/* TopDir and CurDir likely defined on command line */ +#ifndef TopDir +#define TopDir . +#endif +TOP = TopDir + +#ifndef TopDirPwd +#define TopDirPwd / +#endif +TOP_PWD = TopDirPwd /* absolute pathname of TOP */ + +#ifndef CurDir +#define CurDir . +#endif +CURRENT_DIR = CurDir + +#ifndef TmpDir /* I do not know why this was /usr/tmp */ +#define TmpDir /tmp +#endif +TMPDIR = TmpDir /* temporary files */ + +#ifndef BootstrapCFlags +#define BootstrapCFlags /*none*/ +#endif +BOOTSTRAPCFLAGS = BootstrapCFlags /* set if cpp doesn't have uniq sym */ +# line 36 "site-DEF.ljm" +#ifndef ManDirectoryRoot +#define ManDirectoryRoot /usr/man +#endif + +#ifndef DefaultInfoPath +#define DefaultInfoPath /usr/local/lib/info:. +#endif + +#ifndef IncludeTestDirsInBuild +#define IncludeTestDirsInBuild NO +#endif + +/* Misc. misc. */ + +#ifndef RemoveTargetByMoving +#define RemoveTargetByMoving NO /* affects Jmake.rules */ +#endif diff --git a/web/glasgow/lit2x-0.16/mkworld/site-DEF.ljm b/web/glasgow/lit2x-0.16/mkworld/site-DEF.ljm new file mode 100644 index 0000000000..368542dea0 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/site-DEF.ljm @@ -0,0 +1,53 @@ +%************************************************************************ +%* * +\section[mkworld-site-GEN]{{\em Defaults} for site-selectable things} +%* * +%************************************************************************ + +\begin{code} +/* TopDir and CurDir likely defined on command line */ +#ifndef TopDir +#define TopDir . +#endif +TOP = TopDir + +#ifndef TopDirPwd +#define TopDirPwd / +#endif +TOP_PWD = TopDirPwd /* absolute pathname of TOP */ + +#ifndef CurDir +#define CurDir . +#endif +CURRENT_DIR = CurDir + +#ifndef TmpDir /* I do not know why this was /usr/tmp */ +#define TmpDir /tmp +#endif +TMPDIR = TmpDir /* temporary files */ + +#ifndef BootstrapCFlags +#define BootstrapCFlags /*none*/ +#endif +BOOTSTRAPCFLAGS = BootstrapCFlags /* set if cpp doesn't have uniq sym */ +\end{code} + +\begin{code} +#ifndef ManDirectoryRoot +#define ManDirectoryRoot /usr/man +#endif + +#ifndef DefaultInfoPath +#define DefaultInfoPath /usr/local/lib/info:. +#endif + +#ifndef IncludeTestDirsInBuild +#define IncludeTestDirsInBuild NO +#endif + +/* Misc. misc. */ + +#ifndef RemoveTargetByMoving +#define RemoveTargetByMoving NO /* affects Jmake.rules */ +#endif +\end{code} diff --git a/web/glasgow/lit2x-0.16/mkworld/site.dist b/web/glasgow/lit2x-0.16/mkworld/site.dist new file mode 100644 index 0000000000..94b8c9a109 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/site.dist @@ -0,0 +1,147 @@ +/************************************************************************ + +General site-specific configuration information: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This is where _general_ facts about your local computing environment +are recorded. + +_Project-specific_ facts go in "site-<project>.jm", and facts specific +to a ``setup'' of a project (unlikely...) go in +"site-<project>-<setup>.jm". + +As you will see, the general style for setting these configuration facts is: + + #ifndef ABuildParameter + #define ABuildParameter myvalue + #endif + +This particular file is for the Computing Science Dept at Glasgow +University. +************************************************************************/ + +#ifndef PerlCmd +#if defined(LinuxOSPlatform) +#define PerlCmd /usr/bin/perl +#else +#define PerlCmd /usr/local/bin/perl +#endif /* ! Linux */ +#endif /* PerlCmd */ + +/* For "make tags", we recommend "etags" from the Emacs distribution. + (we supply a variant in the GHC distribution; grasp-utils/etags) + If not readily available on your search PATH, say where to find it here. + */ +#ifndef CTagsCmd +#define CTagsCmd $(ETAGS) +#endif + +/* + * Site-specific compiler things: for Glasgow + */ + +/* --------------- C compiler --------------------------------- */ +/* we have gcc [by which we mean version 2.n] for sun4s and sun3s; + IT IS GOOD TO SAY `YES' ! + (It is *essential* for the Glasgow Haskell compiler) + */ +#ifndef HaveGcc +#if defined(SparcArchitecture) \ + || defined(m68kArchitecture) \ + || defined(AlphaArchitecture) \ + || defined(LinuxOSPlatform) +#define HaveGcc YES +#else +#define HaveGcc NO +#endif /* ! one of those */ +#endif /* ! HaveGcc */ + +#ifndef WhatGccIsCalled /* version 2.n, please */ +#if defined(m68kArchitecture) +#define WhatGccIsCalled gcc-m68k /* to tell the truth, we cross-compile */ +#else +#define WhatGccIsCalled gcc +#endif /* m68k */ +#endif /* ! WhatGccIsCalled */ + +/* Set UseGcc to YES if you want to use it for "ordinary" C compilations. + YES, by default. "UseGcc" *and* "HaveGcc" both have to be YES for + anything to happen. + + This is *independent* of whether you set "UseGccForNormalGhcAsm" + and/or "UseGccForOptGhcAsm", which are GHC-specific. +*/ + +#if ! defined(UseGcc) && HaveGcc == YES +#define UseGcc YES +#endif /* ! UseGcc */ + +/* --------------- "standard" Haskell compiler --------------------------- */ + +/* What do we *have*? + We have Chalmers "hbc" for sun4s + We have Glasgow Haskell (called "glhc" at Glasgow) for sun4s and sun3s +*/ +#ifndef HaveChalmersHBC +#if defined(SparcArchitecture) \ + || defined(LinuxOSPlatform) +#define HaveChalmersHBC YES +#else +#define HaveChalmersHBC NO +#endif /* ! one of those */ +#endif /* ! HaveChalmersHBC */ + +#ifndef HaveGlasgowHaskell +#if defined(m68kArchitecture) \ + || defined(SparcArchitecture) \ + || defined(AlphaArchitecture) +#define HaveGlasgowHaskell YES +#else +#define HaveGlasgowHaskell NO +#endif /* ! m68k or sparc */ +#endif /* ! HaveGlasgowHaskell */ + +#ifndef WhatGhcIsCalled /* Glasgow Haskell compiler */ +#define WhatGhcIsCalled ghc +#endif + +/* What do we *use* for our "standard Haskell compiler"? + A "setup" may very well set this (mkworld/site-<project>-<setup>.jm); + the default is Glasgow Haskell. +*/ +#if !defined(UseGlasgowHaskell) && !defined(UseChalmersHBC) +#define UseGlasgowHaskell YES +#endif + +/* Finally: set "HaskellCompileCmd" (your "standard Haskell compiler") +*/ +#ifndef HaskellCompileCmd +#if HaveGlasgowHaskell == YES && UseGlasgowHaskell == YES +#define HaskellCompileCmd WhatGhcIsCalled +#else /* ! ...GlasgowHaskell */ +#if HaveChalmersHBC == YES && UseChalmersHBC == YES +#define HaskellCompileCmd hbc +#else +#define HaskellCompileCmd no_default_haskell_compiler_defined +#endif /* ! ...ChalmersHBC */ +#endif /* ! ...GlasgowHaskell */ +#endif /* ! HaskellCompileCmd */ + +/* --------------- V misc stuff --------------------------- */ + +/* Your main directory for GNU Info files should come first. + If in doubt, get an Emacs person to do "C-h v Info-directory" + to tell you where Emacs looks for Info files. +*/ +#ifndef DefaultInfoPath +#if defined(LinuxOSPlatform) +#define DefaultInfoPath /usr/emacs/info:. +#else +#define DefaultInfoPath /local/doc/info:. +#endif +#endif + +/* ugly, ain't it ? */ +#ifndef TgrindHelperCmd +#define TgrindHelperCmd /usr/local/tex/lib/tgrind/HostPlatform/tfontedpr +#endif diff --git a/web/glasgow/lit2x-0.16/mkworld/suffixes-GEN.jm b/web/glasgow/lit2x-0.16/mkworld/suffixes-GEN.jm new file mode 100644 index 0000000000..8a399a7ac5 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/suffixes-GEN.jm @@ -0,0 +1,154 @@ +# line 31 "suffixes-GEN.ljm" +#ifndef LitSuffixRule +#define LitSuffixRule(beforesuff,aftersuff) @@\ +CAT2(beforesuff,aftersuff): @@\ + $(RM) $@ @@\ + $(LIT2PGM) $(LIT2PGMFLAGS) -o $@ $< @@\ + @chmod 444 $@ @@\ + @@\ +beforesuff.itxi: @@\ + $(RM) $@ @@\ + $(LIT2TEXI) -c $(LIT2TEXIFLAGS) -o $@ $< @@\ + @chmod 444 $@ @@\ + @@\ +beforesuff.itex: @@\ + $(RM) $@ @@\ + $(LIT2LATEX) -c $(LIT2LATEXFLAGS) -o $@ $< @@\ + @chmod 444 $@ +#endif /* LitSuffixRule */ +# line 59 "suffixes-GEN.ljm" +#ifndef NormalLibraryObjectRule +#define NormalLibraryObjectRule() @@\ +.c.o: @@\ + RemoveTarget ($@) @@\ + $(CC) -c $(CFLAGS) $*.c +#endif +# line 84 "suffixes-GEN.ljm" +#ifndef HaskellSuffixRules +#define HaskellSuffixRules() @@\ +SuffixRule_o_hi() @@\ +SuffixRule_lhs_o() @@\ +SuffixRule_hs_o() +#endif /* !HaskellSuffixRules */ +# line 97 "suffixes-GEN.ljm" +#ifndef SuffixRule_o_hi +#define SuffixRule_o_hi() @@\ +.o.hi: @@\ + @if [ ! -f $@ ] ; then \ @@\ + echo $(RM) $< ; \ @@\ + $(RM) $< ; \ @@\ + set +e ; \ @@\ + echo $(MAKE) HC="$(HC)" HCFLAGS="$(HCFLAGS)" $(MFLAGS) $< ; \ @@\ + $(MAKE) HC="$(HC)" HCFLAGS="$(HCFLAGS)" $(MFLAGS) $< ; \ @@\ + if [ $$? -ne 0 ] ; then \ @@\ + exit 1; \ @@\ + fi ; \ @@\ + fi +#endif /* !SuffixRule_o_hi */ +# line 114 "suffixes-GEN.ljm" +#ifndef SuffixRule_hs_o +#define SuffixRule_hs_o() @@\ +.hs.o: \ +_body_HaskellCompileWithSpecifiedFlags($<,$*,hs,-c $(HCFLAGS)) +#endif /* !SuffixRule_hs_o */ + +#ifndef SuffixRule_lhs_o +#define SuffixRule_lhs_o() @@\ +.lhs.o: \ +_body_HaskellCompileWithSpecifiedFlags($<,$*,lhs,-c $(HCFLAGS)) +#endif /* !SuffixRule_lhs_o */ +# line 136 "suffixes-GEN.ljm" +#ifndef DocProcessingSuffixRules +#define DocProcessingSuffixRules() @@\ +.tex.dvi: @@\ + $(RM) $@ @@\ + $(LTX) $< @@\ + @@\ +.verb.tex: @@\ + $(RM) $*.tex @@\ + expand $*.verb | $(VERBATIM) > $*.tex @@\ + @@\ +.tib.tex: @@\ + $(RM) $*.tex $*.verb-t.tex @@\ + $(TIB) $*.tib @@\ + expand $*.tib-t.tex | $(VERBATIM) > $*.tex @@\ + $(RM) $*.tib-t.tex @@\ + @@\ +.fig.ps: @@\ + $(RM) $@ @@\ + fig2dev -L ps $< $@ @@\ + @@\ +.fig.tex: @@\ + $(RM) $@ @@\ + fig2dev -L latex $< $@ + +#endif /* ! DocProcessingSuffixRules */ +# line 170 "suffixes-GEN.ljm" +.SUFFIXES: .xdvi .ps .dvi .tex .fig .tib .verb .itex .itxi .lit \ + _p.o .o .s .hi .hc .lhc .lhs .hs \ + .prl .lprl \ + .sh .lsh \ + .c .lc .h .lh .lex .llex .y \ + .ljm .jm +# line 185 "suffixes-GEN.ljm" +.s.o: + $(RM) $@ + $(AS) $(ASFLAGS) -o $@ $< || $(RM) $@ +# line 200 "suffixes-GEN.ljm" +LitSuffixRule(.ljm,.jm) /* mkworld */ + +#if SuffixRules_WantLiterate == YES + +LitSuffixRule(.lit,/*none*/) /* no language really */ +LitSuffixRule(.lhs,.hs) /* Haskell */ +LitSuffixRule(.lhc,.hc) /* Haskell assembler (C) */ +LitSuffixRule(.lprl,.prl) /* Perl */ +LitSuffixRule(.lsh,.sh) /* Bourne shell */ +LitSuffixRule(.lc,.c) /* C */ +LitSuffixRule(.lh,.h) +LitSuffixRule(.llex,.lex) /* Lex */ + +/* extra rule... flex can't handle #line's yet */ +/* also: save the .lex file in case of some debugging need */ +.llex.c: + $(RM) $@ $*.lex $*.lex.save + $(LIT2PGM) $(LIT2PGMFLAGS) $< > $*.lex + $(FLEX) $*.lex && mv $*.lex $*.lex.save && mv lex.yy.c $*.c + +#endif /* SuffixRules_WantLiterate */ +# line 234 "suffixes-GEN.ljm" +.y.c: + @echo please use an explicit "YaccRunWithExpectMsg" macro + +.lex.c: /* ToDo: should make it do flex */ + $(RM) $@ + $(LEX) -t $(LFLAGS) $< > $@ || ( $(RM) $@ && exit 1 ) +# line 244 "suffixes-GEN.ljm" +#if CCompilerGroksMinusCMinusO == YES +.c.o: + $(RM) $@ + $(CC) $(CFLAGS) -c $< -o $@ +.c.s: + $(RM) $@ + $(CC) $(CFLAGS) -S $< -o $@ + +#else /* ! CCompilerGroksMinusCMinusO */ +.c.o: + $(RM) $@ + $(CC) $(CFLAGS) -c $< + @if [ \( $(@D) != '.' \) -a \( $(@D) != './' \) ] ; then \ + echo mv $(@F) $@ ; \ + mv $(@F) $@ ; \ + fi +.c.s: + $(RM) $@ + $(CC) $(CFLAGS) -S $< + @if [ \( $(@D) != '.' \) -a \( $(@D) != './' \) ] ; then \ + echo mv $(@F) $@ ; \ + mv $(@F) $@ ; \ + fi +#endif /* ! CCompilerGroksMinusCMinusO */ +# line 287 "suffixes-GEN.ljm" +#if SuffixRules_WantDocProcessing == YES +DocProcessingSuffixRules() +#endif /* SuffixRules_WantDocProcessing */ diff --git a/web/glasgow/lit2x-0.16/mkworld/suffixes-GEN.ljm b/web/glasgow/lit2x-0.16/mkworld/suffixes-GEN.ljm new file mode 100644 index 0000000000..ad1fe6d2b7 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/suffixes-GEN.ljm @@ -0,0 +1,290 @@ +%************************************************************************ +%* * +\section[mkworld-suffix-rules]{Default stuff for suffix rules} +%* * +%************************************************************************ + +We are keen on suffix rules, rather than pattern rules, because not +all makes do the latter. Sigh. + +Suffix rules come in three blobs: (1)~the unavoidable ones [few]; +(2)~the ``always for this project'' ones [turn-off-able]; and (3)~the +per-Jmakefile ones (you must ``ask for'' these in each Jmakefile where +you need them. + +%************************************************************************ +%* * +\subsection[mkworld-suffix-macros]{Macros for making up suffix rules} +%* * +%************************************************************************ + +%************************************************************************ +%* * +\subsubsection[mkworld-suffix-macros-literate]{Suffix-rule macros for literate stuff} +%* * +%************************************************************************ + +The following rule generator assumes the @beforesuff->aftersuff@ is +known to the literate programming system. + +\begin{code} +#ifndef LitSuffixRule +#define LitSuffixRule(beforesuff,aftersuff) @@\ +CAT2(beforesuff,aftersuff): @@\ + $(RM) $@ @@\ + $(LIT2PGM) $(LIT2PGMFLAGS) -o $@ $< @@\ + @chmod 444 $@ @@\ + @@\ +beforesuff.itxi: @@\ + $(RM) $@ @@\ + $(LIT2TEXI) -c $(LIT2TEXIFLAGS) -o $@ $< @@\ + @chmod 444 $@ @@\ + @@\ +beforesuff.itex: @@\ + $(RM) $@ @@\ + $(LIT2LATEX) -c $(LIT2LATEXFLAGS) -o $@ $< @@\ + @chmod 444 $@ +#endif /* LitSuffixRule */ +\end{code} + +%************************************************************************ +%* * +\subsubsection[mkworld-suffix-macros-C]{Suffix-rule macros for C} +%* * +%************************************************************************ + +For objects in libraries: these rules are invoked when you want to +override some default suffix rules. +\begin{code} +#ifndef NormalLibraryObjectRule +#define NormalLibraryObjectRule() @@\ +.c.o: @@\ + RemoveTarget ($@) @@\ + $(CC) -c $(CFLAGS) $*.c +#endif +\end{code} + +%************************************************************************ +%* * +\subsubsection[mkworld-suffix-macros-Haskell]{Suffix-rule macros for Haskell} +%* * +%************************************************************************ + +There are several varying flavours of Haskell-related suffix rules; +each such ``set'' of suffix rules should include...: + +\begin{verbatim} +.o -> .hi # hacky pseudo-dependency to mk .hi file if non-existent +.lhs -> .o +.hs -> .o +\end{verbatim} + +This is the {\em default}; a project or setup could override it. +\begin{code} +#ifndef HaskellSuffixRules +#define HaskellSuffixRules() @@\ +SuffixRule_o_hi() @@\ +SuffixRule_lhs_o() @@\ +SuffixRule_hs_o() +#endif /* !HaskellSuffixRules */ +\end{code} + +We use the internal mkworld CPP macro +@_body_HaskellCompileWithSpecifiedFlags@, which is shared w/ other +mkworld stuff. This keeps the magic to exactly one place. + +\begin{code} +#ifndef SuffixRule_o_hi +#define SuffixRule_o_hi() @@\ +.o.hi: @@\ + @if [ ! -f $@ ] ; then \ @@\ + echo $(RM) $< ; \ @@\ + $(RM) $< ; \ @@\ + set +e ; \ @@\ + echo $(MAKE) HC="$(HC)" HCFLAGS="$(HCFLAGS)" $(MFLAGS) $< ; \ @@\ + $(MAKE) HC="$(HC)" HCFLAGS="$(HCFLAGS)" $(MFLAGS) $< ; \ @@\ + if [ $$? -ne 0 ] ; then \ @@\ + exit 1; \ @@\ + fi ; \ @@\ + fi +#endif /* !SuffixRule_o_hi */ +\end{code} + +\begin{code} +#ifndef SuffixRule_hs_o +#define SuffixRule_hs_o() @@\ +.hs.o: \ +_body_HaskellCompileWithSpecifiedFlags($<,$*,hs,-c $(HCFLAGS)) +#endif /* !SuffixRule_hs_o */ + +#ifndef SuffixRule_lhs_o +#define SuffixRule_lhs_o() @@\ +.lhs.o: \ +_body_HaskellCompileWithSpecifiedFlags($<,$*,lhs,-c $(HCFLAGS)) +#endif /* !SuffixRule_lhs_o */ +\end{code} + +%************************************************************************ +%* * +\subsubsection[mkworld-suffix-macros-doc]{Suffix-rule macros for document processing} +%* * +%************************************************************************ + +You have to ask for these. + +\begin{code} +#ifndef DocProcessingSuffixRules +#define DocProcessingSuffixRules() @@\ +.tex.dvi: @@\ + $(RM) $@ @@\ + $(LTX) $< @@\ + @@\ +.verb.tex: @@\ + $(RM) $*.tex @@\ + expand $*.verb | $(VERBATIM) > $*.tex @@\ + @@\ +.tib.tex: @@\ + $(RM) $*.tex $*.verb-t.tex @@\ + $(TIB) $*.tib @@\ + expand $*.tib-t.tex | $(VERBATIM) > $*.tex @@\ + $(RM) $*.tib-t.tex @@\ + @@\ +.fig.ps: @@\ + $(RM) $@ @@\ + fig2dev -L ps $< $@ @@\ + @@\ +.fig.tex: @@\ + $(RM) $@ @@\ + fig2dev -L latex $< $@ + +#endif /* ! DocProcessingSuffixRules */ +\end{code} + +%************************************************************************ +%* * +\subsection[mkworld-suffix-rule-text]{Generate actual suffix-rule text} +%* * +%************************************************************************ + +\begin{code} +.SUFFIXES: .xdvi .ps .dvi .tex .fig .tib .verb .itex .itxi .lit \ + _p.o .o .s .hi .hc .lhc .lhs .hs \ + .prl .lprl \ + .sh .lsh \ + .c .lc .h .lh .lex .llex .y \ + .ljm .jm +\end{code} + +%************************************************************************ +%* * +\subsubsection[mkworld-suffixes-general]{Suffix rules---very general ones} +%* * +%************************************************************************ + +\begin{code} +.s.o: + $(RM) $@ + $(AS) $(ASFLAGS) -o $@ $< || $(RM) $@ +\end{code} + +%************************************************************************ +%* * +\subsubsection[mkworld-suffixes-literate]{Suffix rules for literate programming} +%* * +%************************************************************************ + +The \tr{.ljm->.jm} rule isn't optional, because the mkworld system +uses it. + +\begin{code} +LitSuffixRule(.ljm,.jm) /* mkworld */ + +#if SuffixRules_WantLiterate == YES + +LitSuffixRule(.lit,/*none*/) /* no language really */ +LitSuffixRule(.lhs,.hs) /* Haskell */ +LitSuffixRule(.lhc,.hc) /* Haskell assembler (C) */ +LitSuffixRule(.lprl,.prl) /* Perl */ +LitSuffixRule(.lsh,.sh) /* Bourne shell */ +LitSuffixRule(.lc,.c) /* C */ +LitSuffixRule(.lh,.h) +LitSuffixRule(.llex,.lex) /* Lex */ + +/* extra rule... flex can't handle #line's yet */ +/* also: save the .lex file in case of some debugging need */ +.llex.c: + $(RM) $@ $*.lex $*.lex.save + $(LIT2PGM) $(LIT2PGMFLAGS) $< > $*.lex + $(FLEX) $*.lex && mv $*.lex $*.lex.save && mv lex.yy.c $*.c + +#endif /* SuffixRules_WantLiterate */ +\end{code} + +%************************************************************************ +%* * +\subsubsection[mkworld-suffixes-C]{Suffix rules for C/lex/yacc programming} +%* * +%************************************************************************ + +See also the ``literate lex'' (llex) rule in the literate section, above. + +We don't support the \tr{.y.c} suffix rule; an explicit +@YaccRunWithExpectMsg@ is better. +\begin{code} +.y.c: + @echo please use an explicit "YaccRunWithExpectMsg" macro + +.lex.c: /* ToDo: should make it do flex */ + $(RM) $@ + $(LEX) -t $(LFLAGS) $< > $@ || ( $(RM) $@ && exit 1 ) +\end{code} + +NB: avoid \tr{-o <something>} because of braindead C compilers. +\begin{code} +#if CCompilerGroksMinusCMinusO == YES +.c.o: + $(RM) $@ + $(CC) $(CFLAGS) -c $< -o $@ +.c.s: + $(RM) $@ + $(CC) $(CFLAGS) -S $< -o $@ + +#else /* ! CCompilerGroksMinusCMinusO */ +.c.o: + $(RM) $@ + $(CC) $(CFLAGS) -c $< + @if [ \( $(@D) != '.' \) -a \( $(@D) != './' \) ] ; then \ + echo mv $(@F) $@ ; \ + mv $(@F) $@ ; \ + fi +.c.s: + $(RM) $@ + $(CC) $(CFLAGS) -S $< + @if [ \( $(@D) != '.' \) -a \( $(@D) != './' \) ] ; then \ + echo mv $(@F) $@ ; \ + mv $(@F) $@ ; \ + fi +#endif /* ! CCompilerGroksMinusCMinusO */ +\end{code} + +%************************************************************************ +%* * +\subsubsection[mkworld-suffixes-haskell]{Suffix rules for Haskell programming} +%* * +%************************************************************************ + +Suffix rules for Haskell are {\em not} put in by default. A Jmakefile +must ask for one specifically, using one of the macros defined in +macros section, above (\sectionref{mkworld-suffix-macros-Haskell}). + +%************************************************************************ +%* * +\subsubsection[mkworld-suffixes-docs]{Suffix rules for document processing (LaTeX/tib/fig/etc)} +%* * +%************************************************************************ + +\begin{code} +#if SuffixRules_WantDocProcessing == YES +DocProcessingSuffixRules() +#endif /* SuffixRules_WantDocProcessing */ +\end{code} diff --git a/web/glasgow/lit2x-0.16/mkworld/utils-GEN.jm b/web/glasgow/lit2x-0.16/mkworld/utils-GEN.jm new file mode 100644 index 0000000000..46e2d3c97a --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/utils-GEN.jm @@ -0,0 +1,1096 @@ +# line 25 "utils-GEN.ljm" +#ifndef ArCmd +#if HasSysVishArAndRanlib == YES +#define ArCmd ar clqs +#else +#define ArCmd ar clq +#endif +#endif +AR = ArCmd +# line 36 "utils-GEN.ljm" +#ifndef ArchCmd +#define ArchCmd arch +#endif +ARCH_CMD = ArchCmd + +#ifndef MachCmd +#define MachCmd mach +#endif +MACH_CMD = MachCmd + +#ifndef AsCmd +#define AsCmd as +#endif +AS = AsCmd + +#ifndef WhatGccIsCalled /* version 2.n, please */ +#define WhatGccIsCalled gcc +#endif + +#ifndef CcCmd +#if (HaveGcc == YES) && (UseGcc == YES) +#define CcCmd WhatGccIsCalled +#else +#define CcCmd cc +#endif /* ! HaveGcc etc */ +#endif /* CcCmd */ +CC = CcCmd + +#ifndef CompressCmd +#define CompressCmd compress +#endif +COMPRESS = CompressCmd + +#ifndef CpCmd +#define CpCmd cp +#endif +CP = CpCmd + +#ifndef CppCmd +#define CppCmd /lib/cpp +#endif +#ifndef PreProcessCmd +#define PreProcessCmd CcCmd -E +#endif +CPP = CppCmd $(GLUED_CPP_INCLUDES) $(GLUED_CPP_DEFINES) /* simple filters */ +PREPROCESSCMD = PreProcessCmd $(GLUED_CPP_INCLUDES) $(GLUED_CPP_DEFINES) /* preferred; mdep */ + +#ifndef InstallCmd +#define InstallCmd install +#endif /* InstallCmd */ +INSTALL = InstallCmd +#ifndef InstallingByDefault +#define InstallingByDefault 0 +#endif +INSTALLING = InstallingByDefault + +#ifndef LexCmd +#ifdef UseFlexForLexCmd +#define LexCmd flex +#else +#define LexCmd lex +#endif +#endif +#ifndef FlexCmd +#define FlexCmd flex -s +#endif +LEX = LexCmd +FLEX = FlexCmd $(EXTRA_FLEX_FLAGS) /* this is asking for it... */ + +/* the installed Haskell compiler */ +#ifndef HaskellCompileCmd +#define HaskellCompileCmd hc +#endif +HC = HaskellCompileCmd + +#ifndef LaTeXCmd +#define LaTeXCmd latex +#endif +LATEX = LaTeXCmd +/* see also the LaTeX-wrapper script, LTX, in AllProjects */ + +#ifndef LdCmd +#define LdCmd ld +#endif +LD = LdCmd + +#ifndef LintCmd +#define LintCmd lint +#endif +LINT = LintCmd + +#ifndef LnCmd +#define LnCmd ln -s +#endif /* LnCmd */ +LN = LnCmd + +#ifndef MakeCmd +#define MakeCmd make +#endif +/* this might be useful at some point ... */ +#ifndef MakeCmdIsGnuMake +#define MakeCmdIsGnuMake NO +#endif +MAKE = MakeCmd + +#ifndef MvCmd +#define MvCmd mv +#endif +MV = MvCmd + +#ifndef NroffCmd +#define NroffCmd nroff +#endif +#ifndef ManMacros +#define ManMacros -man +#endif +#ifndef MsMacros +#define MsMacros -ms +#endif +NROFF = NroffCmd +MANMACROS = ManMacros +MSMACROS = MsMacros + +#ifndef PerlCmd +#define PerlCmd /usr/bin/perl +#endif +PERL = PerlCmd + +#ifndef PicCmd +#define PicCmd pic +#endif +PIC = PicCmd + +#ifndef PrinterCmd +#define PrinterCmd lpr +#endif +PRINTER = PrinterCmd + +#ifndef RanlibCmd +#if HasSysVishArAndRanlib == YES +#define RanlibCmd /bin/true /* does nothing */ +#else +#define RanlibCmd ranlib +#endif +#endif +RANLIB = RanlibCmd + +#ifndef RmCmd +#define RmCmd rm -f +#endif +RM = RmCmd +/* a project may want to override CLEAN_CMD */ + +/* see the comment about not having #*, under CleanTarget rule in Jmake.rules */ +/* ToDo: what about bbl files? */ +#ifndef FilesToClean +#define FilesToClean *.CKP *.ln *.BAK *.bak *.o core a.out errs ,* *.a .emacs_* tags TAGS \ + *.ind *.ilg *.idx *.idx-prev *.aux *.aux-prev *.dvi *.log *.toc *.lot *.lof \ + *.blg *.info *.itxi *.itex *.cb +#endif +/* you can override this in various ways... */ +/* Real Men (TM) will have the following in their veryclean stuff: + Makefile + .??*~ *~ (emacs backup files) + *.tex *.texi + *.lex.c *.yacc.c [however this should be done...] + *.orig *.rej (patch droppings) +*/ +#ifndef ExtraFilesToBeVeryClean +#define ExtraFilesToBeVeryClean .??*~ *~ *.orig *.rej +#endif +CLEAN_CMD = $(RM) FilesToClean +STD_VERY_CLEAN = ExtraFilesToBeVeryClean + +#ifndef SoelimCmd +#ifndef UseSoelim +#define SoelimCmd cat /* fake it */ +#else +#if defined(UseInstalledUtils) +#define SoelimCmd soelim +#else +#define SoelimCmd $(SOELIMSRC)/soelim +#endif /* UseInstalledUtils */ +#endif /* UseSoelim */ +#endif /* SoelimCmd */ +SOELIM = SoelimCmd + +#ifndef CTagsCmd +#define CTagsCmd $(ETAGS) +#endif +CTAGS = CTagsCmd + +#ifndef StripCmd +#define StripCmd strip +#endif +STRIP = StripCmd + +#ifndef TblCmd +#define TblCmd tbl +#endif +TBL = TblCmd + +#ifndef TeXCmd +#define TeXCmd tex +#endif +TEX = TeXCmd + +#ifndef TgrindCmd +#define TgrindCmd tgrind +#endif +/* the program that really does the tgrind'ing */ +#ifndef TgrindHelperCmd +#define TgrindHelperCmd /usr/local/lib/tgrind/tfontedpr +#endif +TGRIND = TgrindCmd +TGRIND_HELPER = TgrindHelperCmd + +#ifndef TibCmd +#define TibCmd tib /* you could define this to "cat" if you don't have "tib"... */ +#endif /* (I didn't say it would be pretty...) */ +TIB = TibCmd + +#ifndef TimeCmd +#define TimeCmd time +#endif +TIME = TimeCmd + +#ifndef TroffCmd +#define TroffCmd troff +#endif +TROFF = TroffCmd + +#ifndef YaccCmd +#define YaccCmd yacc +#endif +YACC = YaccCmd + +/* Note on the <pgm>NeededHere rules: they don't really check that + * the program elsewhere in the sources is really up-to-date; + * they really just arrange to go build it if it doesn't exist at all. + * This is usually good enough. + */ + +/* general idea behind these things (__* is an internal macro) ... */ + +#ifndef __SomeUtilNeededHere +#if defined(UseInstalledUtils) +#define __SomeUtilNeededHere(target,neededthing,neededthingsrcdir,neededthingmaketarg) /**/ +#else +#define __SomeUtilNeededHere(target,neededthing,neededthingsrcdir,neededthingmaketarg) @@\ + @@\ +target:: neededthing @@\ + @@\ +neededthing: @@\ + @echo "checking $@ over in" neededthingsrcdir "first..."; \ @@\ + cd neededthingsrcdir; $(MAKE) neededthingmaketarg; \ @@\ + echo "okay, continuing in $(CURRENT_DIR)" +#endif /* ! UseInstalledUtils */ +#endif /* __SomeUtilNeededHere */ + +/*# ------------------------------------------------ */ +/*# OTHER GENERALLY-USEFUL UTILS (w/ source provided) */ + +#ifndef UseInstalledUtils +UTILSRC = $(TOP)/grasp-utils +SCRIPTSRC = $(UTILSRC)/scripts +#endif + +/*# Configuration stuff (jmake, its friends and templates) */ + +#ifndef JmkmfCmd +#if defined(UseInstalledUtils) +#define JmkmfCmd jmkmf +#else +#define JmkmfCmd jmkmf_used_only_with_installed_utils +#endif +#endif + +#ifndef JrestoredepsCmd +#if defined(UseInstalledUtils) +#define JrestoredepsCmd jrestoredeps +#else +#define JrestoredepsCmd $(JMAKESRC)/jrestoredeps +#endif +#endif + +#ifndef JmakeCmd +#if defined(UseInstalledUtils) +#define JmakeCmd jmake +#else +#define JmakeCmd $(JMAKESRC)/jmake +#endif +#endif +/* + * JmakeNeededHere -- generate rules to compile jmake if its source is + * within this project's source tree. + * + * [doesn't quite fit std pattern in __SomeUtilNeededHere] + */ +#ifndef JmakeNeededHere +#if defined(UseInstalledUtils) +#define JmakeNeededHere(target) /**/ +#else +#define JmakeNeededHere(target) @@\ +target:: $(JMAKE) @@\ + @@\ +$(JMAKE): @@\ + @(cd $(JMAKESRC); if [ -f Makefile ]; then \ @@\ + echo "checking $@ in $(JMAKESRC) first..."; $(MAKE) all; else \ @@\ + echo "bootstrapping $@ from Makefile.BOOT in $(JMAKESRC) first..."; \ @@\ + $(MAKE) -f Makefile.BOOT BOOTSTRAPCFLAGS=$(BOOTSTRAPCFLAGS); fi; \ @@\ + echo "okay, continuing in $(CURRENT_DIR)") +#endif /* ! UseInstalledUtils */ +#endif /* JmakeNeededHere */ + +JMKMF = JmkmfCmd +JRESTOREDEPS = JrestoredepsCmd +JMAKE = JmakeCmd + +/* the project config dir is assumed to be relative to $(TOP) */ + +#if defined(UseInstalledUtils) +#if defined(HaveProjectMkworldDir) +JMAKE_CMD = $(JMKMF) -P $(PROJECTLABEL) -S $(SETUPLABEL) -C $(PROJ_MKWORLD_DIR) - $(BOOTSTRAPCFLAGS) $(JMAKEFLAGS) +#else +JMAKE_CMD = $(JMKMF) -P $(PROJECTLABEL) -S $(SETUPLABEL) - $(BOOTSTRAPCFLAGS) $(JMAKEFLAGS) +#endif /* !HaveProjectMkworldDir */ + +#else /* ! using installed jmake */ +JMAKESRC = $(TOP)/mkworld + +#if ProjectIsNone == YES +#define ProjectJmFiles /*nothing*/ +#define SetupJmFiles /*nothing*/ +#else /* have a project... */ +#define ProjectJmFiles \ + $(PROJ_MKWORLD_DIR)/site-$(PROJECTLABEL).jm \ + $(PROJ_MKWORLD_DIR)/only4-$(PROJECTLABEL).jm \ + $(PROJ_MKWORLD_DIR)/suffixes-$(PROJECTLABEL).jm \ + $(PROJ_MKWORLD_DIR)/macros-$(PROJECTLABEL).jm \ + $(PROJ_MKWORLD_DIR)/utils-$(PROJECTLABEL).jm \ + $(PROJ_MKWORLD_DIR)/install-$(PROJECTLABEL).jm + +#if SetupIsStd == YES +#define SetupJmFiles /*nothing*/ +#else /* have project & a setup... */ +#define SetupJmFiles \ + $(PROJ_MKWORLD_DIR)/site-$(PROJECTLABEL)-$(SETUPLABEL).jm \ + $(PROJ_MKWORLD_DIR)/only4-$(PROJECTLABEL)-$(SETUPLABEL).jm \ + $(PROJ_MKWORLD_DIR)/suffixes-$(PROJECTLABEL)-$(SETUPLABEL).jm \ + $(PROJ_MKWORLD_DIR)/macros-$(PROJECTLABEL)-$(SETUPLABEL).jm \ + $(PROJ_MKWORLD_DIR)/utils-$(PROJECTLABEL)-$(SETUPLABEL).jm \ + $(PROJ_MKWORLD_DIR)/install-$(PROJECTLABEL)-$(SETUPLABEL).jm +#endif +#endif +MYJCONFIGFILES = $(JMAKESRC)/TEMPLATE.jm \ + $(JMAKESRC)/plat-TRIGGERS.jm \ + $(JMAKESRC)/PlatformFile \ + $(JMAKESRC)/plat-DEF.jm \ + $(JMAKESRC)/site.jm \ + $(JMAKESRC)/site-DEF.jm \ + $(JMAKESRC)/suffixes-GEN.jm \ + $(JMAKESRC)/macros-GEN.jm \ + $(JMAKESRC)/utils-GEN.jm \ + $(JMAKESRC)/install-GEN.jm ProjectJmFiles SetupJmFiles + +#if defined(HaveProjectMkworldDir) +JMAKE_CMD = $(NEWTOP)$(JMAKE) -P $(PROJECTLABEL) -S $(SETUPLABEL) -C $(NEWTOP)$(PROJ_MKWORLD_DIR) -I$(NEWTOP)$(JMAKESRC) $(BOOTSTRAPCFLAGS) $(JMAKEFLAGS) +#else +JMAKE_CMD = $(NEWTOP)$(JMAKE) -P $(PROJECTLABEL) -S $(SETUPLABEL) -I$(NEWTOP)$(JMAKESRC) $(BOOTSTRAPCFLAGS) $(JMAKEFLAGS) +#endif /* ! HaveProjectMkworldDir */ +#endif /* ! using installed jmake */ + + +/*# GNU info system [hacked] */ + +#ifndef InfoCmd +#if defined(UseInstalledUtils) +#define InfoCmd info +#else +#define InfoCmd $(INFOSRC)/info +#endif +#endif +#ifndef MakeinfoCmd +#if defined(UseInstalledUtils) +#define MakeinfoCmd makeinfo +#else +#define MakeinfoCmd $(INFOSRC)/makeinfo +#endif +#endif +#ifndef PostMakeinfoCmd +#if defined(UseInstalledUtils) +#define PostMakeinfoCmd postmakeinfo +#else +#define PostMakeinfoCmd $(INFOSRC)/postmakeinfo +#endif +#endif +#ifndef InfoStuffNeededHere +#if defined(UseInstalledUtils) +#define InfoStuffNeededHere(target) /**/ +#else +#define InfoStuffNeededHere(target) \ +__SomeUtilNeededHere(target,$(INFO) $(MAKEINFO) $(POSTMAKEINFO),$(INFOSRC),all) +#endif /* ! UseInstalledUtils */ +#endif /* InfoStuffNeededHere */ +INFO = InfoCmd /* who _knows_ where these might be ... */ +MAKEINFO = MakeinfoCmd +POSTMAKEINFO = PostMakeinfoCmd +#ifndef UseInstalledUtils +INFOSRC = $(LITSRC)/info-utils +#endif + +/*# literate programming system */ +#ifndef Lit2PgmCmd +#if defined(UseInstalledUtils) +#define Lit2PgmCmd lit2pgm +#else +#define Lit2PgmCmd $(LITSRC)/lit2pgm +#endif +#endif +#ifndef Lit2TexiCmd +#if defined(UseInstalledUtils) +#define Lit2TexiCmd lit2texi +#else +#define Lit2TexiCmd $(LITSRC)/lit2texi +#endif +#endif +#ifndef Lit2LaTeXCmd +#if defined(UseInstalledUtils) +#define Lit2LaTeXCmd lit2latex +#else +#define Lit2LaTeXCmd $(LITSRC)/lit2latex +#endif +#endif +#ifndef MkDependLitCmd +#if defined(UseInstalledUtils) +#define MkDependLitCmd mkdependlit +#else +#define MkDependLitCmd $(LITSRC)/mkdependlit +#endif +#endif +#ifndef Lit2ChangeLogCmd +#if defined(UseInstalledUtils) +#define Lit2ChangeLogCmd lit2changelog +#else +#define Lit2ChangeLogCmd $(LITSRC)/lit2changelog +#endif +#endif + +/* NB: this *NeededHere rule offers LIMITED guarantee that + the literate-programming stuff is up-to-date when used +*/ +#ifndef LitStuffNeededHere +#if defined(UseInstalledUtils) +#define LitStuffNeededHere(target) /**/ +#else +#define LitStuffNeededHere(target) \ + @@\ +target:: $(LITSRC)/lit2pgm $(LITSRC)/lit2texi $(LITSRC)/lit2latex $(LITSRC)/mkdependlit $(LITSRC)/lit2changelog $(LITSRC)/lit-deatify @@\ + @@\ +$(LITSRC)/lit2pgm $(LITSRC)/lit2texi $(LITSRC)/lit2latex $(LITSRC)/mkdependlit $(LITSRC)/lit2changelog $(LITSRC)/lit-deatify: @@\ + @(cd $(LITSRC); if [ -f lit2pgm ]; then \ @@\ + echo "checking $@ in $(LITSRC) first..."; $(MAKE) all; else \ @@\ + echo "bootstrapping $@ with ./lit2pgm.BOOT in $(LITSRC) first..."; \ @@\ + $(MAKE) LIT2PGM="./lit2pgm.BOOT -Alit2pgm" lit-deatify all; fi; \ @@\ + echo "okay, continuing in $(CURRENT_DIR)") +#endif /* ! UseInstalledUtils */ +#endif /* LitStuffNeededHere */ + +LIT2PGM = Lit2PgmCmd +/* sometimes, we _must_ use the installed version of lit2pgm, + * e.g., for building lit2pgm itself + */ +LIT2TEXI = Lit2TexiCmd +LIT2LATEX = Lit2LaTeXCmd +MKDEPENDLIT = MkDependLitCmd +LIT2CHANGELOG = Lit2ChangeLogCmd +#ifndef UseInstalledUtils +LITSRC = $(TOP)/literate +#endif + +/*# mkdepend scripts for various languages */ +/*# ["mkdependlit" is under literate programming stuff above] */ + +/* for these MkDepend things, we use the scripts only [for now] */ + +#ifndef MkDependCSrc +#define MkDependCSrc $(SCRIPTSRC) +#endif +#ifndef MkDependCCmd +#if defined(UseInstalledUtils) +#define MkDependCCmd mkdependC +#else +#define MkDependCCmd $(MKDEPENDCSRC)/mkdependC +#endif /* ! installed */ +#endif /* MkDependCCmd */ + +/* + MkdependCNeededHere -- generate rules to build the mkdependC program + if its source is within this project's source tree. + + [kind of a weird one, for now at least] +*/ +#ifndef MkDependCNeededHere +#if defined(UseInstalledUtils) +#define MkDependCNeededHere(target) /**/ +#else +#define MkDependCNeededHere(target) \ +__SomeUtilNeededHere(target,$(MKDEPENDC),$(MKDEPENDCSRC),mkdependC) +#endif /* UseInstalledUtils */ +#endif /* MkDependCNeededHere */ +MKDEPENDC = MkDependCCmd +#ifndef UseInstalledUtils +MKDEPENDCSRC = MkDependCSrc +#endif + +#ifndef MkDependHSCmd /* this is the default; hope you have it! */ +#define MkDependHSCmd mkdependHS +#endif +#ifndef MkDependHSNeededHere /* ditto */ +#define MkDependHSNeededHere(targets) /*no such thing*/ +#endif +MKDEPENDHS = MkDependHSCmd + +/* mkdependlit is with the literate stuff above */ + +/* tags utilities */ + +#ifndef PerlTagsSrc +#define PerlTagsSrc $(SCRIPTSRC) +#endif +#if defined(UseInstalledUtils) +#define PerlTagsCmd perltags +#else +#define PerlTagsCmd $(PERLTAGSSRC)/perltags +#endif + +#ifndef PerlTagsNeededHere +#if defined(UseInstalledUtils) +#define PerlTagsNeededHere(target) /**/ +#else +#define PerlTagsNeededHere(target) \ +__SomeUtilNeededHere(target,$(PERLTAGS),$(PERLTAGSSRC),perltags) +#endif /* UseInstalledUtils */ +#endif /* PerlTagsNeededHere */ +PERLTAGS = PerlTagsCmd +#ifndef UseInstalledUtils +PERLTAGSSRC = PerlTagsSrc +#endif + +/*# misc utilities */ + +#ifndef FastmakeCmd +#if defined(UseInstalledUtils) +#define FastmakeCmd fastmake +#else +#define FastmakeCmd $(FASTMAKESRC)/fastmake +#endif +#endif +#ifndef FastmakeNeededHere +#if defined(UseInstalledUtils) +#define FastmakeNeededHere(target) /**/ +#else +#define FastmakeNeededHere(target) \ +__SomeUtilNeededHere(target,$(FASTMAKE),$(FASTMAKESRC),fastmake) +#endif /* ! UseInstalledUtils */ +#endif /* FastmakeNeededHere */ +FASTMAKE = FastmakeCmd +#ifndef UseInstalledUtils +FASTMAKESRC = $(SCRIPTSRC) +#endif + +#ifndef LtxCmd +#if defined(UseInstalledUtils) +#define LtxCmd ltx +#else +#define LtxCmd $(LTXSRC)/ltx +#endif +#endif +#ifndef LtxNeededHere +#if defined(UseInstalledUtils) +#define LtxNeededHere(target) /**/ +#else +#define LtxNeededHere(target) \ +__SomeUtilNeededHere(target,$(LTX),$(LTXSRC),ltx) +#endif /* ! UseInstalledUtils */ +#endif /* LtxNeededHere */ +LTX = LtxCmd /* a LaTeX-wrapper script */ +#ifndef UseInstalledUtils +LTXSRC = $(SCRIPTSRC) +#endif + +#ifndef MkdirHierCmd +#if defined(UseInstalledUtils) +#define MkdirHierCmd mkdirhier +#else +#define MkdirHierCmd $(MKDIRHIERSRC)/mkdirhier +#endif +#endif +#ifndef MkdirHierNeededHere +#if defined(UseInstalledUtils) +#define MkdirHierNeededHere(target) /**/ +#else +#define MkdirHierNeededHere(target) \ +__SomeUtilNeededHere(target,$(MKDIRHIER),$(MKDIRHIERSRC),mkdirhier) +#endif /* ! UseInstalledUtils */ +#endif /* MkdirHierNeededHere */ +MKDIRHIER = MkdirHierCmd +#ifndef UseInstalledUtils +MKDIRHIERSRC = $(SCRIPTSRC) +#endif + +/* Simon Marlow says: Lndir is sometimes dubious; if you + have GNU cp, define "LndirCmd" to: cp -Rsv +*/ +#ifndef LndirCmd +#if defined(UseInstalledUtils) +#define LndirCmd lndir +#else +#define LndirCmd $(LNDIRSRC)/lndir +#endif +#endif +#ifndef LndirNeededHere +#if defined(UseInstalledUtils) +#define LndirNeededHere(target) /**/ +#else +#define LndirNeededHere(target) \ +__SomeUtilNeededHere(target,$(LNDIR),$(LNDIRSRC),lndir) +#endif /* ! UseInstalledUtils */ +#endif /* LndirNeededHere */ +LNDIR = LndirCmd +#ifndef UseInstalledUtils +LNDIRSRC = $(SCRIPTSRC) +#endif + +#ifndef MsubCmd +#if defined(UseInstalledUtils) +#define MsubCmd msub +#else +#define MsubCmd $(MSUBSRC)/msub +#endif /* ! installed */ +#endif /* MsubCmd */ +/* MsubNeededHere - generate rules to build the msub program + if its source is within this project's source tree. This rule + should be included manually once in each Jmakefile that generates + targets with msub. (Ideally it would be invoked automatically from + within each msub-target-generating rule, but then you have a million + sets of these rules in the Makefile. Ugh. This could be avoided if + there were some way for a rule to void itself after being invoked + once.) +*/ +#ifndef MsubNeededHere +#if defined(UseInstalledUtils) +#define MsubNeededHere(target) /**/ +#else +#define MsubNeededHere(target) \ +__SomeUtilNeededHere(target,$(MSUB),$(MSUBSRC),msub) +#endif /* ! UseInstalledUtils */ +#endif /* MsubNeededHere */ +MSUB = MsubCmd +#ifndef UseInstalledUtils +MSUBSRC = $(UTILSRC)/msub +#endif + +#ifndef EtagsCmd +#if defined(UseInstalledUtils) +#define EtagsCmd etags +#else +#define EtagsCmd $(ETAGSSRC)/etags +#endif /* ! installed */ +#endif /* EtagsCmd */ +#ifndef EtagsNeededHere +#if defined(UseInstalledUtils) +#define EtagsNeededHere(target) /**/ +#else +#define EtagsNeededHere(target) \ +__SomeUtilNeededHere(target,$(ETAGS),$(ETAGSSRC),etags) +#endif /* ! UseInstalledUtils */ +#endif /* EtagsNeededHere */ +ETAGS = EtagsCmd +#ifndef UseInstalledUtils +ETAGSSRC = $(UTILSRC)/etags +#endif + +#ifndef VerbatimCmd +#if defined(UseInstalledUtils) +#define VerbatimCmd verbatim +#else +#define VerbatimCmd $(VERBATIMSRC)/verbatim +#endif /* ! installed */ +#endif /* VerbatimCmd */ +#ifndef VerbatimNeededHere +#if defined(UseInstalledUtils) +#define VerbatimNeededHere(target) /**/ +#else +#define VerbatimNeededHere(target) \ +__SomeUtilNeededHere(target,$(VERBATIM),$(VERBATIMSRC),verbatim) +#endif /* ! UseInstalledUtils */ +#endif /* VerbatimNeededHere */ +VERBATIM = VerbatimCmd +#ifndef UseInstalledUtils +VERBATIMSRC = $(UTILSRC)/verbatim +#endif + +#ifndef RunStdTestCmd +#if defined(UseInstalledUtils) +#define RunStdTestCmd runstdtest +#else +#define RunStdTestCmd $(RUNSTDTESTSRC)/runstdtest +#endif +#endif +#ifndef RunStdTestNeededHere +#if defined(UseInstalledUtils) +#define RunStdTestNeededHere(target) /**/ +#else +#define RunStdTestNeededHere(target) \ +__SomeUtilNeededHere(target,$(RUNSTDTEST),$(RUNSTDTESTSRC),runstdtest) +#endif /* ! UseInstalledUtils */ +#endif /* RunStdTestNeededHere */ +RUNSTDTEST = RunStdTestCmd +#ifndef UseInstalledUtils +RUNSTDTESTSRC = $(SCRIPTSRC) +#endif +# line 768 "utils-GEN.ljm" +/* for the whole nasty business of flags for programs, + some naming conventions are worth remembering; for program <foo>: + + <foo>FLAGS what is actually passed to <foo>; usually + built from pieces below + + ALLPROJ_<foo>_<things> <things> needed for _all_ runs of <foo>; + probably set in one of the AllProject* + config files. + PLAT_<foo>_<things> <things> (options, defines, etc.) needed for + all runs of <foo> *on this platform*; + probably set in <platform>.cf. + PROJ_<foo>_<things> <things> needed for all runs of <foo> + related to this project; probably set in + one of the Project-* config files. + <foo>_<things> <things> needed for runs of <foo> in this + directory; set in its Jmakefile. + EXTRA_<foo>_<things> name reserved for adding <things> from the + command line. + GLUED_<foo>_<things> all the above, glued together; not for + human use. + + <foo>_OPTS the usual name for options + <foo>_DEFINES CPP #defines + <foo>_INCLUDES CPP #includes + <foo>_IMPORTS Haskell "import"s + + As a contrived example, the "makeinfo" program is usually called + with the $(MAKEINFOFLAGS), which would likely be put together as... + + ALLPROJ_MAKEINFO_OPTS = + PLAT_MAKEINFO_OPTS = + PROJ_MAKEINFO_OPTS = + MAKEINFO_OPTS = + EXTRA_MAKEINFO_OPTS = + GLUED_MAKEINFO_OPTS = + MAKEINFOFLAGS = $(GLUED_MAKEINFO_OPTS) + + and used as... + + $(MAKEINFO) $(MAKEINFOFLAGS) ... + + The related CPP names are as you would expect: e.g., + ProjectMakeinfoOpts for PROJ_MAKEINFO_OPTS, ... + + For systems of interacting programs (e.g., cpp, cc, lint, as, and ld), + things can be [considerably] messier. + +*/ + +/* CPP definitions for CPP #includes; -I must be explicit */ + +/* I have not separated use of CPP w/ CC vs standalone... */ + +#ifndef AllProjectsCppIncludes +#define AllProjectsCppIncludes /*none*/ +#endif +#ifndef PlatformCppIncludes +#define PlatformCppIncludes /*none*/ +#endif +#ifndef ProjectCppIncludes +#define ProjectCppIncludes /*none*/ +#endif +#ifndef SetupCppIncludes +#define SetupCppIncludes /*none*/ +#endif +GenerateOptionsMakeVars(CPP,INCLUDES,AllProjectsCppIncludes,PlatformCppIncludes,ProjectCppIncludes,SetupCppIncludes) + +/* CPP definitions for #defines */ + +#ifndef AllProjectsCppDefines +#define AllProjectsCppDefines /*none*/ +#endif +#ifndef PlatformCppDefines +#define PlatformCppDefines /**/ +#endif /* PlatformCppDefines */ +#ifndef ProjectCppDefines +#define ProjectCppDefines /*none*/ +#endif +#ifndef SetupCppDefines +#define SetupCppDefines /*none*/ +#endif +GenerateOptionsMakeVars(CPP,DEFINES,AllProjectsCppDefines,PlatformCppDefines,ProjectCppDefines,SetupCppDefines) + +/*# C-compiler (and cpp ... and lint) options */ + +#ifndef AllProjectsCcOpts +#define AllProjectsCcOpts /*none*/ +#endif +#ifndef PlatformCcOpts +#define PlatformCcOpts /*none*/ +#endif +#ifndef ProjectCcOpts +#define ProjectCcOpts /*none*/ +#endif +#ifndef SetupCcOpts +#define SetupCcOpts /*none*/ +#endif +GenerateOptionsMakeVars(CC,OPTS,AllProjectsCcOpts,PlatformCcOpts,ProjectCcOpts,SetupCcOpts) + +CFLAGS = $(GLUED_CPP_INCLUDES) $(GLUED_CPP_DEFINES) $(GLUED_CC_OPTS) + +/*# Haskell compiler (and cpp ... and lint) options */ + +#ifndef AllProjectsHcOpts +#define AllProjectsHcOpts /*none*/ +#endif +#ifndef PlatformHcOpts +#define PlatformHcOpts /*none*/ +#endif +#ifndef ProjectHcOpts +#define ProjectHcOpts /*none*/ +#endif +#ifndef SetupHcOpts +#define SetupHcOpts /*none*/ +#endif +GenerateOptionsMakeVars(HC,OPTS,AllProjectsHcOpts,PlatformHcOpts,ProjectHcOpts,SetupHcOpts) + +#ifndef AllProjectsHcImports +#define AllProjectsHcImports /*none*/ +#endif +#ifndef PlatformHcImports +#define PlatformHcImports /*none*/ +#endif +#ifndef ProjectHcImports +#define ProjectHcImports /*none*/ +#endif +#ifndef SetupHcImports +#define SetupHcImports /*none*/ +#endif +GenerateOptionsMakeVars(HC,IMPORTS,AllProjectsHcImports,PlatformHcImports,ProjectHcImports,SetupHcImports) +HCFLAGS = $(GLUED_HC_IMPORTS) $(GLUED_CPP_DEFINES) $(GLUED_HC_OPTS) + +/*# linker options */ + +#ifndef AllProjectsLdOpts +#define AllProjectsLdOpts /*none*//* -X -r "combine" flags (?) */ +#endif +#ifndef PlatformLdOpts +#define PlatformLdOpts /*none*/ +#endif +#ifndef ProjectLdOpts +#define ProjectLdOpts /*none*/ +#endif +#ifndef SetupLdOpts +#define SetupLdOpts /*none*/ +#endif +#ifndef AllProjectsLdLibraries +#define AllProjectsLdLibraries /*none*/ +#endif +#ifndef PlatformLdLibraries +#define PlatformLdLibraries /*none*/ +#endif +#ifndef ProjectLdLibraries +#define ProjectLdLibraries /*none*/ +#endif +#ifndef SetupLdLibraries +#define SetupLdLibraries /*none*/ +#endif +GenerateOptionsMakeVars(LD,OPTS,AllProjectsLdOpts,PlatformLdOpts,ProjectLdOpts,SetupLdOpts) +GenerateOptionsMakeVars(LD,LIBRARIES,AllProjectsLdLibraries,PlatformLdLibraries,ProjectLdLibraries,SetupLdLibraries) +LDOPTIONS = $(GLUED_LD_OPTS) /* ToDo: and the libraries ? */ + +/* lint stuff not tidied up yet */ + +#ifndef LintLibFlag +#define LintLibFlag -C +#endif +#ifndef LintOpts +#define LintOpts -axz +#endif +LINTLIBFLAG = LintLibFlag +LINTOPTS = LintOpts +LINTFLAGS = $(LINTOPTS) -DLINT $(GLUED_CPP_INCLUDES) $(GLUED_CPP_DEFINES) + +/*# literate-stuff options */ + +/* some options are common (general) to all lit2* pgms; others specific */ + +#ifndef AllProjectsGenLitOpts +#define AllProjectsGenLitOpts /*none*/ +#endif +#ifndef PlatformGenLitOpts +#define PlatformGenLitOpts /*none*/ +#endif +#ifndef ProjectGenLitOpts +#define ProjectGenLitOpts /*none*/ +#endif +#ifndef SetupGenLitOpts +#define SetupGenLitOpts /*none*/ +#endif +GenerateOptionsMakeVars(GENLIT,OPTS,AllProjectsGenLitOpts,PlatformGenLitOpts,ProjectGenLitOpts,SetupGenLitOpts) + +#ifndef AllProjectsLit2pgmOpts +#define AllProjectsLit2pgmOpts /*none*/ +#endif +#ifndef PlatformLit2pgmOpts +#define PlatformLit2pgmOpts /*none*/ +#endif +#ifndef ProjectLit2pgmOpts +#define ProjectLit2pgmOpts /*none*/ +#endif +#ifndef SetupLit2pgmOpts +#define SetupLit2pgmOpts /*none*/ +#endif +GenerateOptionsMakeVars(LIT2PGM,OPTS,AllProjectsLit2pgmOpts,PlatformLit2pgmOpts,ProjectLit2pgmOpts,SetupLit2pgmOpts) +#ifndef AllProjectsLit2texiOpts +#define AllProjectsLit2texiOpts /*none*/ +#endif +#ifndef PlatformLit2texiOpts +#define PlatformLit2texiOpts /*none*/ +#endif +#ifndef ProjectLit2texiOpts +#define ProjectLit2texiOpts /*none*/ +#endif +#ifndef SetupLit2texiOpts +#define SetupLit2texiOpts /*none*/ +#endif +GenerateOptionsMakeVars(LIT2TEXI,OPTS,AllProjectsLit2texiOpts,PlatformLit2texiOpts,ProjectLit2texiOpts,SetupLit2texiOpts) +#ifndef AllProjectsLit2latexOpts +#define AllProjectsLit2latexOpts /*none*/ +#endif +#ifndef PlatformLit2latexOpts +#define PlatformLit2latexOpts /*none*/ +#endif +#ifndef ProjectLit2latexOpts +#define ProjectLit2latexOpts /*none*/ +#endif +#ifndef SetupLit2latexOpts +#define SetupLit2latexOpts /*none*/ +#endif +GenerateOptionsMakeVars(LIT2LATEX,OPTS,AllProjectsLit2latexOpts,PlatformLit2latexOpts,ProjectLit2latexOpts,SetupLit2latexOpts) +#ifndef AllProjectsLit2changelogOpts +#define AllProjectsLit2changelogOpts /*none*/ +#endif +#ifndef PlatformLit2changelogOpts +#define PlatformLit2changelogOpts /*none*/ +#endif +#ifndef ProjectLit2changelogOpts +#define ProjectLit2changelogOpts /*none*/ +#endif +#ifndef SetupLit2changelogOpts +#define SetupLit2changelogOpts /*none*/ +#endif +GenerateOptionsMakeVars(LIT2CHANGELOG,OPTS,AllProjectsLit2changelogOpts,PlatformLit2changelogOpts,ProjectLit2changelogOpts,SetupLit2changelogOpts) +#ifndef AllProjectsMkDependLitOpts +#define AllProjectsMkDependLitOpts /*none*/ +#endif +#ifndef PlatformMkDependLitOpts +#define PlatformMkDependLitOpts /*none*/ +#endif +#ifndef ProjectMkDependLitOpts +#define ProjectMkDependLitOpts /*none*/ +#endif +#ifndef SetupMkDependLitOpts +#define SetupMkDependLitOpts /*none*/ +#endif +GenerateOptionsMakeVars(MKDEPENDLIT,OPTS,AllProjectsMkDependLitOpts,PlatformMkDependLitOpts,ProjectMkDependLitOpts,SetupMkDependLitOpts) + +LIT2PGMFLAGS = $(GLUED_GENLIT_OPTS) $(GLUED_LIT2PGM_OPTS) +LIT2TEXIFLAGS = $(GLUED_GENLIT_OPTS) $(GLUED_LIT2TEXI_OPTS) +LIT2LATEXFLAGS = $(GLUED_GENLIT_OPTS) $(GLUED_LIT2LATEX_OPTS) +LIT2CHANGELOGFLAGS = $(GLUED_GENLIT_OPTS) $(GLUED_LIT2CHANGELOG_OPTS) +MKDEPENDLITFLAGS = $(GLUED_GENLIT_OPTS) $(GLUED_MKDEPENDLIT_OPTS) + +/* same for other MkDepend things */ + +#ifndef AllProjectsMkDependCOpts +#define AllProjectsMkDependCOpts /*none*/ +#endif +#ifndef PlatformMkDependCOpts +#define PlatformMkDependCOpts /*none*/ +#endif +#ifndef ProjectMkDependCOpts +#define ProjectMkDependCOpts /*none*/ +#endif +#ifndef SetupMkDependCOpts +#define SetupMkDependCOpts /*none*/ +#endif +GenerateOptionsMakeVars(MKDEPENDC,OPTS,AllProjectsMkDependCOpts,PlatformMkDependCOpts,ProjectMkDependCOpts,SetupMkDependCOpts) +MKDEPENDCFLAGS = $(GLUED_MKDEPENDC_OPTS) + +#ifndef AllProjectsMkDependHSOpts +#define AllProjectsMkDependHSOpts /*none*/ +#endif +#ifndef PlatformMkDependHSOpts +#define PlatformMkDependHSOpts /*none*/ +#endif +#ifndef ProjectMkDependHSOpts +#define ProjectMkDependHSOpts /*none*/ +#endif +#ifndef SetupMkDependHSOpts +#define SetupMkDependHSOpts /*none*/ +#endif +GenerateOptionsMakeVars(MKDEPENDHS,OPTS,AllProjectsMkDependHSOpts,PlatformMkDependHSOpts,ProjectMkDependHSOpts,SetupMkDependHSOpts) +MKDEPENDHSFLAGS = $(GLUED_MKDEPENDHS_OPTS) + +/* same for tags stuff */ + +#ifndef AllProjectsCTagsOpts +#define AllProjectsCTagsOpts -e -w /* emacs-style; no warnings */ +#endif +#ifndef PlatformCTagsOpts +#define PlatformCTagsOpts /*none*/ +#endif +#ifndef ProjectCTagsOpts +#define ProjectCTagsOpts /*none*/ +#endif +#ifndef SetupCTagsOpts +#define SetupCTagsOpts /*none*/ +#endif +GenerateOptionsMakeVars(CTAGS,OPTS,AllProjectsCTagsOpts,PlatformCTagsOpts,ProjectCTagsOpts,SetupCTagsOpts) +CTAGSFLAGS = $(GLUED_CTAGS_OPTS) + +#ifndef AllProjectsPerlTagsOpts +#define AllProjectsPerlTagsOpts /*none*/ +#endif +#ifndef PlatformPerlTagsOpts +#define PlatformPerlTagsOpts /*none*/ +#endif +#ifndef ProjectPerlTagsOpts +#define ProjectPerlTagsOpts /*none*/ +#endif +#ifndef SetupPerlTagsOpts +#define SetupPerlTagsOpts /*none*/ +#endif +GenerateOptionsMakeVars(PERLTAGS,OPTS,AllProjectsPerlTagsOpts,PlatformPerlTagsOpts,ProjectPerlTagsOpts,SetupPerlTagsOpts) +PERLTAGSFLAGS = $(GLUED_PERLTAGS_OPTS) + +/* and for "runstdtest" */ + +#ifndef AllProjectsRunStdTestOpts +#define AllProjectsRunStdTestOpts /*none*/ +#endif +#ifndef PlatformRunStdTestOpts +#define PlatformRunStdTestOpts /*none*/ +#endif +#ifndef ProjectRunStdTestOpts +#define ProjectRunStdTestOpts /*none*/ +#endif +#ifndef SetupRunStdTestOpts +#define SetupRunStdTestOpts /*none*/ +#endif +GenerateOptionsMakeVars(RUNSTDTEST,OPTS,AllProjectsRunStdTestOpts,PlatformRunStdTestOpts,ProjectRunStdTestOpts,SetupRunStdTestOpts) +RUNSTDTEST_FLAGS = $(GLUED_RUNSTDTEST_OPTS) + +/* CPP definitions for #defines */ + +#ifndef AllProjectsJmakeDefines +#define AllProjectsJmakeDefines /*none*/ +#endif +#ifndef PlatformJmakeDefines +#define PlatformJmakeDefines /**/ +#endif /* PlatformJmakeDefines */ +#ifndef ProjectJmakeDefines +#define ProjectJmakeDefines /*none*/ +#endif +#ifndef SetupJmakeDefines +#define SetupJmakeDefines /*none*/ +#endif +GenerateOptionsMakeVars(JMAKE,DEFINES,AllProjectsJmakeDefines,PlatformJmakeDefines,ProjectJmakeDefines,SetupJmakeDefines) +JMAKEFLAGS = $(GLUED_JMAKE_DEFINES) diff --git a/web/glasgow/lit2x-0.16/mkworld/utils-GEN.ljm b/web/glasgow/lit2x-0.16/mkworld/utils-GEN.ljm new file mode 100644 index 0000000000..6d3faecda9 --- /dev/null +++ b/web/glasgow/lit2x-0.16/mkworld/utils-GEN.ljm @@ -0,0 +1,1130 @@ +%************************************************************************ +%* * +\section[mkworld-utils-GEN]{General stuff about ``utilities''} +%* * +%************************************************************************ + +%************************************************************************ +%* * +\subsection[mkworld-utils-what]{What they are (intro)} +%* * +%************************************************************************ + +%************************************************************************ +%* * +\subsection[mkworld-utils-where]{Where they are} +%* * +%************************************************************************ + +Generally-useful utils that are pre-supposed (but a project might want +diff ones). + +For @ar@, the \tr{l} means to use \tr{.} for temp files; the \tr{s} in +the SystemV-ish case takes the place of \tr{ranlib}. +\begin{code} +#ifndef ArCmd +#if HasSysVishArAndRanlib == YES +#define ArCmd ar clqs +#else +#define ArCmd ar clq +#endif +#endif +AR = ArCmd +\end{code} + +\begin{code} +#ifndef ArchCmd +#define ArchCmd arch +#endif +ARCH_CMD = ArchCmd + +#ifndef MachCmd +#define MachCmd mach +#endif +MACH_CMD = MachCmd + +#ifndef AsCmd +#define AsCmd as +#endif +AS = AsCmd + +#ifndef WhatGccIsCalled /* version 2.n, please */ +#define WhatGccIsCalled gcc +#endif + +#ifndef CcCmd +#if (HaveGcc == YES) && (UseGcc == YES) +#define CcCmd WhatGccIsCalled +#else +#define CcCmd cc +#endif /* ! HaveGcc etc */ +#endif /* CcCmd */ +CC = CcCmd + +#ifndef CompressCmd +#define CompressCmd compress +#endif +COMPRESS = CompressCmd + +#ifndef CpCmd +#define CpCmd cp +#endif +CP = CpCmd + +#ifndef CppCmd +#define CppCmd /lib/cpp +#endif +#ifndef PreProcessCmd +#define PreProcessCmd CcCmd -E +#endif +CPP = CppCmd $(GLUED_CPP_INCLUDES) $(GLUED_CPP_DEFINES) /* simple filters */ +PREPROCESSCMD = PreProcessCmd $(GLUED_CPP_INCLUDES) $(GLUED_CPP_DEFINES) /* preferred; mdep */ + +#ifndef InstallCmd +#define InstallCmd install +#endif /* InstallCmd */ +INSTALL = InstallCmd +#ifndef InstallingByDefault +#define InstallingByDefault 0 +#endif +INSTALLING = InstallingByDefault + +#ifndef LexCmd +#ifdef UseFlexForLexCmd +#define LexCmd flex +#else +#define LexCmd lex +#endif +#endif +#ifndef FlexCmd +#define FlexCmd flex -s +#endif +LEX = LexCmd +FLEX = FlexCmd $(EXTRA_FLEX_FLAGS) /* this is asking for it... */ + +/* the installed Haskell compiler */ +#ifndef HaskellCompileCmd +#define HaskellCompileCmd hc +#endif +HC = HaskellCompileCmd + +#ifndef LaTeXCmd +#define LaTeXCmd latex +#endif +LATEX = LaTeXCmd +/* see also the LaTeX-wrapper script, LTX, in AllProjects */ + +#ifndef LdCmd +#define LdCmd ld +#endif +LD = LdCmd + +#ifndef LintCmd +#define LintCmd lint +#endif +LINT = LintCmd + +#ifndef LnCmd +#define LnCmd ln -s +#endif /* LnCmd */ +LN = LnCmd + +#ifndef MakeCmd +#define MakeCmd make +#endif +/* this might be useful at some point ... */ +#ifndef MakeCmdIsGnuMake +#define MakeCmdIsGnuMake NO +#endif +MAKE = MakeCmd + +#ifndef MvCmd +#define MvCmd mv +#endif +MV = MvCmd + +#ifndef NroffCmd +#define NroffCmd nroff +#endif +#ifndef ManMacros +#define ManMacros -man +#endif +#ifndef MsMacros +#define MsMacros -ms +#endif +NROFF = NroffCmd +MANMACROS = ManMacros +MSMACROS = MsMacros + +#ifndef PerlCmd +#define PerlCmd /usr/bin/perl +#endif +PERL = PerlCmd + +#ifndef PicCmd +#define PicCmd pic +#endif +PIC = PicCmd + +#ifndef PrinterCmd +#define PrinterCmd lpr +#endif +PRINTER = PrinterCmd + +#ifndef RanlibCmd +#if HasSysVishArAndRanlib == YES +#define RanlibCmd /bin/true /* does nothing */ +#else +#define RanlibCmd ranlib +#endif +#endif +RANLIB = RanlibCmd + +#ifndef RmCmd +#define RmCmd rm -f +#endif +RM = RmCmd +/* a project may want to override CLEAN_CMD */ + +/* see the comment about not having #*, under CleanTarget rule in Jmake.rules */ +/* ToDo: what about bbl files? */ +#ifndef FilesToClean +#define FilesToClean *.CKP *.ln *.BAK *.bak *.o core a.out errs ,* *.a .emacs_* tags TAGS \ + *.ind *.ilg *.idx *.idx-prev *.aux *.aux-prev *.dvi *.log *.toc *.lot *.lof \ + *.blg *.info *.itxi *.itex *.cb +#endif +/* you can override this in various ways... */ +/* Real Men (TM) will have the following in their veryclean stuff: + Makefile + .??*~ *~ (emacs backup files) + *.tex *.texi + *.lex.c *.yacc.c [however this should be done...] + *.orig *.rej (patch droppings) +*/ +#ifndef ExtraFilesToBeVeryClean +#define ExtraFilesToBeVeryClean .??*~ *~ *.orig *.rej +#endif +CLEAN_CMD = $(RM) FilesToClean +STD_VERY_CLEAN = ExtraFilesToBeVeryClean + +#ifndef SoelimCmd +#ifndef UseSoelim +#define SoelimCmd cat /* fake it */ +#else +#if defined(UseInstalledUtils) +#define SoelimCmd soelim +#else +#define SoelimCmd $(SOELIMSRC)/soelim +#endif /* UseInstalledUtils */ +#endif /* UseSoelim */ +#endif /* SoelimCmd */ +SOELIM = SoelimCmd + +#ifndef CTagsCmd +#define CTagsCmd $(ETAGS) +#endif +CTAGS = CTagsCmd + +#ifndef StripCmd +#define StripCmd strip +#endif +STRIP = StripCmd + +#ifndef TblCmd +#define TblCmd tbl +#endif +TBL = TblCmd + +#ifndef TeXCmd +#define TeXCmd tex +#endif +TEX = TeXCmd + +#ifndef TgrindCmd +#define TgrindCmd tgrind +#endif +/* the program that really does the tgrind'ing */ +#ifndef TgrindHelperCmd +#define TgrindHelperCmd /usr/local/lib/tgrind/tfontedpr +#endif +TGRIND = TgrindCmd +TGRIND_HELPER = TgrindHelperCmd + +#ifndef TibCmd +#define TibCmd tib /* you could define this to "cat" if you don't have "tib"... */ +#endif /* (I didn't say it would be pretty...) */ +TIB = TibCmd + +#ifndef TimeCmd +#define TimeCmd time +#endif +TIME = TimeCmd + +#ifndef TroffCmd +#define TroffCmd troff +#endif +TROFF = TroffCmd + +#ifndef YaccCmd +#define YaccCmd yacc +#endif +YACC = YaccCmd + +/* Note on the <pgm>NeededHere rules: they don't really check that + * the program elsewhere in the sources is really up-to-date; + * they really just arrange to go build it if it doesn't exist at all. + * This is usually good enough. + */ + +/* general idea behind these things (__* is an internal macro) ... */ + +#ifndef __SomeUtilNeededHere +#if defined(UseInstalledUtils) +#define __SomeUtilNeededHere(target,neededthing,neededthingsrcdir,neededthingmaketarg) /**/ +#else +#define __SomeUtilNeededHere(target,neededthing,neededthingsrcdir,neededthingmaketarg) @@\ + @@\ +target:: neededthing @@\ + @@\ +neededthing: @@\ + @echo "checking $@ over in" neededthingsrcdir "first..."; \ @@\ + cd neededthingsrcdir; $(MAKE) neededthingmaketarg; \ @@\ + echo "okay, continuing in $(CURRENT_DIR)" +#endif /* ! UseInstalledUtils */ +#endif /* __SomeUtilNeededHere */ + +/*# ------------------------------------------------ */ +/*# OTHER GENERALLY-USEFUL UTILS (w/ source provided) */ + +#ifndef UseInstalledUtils +UTILSRC = $(TOP)/grasp-utils +SCRIPTSRC = $(UTILSRC)/scripts +#endif + +/*# Configuration stuff (jmake, its friends and templates) */ + +#ifndef JmkmfCmd +#if defined(UseInstalledUtils) +#define JmkmfCmd jmkmf +#else +#define JmkmfCmd jmkmf_used_only_with_installed_utils +#endif +#endif + +#ifndef JrestoredepsCmd +#if defined(UseInstalledUtils) +#define JrestoredepsCmd jrestoredeps +#else +#define JrestoredepsCmd $(JMAKESRC)/jrestoredeps +#endif +#endif + +#ifndef JmakeCmd +#if defined(UseInstalledUtils) +#define JmakeCmd jmake +#else +#define JmakeCmd $(JMAKESRC)/jmake +#endif +#endif +/* + * JmakeNeededHere -- generate rules to compile jmake if its source is + * within this project's source tree. + * + * [doesn't quite fit std pattern in __SomeUtilNeededHere] + */ +#ifndef JmakeNeededHere +#if defined(UseInstalledUtils) +#define JmakeNeededHere(target) /**/ +#else +#define JmakeNeededHere(target) @@\ +target:: $(JMAKE) @@\ + @@\ +$(JMAKE): @@\ + @(cd $(JMAKESRC); if [ -f Makefile ]; then \ @@\ + echo "checking $@ in $(JMAKESRC) first..."; $(MAKE) all; else \ @@\ + echo "bootstrapping $@ from Makefile.BOOT in $(JMAKESRC) first..."; \ @@\ + $(MAKE) -f Makefile.BOOT BOOTSTRAPCFLAGS=$(BOOTSTRAPCFLAGS); fi; \ @@\ + echo "okay, continuing in $(CURRENT_DIR)") +#endif /* ! UseInstalledUtils */ +#endif /* JmakeNeededHere */ + +JMKMF = JmkmfCmd +JRESTOREDEPS = JrestoredepsCmd +JMAKE = JmakeCmd + +/* the project config dir is assumed to be relative to $(TOP) */ + +#if defined(UseInstalledUtils) +#if defined(HaveProjectMkworldDir) +JMAKE_CMD = $(JMKMF) -P $(PROJECTLABEL) -S $(SETUPLABEL) -C $(PROJ_MKWORLD_DIR) - $(BOOTSTRAPCFLAGS) $(JMAKEFLAGS) +#else +JMAKE_CMD = $(JMKMF) -P $(PROJECTLABEL) -S $(SETUPLABEL) - $(BOOTSTRAPCFLAGS) $(JMAKEFLAGS) +#endif /* !HaveProjectMkworldDir */ + +#else /* ! using installed jmake */ +JMAKESRC = $(TOP)/mkworld + +#if ProjectIsNone == YES +#define ProjectJmFiles /*nothing*/ +#define SetupJmFiles /*nothing*/ +#else /* have a project... */ +#define ProjectJmFiles \ + $(PROJ_MKWORLD_DIR)/site-$(PROJECTLABEL).jm \ + $(PROJ_MKWORLD_DIR)/only4-$(PROJECTLABEL).jm \ + $(PROJ_MKWORLD_DIR)/suffixes-$(PROJECTLABEL).jm \ + $(PROJ_MKWORLD_DIR)/macros-$(PROJECTLABEL).jm \ + $(PROJ_MKWORLD_DIR)/utils-$(PROJECTLABEL).jm \ + $(PROJ_MKWORLD_DIR)/install-$(PROJECTLABEL).jm + +#if SetupIsStd == YES +#define SetupJmFiles /*nothing*/ +#else /* have project & a setup... */ +#define SetupJmFiles \ + $(PROJ_MKWORLD_DIR)/site-$(PROJECTLABEL)-$(SETUPLABEL).jm \ + $(PROJ_MKWORLD_DIR)/only4-$(PROJECTLABEL)-$(SETUPLABEL).jm \ + $(PROJ_MKWORLD_DIR)/suffixes-$(PROJECTLABEL)-$(SETUPLABEL).jm \ + $(PROJ_MKWORLD_DIR)/macros-$(PROJECTLABEL)-$(SETUPLABEL).jm \ + $(PROJ_MKWORLD_DIR)/utils-$(PROJECTLABEL)-$(SETUPLABEL).jm \ + $(PROJ_MKWORLD_DIR)/install-$(PROJECTLABEL)-$(SETUPLABEL).jm +#endif +#endif +MYJCONFIGFILES = $(JMAKESRC)/TEMPLATE.jm \ + $(JMAKESRC)/plat-TRIGGERS.jm \ + $(JMAKESRC)/PlatformFile \ + $(JMAKESRC)/plat-DEF.jm \ + $(JMAKESRC)/site.jm \ + $(JMAKESRC)/site-DEF.jm \ + $(JMAKESRC)/suffixes-GEN.jm \ + $(JMAKESRC)/macros-GEN.jm \ + $(JMAKESRC)/utils-GEN.jm \ + $(JMAKESRC)/install-GEN.jm ProjectJmFiles SetupJmFiles + +#if defined(HaveProjectMkworldDir) +JMAKE_CMD = $(NEWTOP)$(JMAKE) -P $(PROJECTLABEL) -S $(SETUPLABEL) -C $(NEWTOP)$(PROJ_MKWORLD_DIR) -I$(NEWTOP)$(JMAKESRC) $(BOOTSTRAPCFLAGS) $(JMAKEFLAGS) +#else +JMAKE_CMD = $(NEWTOP)$(JMAKE) -P $(PROJECTLABEL) -S $(SETUPLABEL) -I$(NEWTOP)$(JMAKESRC) $(BOOTSTRAPCFLAGS) $(JMAKEFLAGS) +#endif /* ! HaveProjectMkworldDir */ +#endif /* ! using installed jmake */ + + +/*# GNU info system [hacked] */ + +#ifndef InfoCmd +#if defined(UseInstalledUtils) +#define InfoCmd info +#else +#define InfoCmd $(INFOSRC)/info +#endif +#endif +#ifndef MakeinfoCmd +#if defined(UseInstalledUtils) +#define MakeinfoCmd makeinfo +#else +#define MakeinfoCmd $(INFOSRC)/makeinfo +#endif +#endif +#ifndef PostMakeinfoCmd +#if defined(UseInstalledUtils) +#define PostMakeinfoCmd postmakeinfo +#else +#define PostMakeinfoCmd $(INFOSRC)/postmakeinfo +#endif +#endif +#ifndef InfoStuffNeededHere +#if defined(UseInstalledUtils) +#define InfoStuffNeededHere(target) /**/ +#else +#define InfoStuffNeededHere(target) \ +__SomeUtilNeededHere(target,$(INFO) $(MAKEINFO) $(POSTMAKEINFO),$(INFOSRC),all) +#endif /* ! UseInstalledUtils */ +#endif /* InfoStuffNeededHere */ +INFO = InfoCmd /* who _knows_ where these might be ... */ +MAKEINFO = MakeinfoCmd +POSTMAKEINFO = PostMakeinfoCmd +#ifndef UseInstalledUtils +INFOSRC = $(LITSRC)/info-utils +#endif + +/*# literate programming system */ +#ifndef Lit2PgmCmd +#if defined(UseInstalledUtils) +#define Lit2PgmCmd lit2pgm +#else +#define Lit2PgmCmd $(LITSRC)/lit2pgm +#endif +#endif +#ifndef Lit2TexiCmd +#if defined(UseInstalledUtils) +#define Lit2TexiCmd lit2texi +#else +#define Lit2TexiCmd $(LITSRC)/lit2texi +#endif +#endif +#ifndef Lit2LaTeXCmd +#if defined(UseInstalledUtils) +#define Lit2LaTeXCmd lit2latex +#else +#define Lit2LaTeXCmd $(LITSRC)/lit2latex +#endif +#endif +#ifndef MkDependLitCmd +#if defined(UseInstalledUtils) +#define MkDependLitCmd mkdependlit +#else +#define MkDependLitCmd $(LITSRC)/mkdependlit +#endif +#endif +#ifndef Lit2ChangeLogCmd +#if defined(UseInstalledUtils) +#define Lit2ChangeLogCmd lit2changelog +#else +#define Lit2ChangeLogCmd $(LITSRC)/lit2changelog +#endif +#endif + +/* NB: this *NeededHere rule offers LIMITED guarantee that + the literate-programming stuff is up-to-date when used +*/ +#ifndef LitStuffNeededHere +#if defined(UseInstalledUtils) +#define LitStuffNeededHere(target) /**/ +#else +#define LitStuffNeededHere(target) \ + @@\ +target:: $(LITSRC)/lit2pgm $(LITSRC)/lit2texi $(LITSRC)/lit2latex $(LITSRC)/mkdependlit $(LITSRC)/lit2changelog $(LITSRC)/lit-deatify @@\ + @@\ +$(LITSRC)/lit2pgm $(LITSRC)/lit2texi $(LITSRC)/lit2latex $(LITSRC)/mkdependlit $(LITSRC)/lit2changelog $(LITSRC)/lit-deatify: @@\ + @(cd $(LITSRC); if [ -f lit2pgm ]; then \ @@\ + echo "checking $@ in $(LITSRC) first..."; $(MAKE) all; else \ @@\ + echo "bootstrapping $@ with ./lit2pgm.BOOT in $(LITSRC) first..."; \ @@\ + $(MAKE) LIT2PGM="./lit2pgm.BOOT -Alit2pgm" lit-deatify all; fi; \ @@\ + echo "okay, continuing in $(CURRENT_DIR)") +#endif /* ! UseInstalledUtils */ +#endif /* LitStuffNeededHere */ + +LIT2PGM = Lit2PgmCmd +/* sometimes, we _must_ use the installed version of lit2pgm, + * e.g., for building lit2pgm itself + */ +LIT2TEXI = Lit2TexiCmd +LIT2LATEX = Lit2LaTeXCmd +MKDEPENDLIT = MkDependLitCmd +LIT2CHANGELOG = Lit2ChangeLogCmd +#ifndef UseInstalledUtils +LITSRC = $(TOP)/literate +#endif + +/*# mkdepend scripts for various languages */ +/*# ["mkdependlit" is under literate programming stuff above] */ + +/* for these MkDepend things, we use the scripts only [for now] */ + +#ifndef MkDependCSrc +#define MkDependCSrc $(SCRIPTSRC) +#endif +#ifndef MkDependCCmd +#if defined(UseInstalledUtils) +#define MkDependCCmd mkdependC +#else +#define MkDependCCmd $(MKDEPENDCSRC)/mkdependC +#endif /* ! installed */ +#endif /* MkDependCCmd */ + +/* + MkdependCNeededHere -- generate rules to build the mkdependC program + if its source is within this project's source tree. + + [kind of a weird one, for now at least] +*/ +#ifndef MkDependCNeededHere +#if defined(UseInstalledUtils) +#define MkDependCNeededHere(target) /**/ +#else +#define MkDependCNeededHere(target) \ +__SomeUtilNeededHere(target,$(MKDEPENDC),$(MKDEPENDCSRC),mkdependC) +#endif /* UseInstalledUtils */ +#endif /* MkDependCNeededHere */ +MKDEPENDC = MkDependCCmd +#ifndef UseInstalledUtils +MKDEPENDCSRC = MkDependCSrc +#endif + +#ifndef MkDependHSCmd /* this is the default; hope you have it! */ +#define MkDependHSCmd mkdependHS +#endif +#ifndef MkDependHSNeededHere /* ditto */ +#define MkDependHSNeededHere(targets) /*no such thing*/ +#endif +MKDEPENDHS = MkDependHSCmd + +/* mkdependlit is with the literate stuff above */ + +/* tags utilities */ + +#ifndef PerlTagsSrc +#define PerlTagsSrc $(SCRIPTSRC) +#endif +#if defined(UseInstalledUtils) +#define PerlTagsCmd perltags +#else +#define PerlTagsCmd $(PERLTAGSSRC)/perltags +#endif + +#ifndef PerlTagsNeededHere +#if defined(UseInstalledUtils) +#define PerlTagsNeededHere(target) /**/ +#else +#define PerlTagsNeededHere(target) \ +__SomeUtilNeededHere(target,$(PERLTAGS),$(PERLTAGSSRC),perltags) +#endif /* UseInstalledUtils */ +#endif /* PerlTagsNeededHere */ +PERLTAGS = PerlTagsCmd +#ifndef UseInstalledUtils +PERLTAGSSRC = PerlTagsSrc +#endif + +/*# misc utilities */ + +#ifndef FastmakeCmd +#if defined(UseInstalledUtils) +#define FastmakeCmd fastmake +#else +#define FastmakeCmd $(FASTMAKESRC)/fastmake +#endif +#endif +#ifndef FastmakeNeededHere +#if defined(UseInstalledUtils) +#define FastmakeNeededHere(target) /**/ +#else +#define FastmakeNeededHere(target) \ +__SomeUtilNeededHere(target,$(FASTMAKE),$(FASTMAKESRC),fastmake) +#endif /* ! UseInstalledUtils */ +#endif /* FastmakeNeededHere */ +FASTMAKE = FastmakeCmd +#ifndef UseInstalledUtils +FASTMAKESRC = $(SCRIPTSRC) +#endif + +#ifndef LtxCmd +#if defined(UseInstalledUtils) +#define LtxCmd ltx +#else +#define LtxCmd $(LTXSRC)/ltx +#endif +#endif +#ifndef LtxNeededHere +#if defined(UseInstalledUtils) +#define LtxNeededHere(target) /**/ +#else +#define LtxNeededHere(target) \ +__SomeUtilNeededHere(target,$(LTX),$(LTXSRC),ltx) +#endif /* ! UseInstalledUtils */ +#endif /* LtxNeededHere */ +LTX = LtxCmd /* a LaTeX-wrapper script */ +#ifndef UseInstalledUtils +LTXSRC = $(SCRIPTSRC) +#endif + +#ifndef MkdirHierCmd +#if defined(UseInstalledUtils) +#define MkdirHierCmd mkdirhier +#else +#define MkdirHierCmd $(MKDIRHIERSRC)/mkdirhier +#endif +#endif +#ifndef MkdirHierNeededHere +#if defined(UseInstalledUtils) +#define MkdirHierNeededHere(target) /**/ +#else +#define MkdirHierNeededHere(target) \ +__SomeUtilNeededHere(target,$(MKDIRHIER),$(MKDIRHIERSRC),mkdirhier) +#endif /* ! UseInstalledUtils */ +#endif /* MkdirHierNeededHere */ +MKDIRHIER = MkdirHierCmd +#ifndef UseInstalledUtils +MKDIRHIERSRC = $(SCRIPTSRC) +#endif + +/* Simon Marlow says: Lndir is sometimes dubious; if you + have GNU cp, define "LndirCmd" to: cp -Rsv +*/ +#ifndef LndirCmd +#if defined(UseInstalledUtils) +#define LndirCmd lndir +#else +#define LndirCmd $(LNDIRSRC)/lndir +#endif +#endif +#ifndef LndirNeededHere +#if defined(UseInstalledUtils) +#define LndirNeededHere(target) /**/ +#else +#define LndirNeededHere(target) \ +__SomeUtilNeededHere(target,$(LNDIR),$(LNDIRSRC),lndir) +#endif /* ! UseInstalledUtils */ +#endif /* LndirNeededHere */ +LNDIR = LndirCmd +#ifndef UseInstalledUtils +LNDIRSRC = $(SCRIPTSRC) +#endif + +#ifndef MsubCmd +#if defined(UseInstalledUtils) +#define MsubCmd msub +#else +#define MsubCmd $(MSUBSRC)/msub +#endif /* ! installed */ +#endif /* MsubCmd */ +/* MsubNeededHere - generate rules to build the msub program + if its source is within this project's source tree. This rule + should be included manually once in each Jmakefile that generates + targets with msub. (Ideally it would be invoked automatically from + within each msub-target-generating rule, but then you have a million + sets of these rules in the Makefile. Ugh. This could be avoided if + there were some way for a rule to void itself after being invoked + once.) +*/ +#ifndef MsubNeededHere +#if defined(UseInstalledUtils) +#define MsubNeededHere(target) /**/ +#else +#define MsubNeededHere(target) \ +__SomeUtilNeededHere(target,$(MSUB),$(MSUBSRC),msub) +#endif /* ! UseInstalledUtils */ +#endif /* MsubNeededHere */ +MSUB = MsubCmd +#ifndef UseInstalledUtils +MSUBSRC = $(UTILSRC)/msub +#endif + +#ifndef EtagsCmd +#if defined(UseInstalledUtils) +#define EtagsCmd etags +#else +#define EtagsCmd $(ETAGSSRC)/etags +#endif /* ! installed */ +#endif /* EtagsCmd */ +#ifndef EtagsNeededHere +#if defined(UseInstalledUtils) +#define EtagsNeededHere(target) /**/ +#else +#define EtagsNeededHere(target) \ +__SomeUtilNeededHere(target,$(ETAGS),$(ETAGSSRC),etags) +#endif /* ! UseInstalledUtils */ +#endif /* EtagsNeededHere */ +ETAGS = EtagsCmd +#ifndef UseInstalledUtils +ETAGSSRC = $(UTILSRC)/etags +#endif + +#ifndef VerbatimCmd +#if defined(UseInstalledUtils) +#define VerbatimCmd verbatim +#else +#define VerbatimCmd $(VERBATIMSRC)/verbatim +#endif /* ! installed */ +#endif /* VerbatimCmd */ +#ifndef VerbatimNeededHere +#if defined(UseInstalledUtils) +#define VerbatimNeededHere(target) /**/ +#else +#define VerbatimNeededHere(target) \ +__SomeUtilNeededHere(target,$(VERBATIM),$(VERBATIMSRC),verbatim) +#endif /* ! UseInstalledUtils */ +#endif /* VerbatimNeededHere */ +VERBATIM = VerbatimCmd +#ifndef UseInstalledUtils +VERBATIMSRC = $(UTILSRC)/verbatim +#endif + +#ifndef RunStdTestCmd +#if defined(UseInstalledUtils) +#define RunStdTestCmd runstdtest +#else +#define RunStdTestCmd $(RUNSTDTESTSRC)/runstdtest +#endif +#endif +#ifndef RunStdTestNeededHere +#if defined(UseInstalledUtils) +#define RunStdTestNeededHere(target) /**/ +#else +#define RunStdTestNeededHere(target) \ +__SomeUtilNeededHere(target,$(RUNSTDTEST),$(RUNSTDTESTSRC),runstdtest) +#endif /* ! UseInstalledUtils */ +#endif /* RunStdTestNeededHere */ +RUNSTDTEST = RunStdTestCmd +#ifndef UseInstalledUtils +RUNSTDTESTSRC = $(SCRIPTSRC) +#endif +\end{code} + +%************************************************************************ +%* * +\subsection[mkworld-utils-flags]{Feeding flags to them} +%* * +%************************************************************************ + +\begin{code} +/* for the whole nasty business of flags for programs, + some naming conventions are worth remembering; for program <foo>: + + <foo>FLAGS what is actually passed to <foo>; usually + built from pieces below + + ALLPROJ_<foo>_<things> <things> needed for _all_ runs of <foo>; + probably set in one of the AllProject* + config files. + PLAT_<foo>_<things> <things> (options, defines, etc.) needed for + all runs of <foo> *on this platform*; + probably set in <platform>.cf. + PROJ_<foo>_<things> <things> needed for all runs of <foo> + related to this project; probably set in + one of the Project-* config files. + <foo>_<things> <things> needed for runs of <foo> in this + directory; set in its Jmakefile. + EXTRA_<foo>_<things> name reserved for adding <things> from the + command line. + GLUED_<foo>_<things> all the above, glued together; not for + human use. + + <foo>_OPTS the usual name for options + <foo>_DEFINES CPP #defines + <foo>_INCLUDES CPP #includes + <foo>_IMPORTS Haskell "import"s + + As a contrived example, the "makeinfo" program is usually called + with the $(MAKEINFOFLAGS), which would likely be put together as... + + ALLPROJ_MAKEINFO_OPTS = + PLAT_MAKEINFO_OPTS = + PROJ_MAKEINFO_OPTS = + MAKEINFO_OPTS = + EXTRA_MAKEINFO_OPTS = + GLUED_MAKEINFO_OPTS = + MAKEINFOFLAGS = $(GLUED_MAKEINFO_OPTS) + + and used as... + + $(MAKEINFO) $(MAKEINFOFLAGS) ... + + The related CPP names are as you would expect: e.g., + ProjectMakeinfoOpts for PROJ_MAKEINFO_OPTS, ... + + For systems of interacting programs (e.g., cpp, cc, lint, as, and ld), + things can be [considerably] messier. + +*/ + +/* CPP definitions for CPP #includes; -I must be explicit */ + +/* I have not separated use of CPP w/ CC vs standalone... */ + +#ifndef AllProjectsCppIncludes +#define AllProjectsCppIncludes /*none*/ +#endif +#ifndef PlatformCppIncludes +#define PlatformCppIncludes /*none*/ +#endif +#ifndef ProjectCppIncludes +#define ProjectCppIncludes /*none*/ +#endif +#ifndef SetupCppIncludes +#define SetupCppIncludes /*none*/ +#endif +GenerateOptionsMakeVars(CPP,INCLUDES,AllProjectsCppIncludes,PlatformCppIncludes,ProjectCppIncludes,SetupCppIncludes) + +/* CPP definitions for #defines */ + +#ifndef AllProjectsCppDefines +#define AllProjectsCppDefines /*none*/ +#endif +#ifndef PlatformCppDefines +#define PlatformCppDefines /**/ +#endif /* PlatformCppDefines */ +#ifndef ProjectCppDefines +#define ProjectCppDefines /*none*/ +#endif +#ifndef SetupCppDefines +#define SetupCppDefines /*none*/ +#endif +GenerateOptionsMakeVars(CPP,DEFINES,AllProjectsCppDefines,PlatformCppDefines,ProjectCppDefines,SetupCppDefines) + +/*# C-compiler (and cpp ... and lint) options */ + +#ifndef AllProjectsCcOpts +#define AllProjectsCcOpts /*none*/ +#endif +#ifndef PlatformCcOpts +#define PlatformCcOpts /*none*/ +#endif +#ifndef ProjectCcOpts +#define ProjectCcOpts /*none*/ +#endif +#ifndef SetupCcOpts +#define SetupCcOpts /*none*/ +#endif +GenerateOptionsMakeVars(CC,OPTS,AllProjectsCcOpts,PlatformCcOpts,ProjectCcOpts,SetupCcOpts) + +CFLAGS = $(GLUED_CPP_INCLUDES) $(GLUED_CPP_DEFINES) $(GLUED_CC_OPTS) + +/*# Haskell compiler (and cpp ... and lint) options */ + +#ifndef AllProjectsHcOpts +#define AllProjectsHcOpts /*none*/ +#endif +#ifndef PlatformHcOpts +#define PlatformHcOpts /*none*/ +#endif +#ifndef ProjectHcOpts +#define ProjectHcOpts /*none*/ +#endif +#ifndef SetupHcOpts +#define SetupHcOpts /*none*/ +#endif +GenerateOptionsMakeVars(HC,OPTS,AllProjectsHcOpts,PlatformHcOpts,ProjectHcOpts,SetupHcOpts) + +#ifndef AllProjectsHcImports +#define AllProjectsHcImports /*none*/ +#endif +#ifndef PlatformHcImports +#define PlatformHcImports /*none*/ +#endif +#ifndef ProjectHcImports +#define ProjectHcImports /*none*/ +#endif +#ifndef SetupHcImports +#define SetupHcImports /*none*/ +#endif +GenerateOptionsMakeVars(HC,IMPORTS,AllProjectsHcImports,PlatformHcImports,ProjectHcImports,SetupHcImports) +HCFLAGS = $(GLUED_HC_IMPORTS) $(GLUED_CPP_DEFINES) $(GLUED_HC_OPTS) + +/*# linker options */ + +#ifndef AllProjectsLdOpts +#define AllProjectsLdOpts /*none*//* -X -r "combine" flags (?) */ +#endif +#ifndef PlatformLdOpts +#define PlatformLdOpts /*none*/ +#endif +#ifndef ProjectLdOpts +#define ProjectLdOpts /*none*/ +#endif +#ifndef SetupLdOpts +#define SetupLdOpts /*none*/ +#endif +#ifndef AllProjectsLdLibraries +#define AllProjectsLdLibraries /*none*/ +#endif +#ifndef PlatformLdLibraries +#define PlatformLdLibraries /*none*/ +#endif +#ifndef ProjectLdLibraries +#define ProjectLdLibraries /*none*/ +#endif +#ifndef SetupLdLibraries +#define SetupLdLibraries /*none*/ +#endif +GenerateOptionsMakeVars(LD,OPTS,AllProjectsLdOpts,PlatformLdOpts,ProjectLdOpts,SetupLdOpts) +GenerateOptionsMakeVars(LD,LIBRARIES,AllProjectsLdLibraries,PlatformLdLibraries,ProjectLdLibraries,SetupLdLibraries) +LDOPTIONS = $(GLUED_LD_OPTS) /* ToDo: and the libraries ? */ + +/* lint stuff not tidied up yet */ + +#ifndef LintLibFlag +#define LintLibFlag -C +#endif +#ifndef LintOpts +#define LintOpts -axz +#endif +LINTLIBFLAG = LintLibFlag +LINTOPTS = LintOpts +LINTFLAGS = $(LINTOPTS) -DLINT $(GLUED_CPP_INCLUDES) $(GLUED_CPP_DEFINES) + +/*# literate-stuff options */ + +/* some options are common (general) to all lit2* pgms; others specific */ + +#ifndef AllProjectsGenLitOpts +#define AllProjectsGenLitOpts /*none*/ +#endif +#ifndef PlatformGenLitOpts +#define PlatformGenLitOpts /*none*/ +#endif +#ifndef ProjectGenLitOpts +#define ProjectGenLitOpts /*none*/ +#endif +#ifndef SetupGenLitOpts +#define SetupGenLitOpts /*none*/ +#endif +GenerateOptionsMakeVars(GENLIT,OPTS,AllProjectsGenLitOpts,PlatformGenLitOpts,ProjectGenLitOpts,SetupGenLitOpts) + +#ifndef AllProjectsLit2pgmOpts +#define AllProjectsLit2pgmOpts /*none*/ +#endif +#ifndef PlatformLit2pgmOpts +#define PlatformLit2pgmOpts /*none*/ +#endif +#ifndef ProjectLit2pgmOpts +#define ProjectLit2pgmOpts /*none*/ +#endif +#ifndef SetupLit2pgmOpts +#define SetupLit2pgmOpts /*none*/ +#endif +GenerateOptionsMakeVars(LIT2PGM,OPTS,AllProjectsLit2pgmOpts,PlatformLit2pgmOpts,ProjectLit2pgmOpts,SetupLit2pgmOpts) +#ifndef AllProjectsLit2texiOpts +#define AllProjectsLit2texiOpts /*none*/ +#endif +#ifndef PlatformLit2texiOpts +#define PlatformLit2texiOpts /*none*/ +#endif +#ifndef ProjectLit2texiOpts +#define ProjectLit2texiOpts /*none*/ +#endif +#ifndef SetupLit2texiOpts +#define SetupLit2texiOpts /*none*/ +#endif +GenerateOptionsMakeVars(LIT2TEXI,OPTS,AllProjectsLit2texiOpts,PlatformLit2texiOpts,ProjectLit2texiOpts,SetupLit2texiOpts) +#ifndef AllProjectsLit2latexOpts +#define AllProjectsLit2latexOpts /*none*/ +#endif +#ifndef PlatformLit2latexOpts +#define PlatformLit2latexOpts /*none*/ +#endif +#ifndef ProjectLit2latexOpts +#define ProjectLit2latexOpts /*none*/ +#endif +#ifndef SetupLit2latexOpts +#define SetupLit2latexOpts /*none*/ +#endif +GenerateOptionsMakeVars(LIT2LATEX,OPTS,AllProjectsLit2latexOpts,PlatformLit2latexOpts,ProjectLit2latexOpts,SetupLit2latexOpts) +#ifndef AllProjectsLit2changelogOpts +#define AllProjectsLit2changelogOpts /*none*/ +#endif +#ifndef PlatformLit2changelogOpts +#define PlatformLit2changelogOpts /*none*/ +#endif +#ifndef ProjectLit2changelogOpts +#define ProjectLit2changelogOpts /*none*/ +#endif +#ifndef SetupLit2changelogOpts +#define SetupLit2changelogOpts /*none*/ +#endif +GenerateOptionsMakeVars(LIT2CHANGELOG,OPTS,AllProjectsLit2changelogOpts,PlatformLit2changelogOpts,ProjectLit2changelogOpts,SetupLit2changelogOpts) +#ifndef AllProjectsMkDependLitOpts +#define AllProjectsMkDependLitOpts /*none*/ +#endif +#ifndef PlatformMkDependLitOpts +#define PlatformMkDependLitOpts /*none*/ +#endif +#ifndef ProjectMkDependLitOpts +#define ProjectMkDependLitOpts /*none*/ +#endif +#ifndef SetupMkDependLitOpts +#define SetupMkDependLitOpts /*none*/ +#endif +GenerateOptionsMakeVars(MKDEPENDLIT,OPTS,AllProjectsMkDependLitOpts,PlatformMkDependLitOpts,ProjectMkDependLitOpts,SetupMkDependLitOpts) + +LIT2PGMFLAGS = $(GLUED_GENLIT_OPTS) $(GLUED_LIT2PGM_OPTS) +LIT2TEXIFLAGS = $(GLUED_GENLIT_OPTS) $(GLUED_LIT2TEXI_OPTS) +LIT2LATEXFLAGS = $(GLUED_GENLIT_OPTS) $(GLUED_LIT2LATEX_OPTS) +LIT2CHANGELOGFLAGS = $(GLUED_GENLIT_OPTS) $(GLUED_LIT2CHANGELOG_OPTS) +MKDEPENDLITFLAGS = $(GLUED_GENLIT_OPTS) $(GLUED_MKDEPENDLIT_OPTS) + +/* same for other MkDepend things */ + +#ifndef AllProjectsMkDependCOpts +#define AllProjectsMkDependCOpts /*none*/ +#endif +#ifndef PlatformMkDependCOpts +#define PlatformMkDependCOpts /*none*/ +#endif +#ifndef ProjectMkDependCOpts +#define ProjectMkDependCOpts /*none*/ +#endif +#ifndef SetupMkDependCOpts +#define SetupMkDependCOpts /*none*/ +#endif +GenerateOptionsMakeVars(MKDEPENDC,OPTS,AllProjectsMkDependCOpts,PlatformMkDependCOpts,ProjectMkDependCOpts,SetupMkDependCOpts) +MKDEPENDCFLAGS = $(GLUED_MKDEPENDC_OPTS) + +#ifndef AllProjectsMkDependHSOpts +#define AllProjectsMkDependHSOpts /*none*/ +#endif +#ifndef PlatformMkDependHSOpts +#define PlatformMkDependHSOpts /*none*/ +#endif +#ifndef ProjectMkDependHSOpts +#define ProjectMkDependHSOpts /*none*/ +#endif +#ifndef SetupMkDependHSOpts +#define SetupMkDependHSOpts /*none*/ +#endif +GenerateOptionsMakeVars(MKDEPENDHS,OPTS,AllProjectsMkDependHSOpts,PlatformMkDependHSOpts,ProjectMkDependHSOpts,SetupMkDependHSOpts) +MKDEPENDHSFLAGS = $(GLUED_MKDEPENDHS_OPTS) + +/* same for tags stuff */ + +#ifndef AllProjectsCTagsOpts +#define AllProjectsCTagsOpts -e -w /* emacs-style; no warnings */ +#endif +#ifndef PlatformCTagsOpts +#define PlatformCTagsOpts /*none*/ +#endif +#ifndef ProjectCTagsOpts +#define ProjectCTagsOpts /*none*/ +#endif +#ifndef SetupCTagsOpts +#define SetupCTagsOpts /*none*/ +#endif +GenerateOptionsMakeVars(CTAGS,OPTS,AllProjectsCTagsOpts,PlatformCTagsOpts,ProjectCTagsOpts,SetupCTagsOpts) +CTAGSFLAGS = $(GLUED_CTAGS_OPTS) + +#ifndef AllProjectsPerlTagsOpts +#define AllProjectsPerlTagsOpts /*none*/ +#endif +#ifndef PlatformPerlTagsOpts +#define PlatformPerlTagsOpts /*none*/ +#endif +#ifndef ProjectPerlTagsOpts +#define ProjectPerlTagsOpts /*none*/ +#endif +#ifndef SetupPerlTagsOpts +#define SetupPerlTagsOpts /*none*/ +#endif +GenerateOptionsMakeVars(PERLTAGS,OPTS,AllProjectsPerlTagsOpts,PlatformPerlTagsOpts,ProjectPerlTagsOpts,SetupPerlTagsOpts) +PERLTAGSFLAGS = $(GLUED_PERLTAGS_OPTS) + +/* and for "runstdtest" */ + +#ifndef AllProjectsRunStdTestOpts +#define AllProjectsRunStdTestOpts /*none*/ +#endif +#ifndef PlatformRunStdTestOpts +#define PlatformRunStdTestOpts /*none*/ +#endif +#ifndef ProjectRunStdTestOpts +#define ProjectRunStdTestOpts /*none*/ +#endif +#ifndef SetupRunStdTestOpts +#define SetupRunStdTestOpts /*none*/ +#endif +GenerateOptionsMakeVars(RUNSTDTEST,OPTS,AllProjectsRunStdTestOpts,PlatformRunStdTestOpts,ProjectRunStdTestOpts,SetupRunStdTestOpts) +RUNSTDTEST_FLAGS = $(GLUED_RUNSTDTEST_OPTS) + +/* CPP definitions for #defines */ + +#ifndef AllProjectsJmakeDefines +#define AllProjectsJmakeDefines /*none*/ +#endif +#ifndef PlatformJmakeDefines +#define PlatformJmakeDefines /**/ +#endif /* PlatformJmakeDefines */ +#ifndef ProjectJmakeDefines +#define ProjectJmakeDefines /*none*/ +#endif +#ifndef SetupJmakeDefines +#define SetupJmakeDefines /*none*/ +#endif +GenerateOptionsMakeVars(JMAKE,DEFINES,AllProjectsJmakeDefines,PlatformJmakeDefines,ProjectJmakeDefines,SetupJmakeDefines) +JMAKEFLAGS = $(GLUED_JMAKE_DEFINES) +\end{code} |