# Makefile.Host for base/src/sample # # # Sample Makefile.Host showing all possible entries # that are allowed using RULES.Host. # # 8-01-96 -kuk- # # TOP = ../../.. include $(TOP)/config/CONFIG_BASE CMPLR = STRICT # Add-on CFLAGS that are needed in this subproject. # (If possible, all system specific flags should be # defined in CONFIG.$(ARCH_CLASS)) # # Whenever possible, ONLY USR_CFLAGS should be # used. If you need special flags for your system, # try to put them in CONFIG.YourSystem! # # This is used on all systems: USR_CFLAGS := -DVAR=value -Ddefine_for_all_systems # This is added to the above, but only for ARCH_CLASS=BSD: USR_CFLAGS_BSD := -DVERSION='Berkeley enhanced' # ..only for WIN32: USR_CFLAGS_WIN32 := -DVERSION='WIN32 port' # # -nil- is special: # if USR_CFLAGS_SYSV was undefined or empty, .._DEFAULT would have # been used. # To indicate # "yes, there is a special USR_CFLAGS for SYSV, but it's empty" # you have to set it to -nil-: USR_CFLAGS_SYSV := -nil- # .. for all other arch classes: USR_CFLAGS_DEFAULT := -DVERSION='generic Unix' # CFLAGS that are only used to compile a_file.c or a_file.cc: # a_file_CFLAGS := -DIN_A_FILE # --------------------------------------------------------- # general rule for all .c .cc .h .hh files and scripts: # # In here you supply just the filename without '../' etc. # While building in an O.xxx subdir, the # sources are extracted from either the # '..' # dir or - if it exists - the dir # '../$(ARCH_CLASS)' # is preferred. # --------------------------------------------------------- # includes to install from this sub-project # # again: if INC_$(ARCH_CLASS) is defined, it is added to INC, # otherwise INC_DEFAULT (if defined) is added: # INC_DEFAULT := for_all_but_WIN32_or_hp700.h INC_WIN32 := only_for_WIN32.h INC_hp700 := -nil- # hp700 uses no special include INC := file.h # -------------------------------------------------------------------- # defining a library # -------------------------------------------------------------------- # # Contents of a library are specified via LIBSRCS. # From this the platform specific object names (.o, .obj, ...) # are derived automatically. # # Platform specific objects: # use LIBOBJS_$(ARCH_CLASS) or .._DEFAULT # # Platform specific files can also be put in # separate os/ARCH_CLASS directories! # # For almost every file the seach order is: # ./os/ARCH_CLASS # ./os/generic # . # So usually only LIBSRCS should be sufficient! # LIBSRCS := file_for_lib.c another_file.cc LIBSRCS_DEFAULT := posix.c LIBSRCS_WIN32 := win32_special.c LIBSRCS_BSD := -nil- # Type of library to build. # On WIN32, SHARED results in a DLL, others may ignore this. LIBTYPE:=SHARED # Ugly but necessary for WIN32: # If LIBRARY is build as a dll, it may need other libraries # to link with that you specify here. # (because a dll is similar to a program: # all references have to be resolved) # # If there is a file ../$(LIBRARY).def, it will # be used as the dll-def-file on WIN32 # # We need this flag because # 1) you may not use a def file ('proper' code needs no def files) # 2) you may have one and still not want a DLL (for testing etc.) # DLL_LIBS:=some_dll # Library to build: # lib$(LIBRARY).a or ..dll/..exp/..lib # # Currently you can build only one (1) lib per Makefile.Host! # LIBRARY:=libname # -------------------------------------------------------------------- # defining products (executable programs) # -------------------------------------------------------------------- # # if SRCS is undefined, it defaults to $(PROD).c SRCS=a.c b.c c.c # libs needed to link PROD and TESTPROD # # for all systems: PROD_LIBS := Com Ca # for most systems: PROD_LIBS_DEFAULT := mathlib PROD_LIBS_WIN32 := -nil- # Product, # may be caRepeater.o -> caRepeater # or caRepeater.obj -> caRepeater.exe PROD := prod PROD_DEFAULT := product_for_rest PROD_WIN32 := product_only_for_WIN32 PROD_BSD := product_only_for_BSD PROD_SYSV := product_only_for_SYSV # Scripts to install # # If there is both ../$(SCRIPT) and ../$(ARCH_CLASS)/$(SCRIPT), # the latter, system specific version will be installed! # SCRIPTS_DEFAULT := script_for_rest SCRIPTS_WIN32 := script_only_for_WIN32 SCRIPTS_BSD := script_only_for_BSD SCRIPTS := script # uncomment if you want to build these locally without installing: # TESTPROD = test # Unfortunately the above allows you only to # 1) build one PROD:=p from many SRCS:=a.c b.c c.c # or # 2) build many PROD:=a b c each from a single source (a.c, b.c, c.c) # # If you have several multi-source products in the same dir # you have to fall back to explicit rules. # (suggestions for a better syntax welcome!) # # The explicit rules, however, should look like the following: # be careful if you add rules and dependencies: # use $(MV) $(RM) $(CP) $(MKDIR) $(RMDIR) $(OBJ) $(EXE) $(LINK.c) .... xxxxx$(OBJ): c1.c c2.c h1.h # because the output-flag (mostly '-o $@' on Unix, '-Fe$@' on WIN32) # is also system dependend, it's included in $(LINK.c) and $(LINK.cc) ! # prog$(EXE): a$(OBJ) b$(OBJ) $(LINK.c) a$(OBJ) b$(OBJ) $(LDLIBS) clean:: $(RM) dbLex.c include $(TOP)/config/RULES.Host # EOF Makefile.Host