# ***************************** Module Header ******************************* # # Module Name: rules.in - external version V1.10, changed # # Generic include file to setup compiler and linker flags and some # specific implicit rules - See description below. # # This creates a compile and either debug or release directory # automatically, where files created by the defined rules are put. # # --- IMPORTANT --- IMPORTANT --- IMPORTANT --- IMPORTANT --- IMPORTANT --- # # Create a file named project.in within the same directory in order to # make project specific extensions like additional diectories and macro # extensions or replacements. DO NOT MODIFY THIS FILE FOR SUCH PURPOSES! # # Provided rules allow only one EXE or DLL to be linked per makefile # in one call. Use a different set of pseudo targets within the calling # makefile in order to distinct between the creation of one or more # executables or one or more DLLs and let the makefile call itself several # times in order to create one executable or DLL with each call. # # --- IMPORTANT --- IMPORTANT --- IMPORTANT --- IMPORTANT --- IMPORTANT --- # # Automatically supported compilers: # - IBM C Set/2 # - IBM Visual Age C++ V3 (may also run with IBM Visual Age C++ V4) # # Copyright (c) Netlabs EPM Distribution Project 2002 # # $Id$ # # =========================================================================== # # This file sets up rules for # .c.obj - c in current or srcdir, obj in bindir # .rc.res rc in current or srcdir, res in cmpdir # .obj.dll - obj and dll in bindir # .obj.exe - obj and exe in bindir # .obj.lib - obj and lib in bindir (either code libs or imp libs) # # Specify the following values before calling nmake: # # MANDANTORY: # ----------- # BASEDIR - relative path specification to this file from the calling makefile # (e.g. BASEDIR=..\..) # # OPTIONAL: # --------- # DEBUG - compile debug binaries default: non-debug binaries # SRCDIR - subdirectory for c sourcefiles default: empty # (INCLUDE will be extended with this) # # C_FAGS_USER - additional compiler flags default: empty # L_FAGS_USER - additional linker flags default: empty # RC_FLAGS_USER - additional resource compiler flags default: empty # # OBJS - more objects to be linked (include in dependency list!) default: empty # OBJS1 - more objects to be linked (include in dependency list!) default: empty # OBJS2 - more objects to be linked (include in dependency list!) default: empty # DLL - compile a DLL default: compile an EXE # LIBS - own libs to be linked (include in dependency list !) default: empty # EXTLIBS - external libs (don not include in dependency list!) default: empty # DEF - definition file (include in dependency list !) default: no def file # RES - resource file (include in dependency list !) default: file with name of exe/dll # DLLEXT - use another filename extension instead of .dll default: use '.dll' # PMPRINTF - if defined: link $(BINDIR)\printf.obj default: undefined # # MT - compile with multithread support default: single-thread # OPTIMIZE - define this to have optimized non-debug binaries default: no otpimization # LXLITE - define this to compress non-debug binaries default: no compression # IMPLIB - build import libs default: build code libs # # --------------------------------------------------------------------------- # # The following values are set and used for implicit rules. # They can also be used for explicit commands: # # CC - name of the compiler executable # SC - name of the SOM precompiler # LL - name of the linker executable # CLIB - name of the code library manager executable # ILIB - name of the import library manager executable # RC - name of the resource compiler executable # # C_FLAGS - compiler flags according to the DEBUG setting # SC_FLAGS - SPM precompiler flags # L_FLAGS - linker flags according to the DEBUG setting # RC_FLAGS - resource compiler flags according to the DEBUG setting # PMPRINTF - PMPrintf object file for DEBUG mode or empty # # For makefiles requiring to build DEBUG/RELEASE executables in one run, # you can copy the commands from the implicit rules within this file to # your makefile and replace the *_FLAGS_* macro with one of the following: # # C_FLAGS_MAIN - compiler flags without any debug/release settings # L_FLAGS_MAIN - linker flags without any debug/release settings # RC_FLAGS_MAIN - resource compiler flags without any debug/release settings # # C_FLAGS_DEBUG - compiler flags with debug settings # L_FLAGS_DEBUG - linker flags with debug settings # RC_FLAGS_DEBUG - resource compiler flags with debug settings # # C_FLAGS_RELEASE - compiler flags with debug settings # L_FLAGS_RELEASE - linker flags with debug settings # RC_FLAGS_RELEASE - resource compiler flags with debug settings # # =========================================================================== # # This file is part of the Netlabs EPM Distribution package and is free # software. You can redistribute it and/or modify it under the terms of the # GNU General Public License as published by the Free Software # Foundation, in version 2 as it comes in the "COPYING" file of the # Netlabs EPM Distribution. This library is distributed in the hope that it # will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty # of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # *************************************************************************** !ifndef BASEDIR !Error in rules.in: BASEDIR must be set in your makfile before including this file. !endif # --- extend include path if source dir is given !ifdef SRCDIR !endif # --- determine dll extension !ifndef DLLEXT DLLEXT=.dll !endif # --- determine current debug option !ifdef NDEBUG !undef DEBUG !endif # --- determine DEBUG related options !ifdef DEBUG !undef LXLITE !undef OPTIMIZE !endif # --- create compile directory depending on debug option # Store debug and release names separately to always include both of them # in 'clean' target. BINDEBDIR_NAME=debug BINDEBDIR=$(BASEDIR)\$(BINDEBDIR_NAME) BINRELDIR_NAME=release BINRELDIR=$(BASEDIR)\$(BINRELDIR_NAME) !ifdef DEBUG BINDIR_NAME=$(BINDEBDIR_NAME) DEBUG_STATUS=active !else BINDIR_NAME=$(BINRELDIR_NAME) DEBUG_STATUS=inactive !endif BINDIR=$(BASEDIR)\$(BINDIR_NAME) !if [@md $(BINDIR) 2> NUL] !endif CMPDIR_NAME=compile CMPDIR=$(BASEDIR)\$(CMPDIR_NAME) !if [@md $(CMPDIR) 2> NUL] !endif # always include compile directory in include path INCLUDE=$(INCLUDE);$(CMPDIR); # --- cleanup list for directories created here for main makefile # This macro should be used in the main makefile of a project only # in order to cleanup temporary directories. Extend this macro in # the file project.in when creating additional directories, that should # also be cleaned up. DIRSTOCLEAN=$(BINDEBDIR) $(BINRELDIR) $(CMPDIR) # --- define compiler and toolkit specific options # common options CC=icc RC=rc SC=sc C_FLAGS_BASE=-q -c -Ss+ -Sp1 L_FLAGS_BASE=/A:4 /E /NOI /NOE /NOL /NOLOGO /MAP SC_FLAGS=-maddstar -S128000 -C128000 -mnoint -v !ifdef CPPLOCAL # - VAC3 - CLIB=ilib ILIB=ilib LL=ilink C_FLAGS_COMPILER=-W3 -Wcnd- L_FLAGS_LINKER= /NOFREE !else # - IBM C/Set2 - CLIB=lib ILIB=implib LL=link386 C_FLAGS_COMPILER=-W3 L_FLAGS_LINKER=/BATCH !endif # --- define executable specific options EXE_L_FLAGS= /BASE:0X10000 DLL_L_FLAGS= /BASE:0X120000 !ifdef DLL C_FLAGS_EXETYPE=-Ge- !endif # --- define optimize option !ifdef OPTIMIZE C_FLAGS_OPT=-O+ !else C_FLAGS_OPT=-O- !endif # --- define threading option !ifdef MT C_FLAGS_MT=-Gm+ !else C_FLAGS_MT=-Gm- !endif # --- concatenate main options (all without DEBUG options) C_FLAGS_MAIN=$(C_FLAGS_BASE) $(C_FLAGS_COMPILER) $(C_FLAGS_EXETYPE) $(C_FLAGS_OPT) $(C_FLAGS_MT) $(C_FAGS_USER) L_FLAGS_MAIN=$(L_FLAGS_LINKER) $(L_FLAGS_BASE) $(L_FAGS_USER) RC_FLAGS_MAIN=$(RC_FLAGS_USER) # --- define debug options (always both) C_FLAGS_DEBUG=$(C_FLAGS_MAIN) -Tm -Ti+ -DDEBUG L_FLAGS_DEBUG=$(L_FLAGS_MAIN) /CO RC_FLAGS_DEBUG=$(RC_FLAGS_MAIN) -D DEBUG C_FLAGS_RELEASE=$(C_FLAGS_MAIN) -Ti- -DNDEBUG L_FLAGS_RELEASE=$(L_FLAGS_MAIN) RC_FLAGS_RELEASE=$(RC_FLAGS_MAIN) -D NDEBUG # --- define debug options !ifdef DEBUG C_FLAGS=$(C_FLAGS_DEBUG) L_FLAGS=$(L_FLAGS_DEBUG) RC_FLAGS=$(RC_FLAGS_DEBUG) !ifdef PMPRINTF PMPRINTF=$(BINDIR)\printf.obj !endif !else C_FLAGS=$(C_FLAGS_RELEASE) L_FLAGS=$(L_FLAGS_RELEASE) RC_FLAGS=$(RC_FLAGS_RELEASE) PMPRINTF= !endif # --- suffix list .SUFFIXES: .exe .obj .c .obj .idl .ih .lib .dll .lst .def .rc .res $(DLLEXT) # --- implicit rules # - SOM precompiler rules !ifdef SRCDIR {$(SRCDIR)}.idl.c: $(SC) $(SC_FLAGS) -s "c" $(SRCDIR)\$(@B).idl @touch $(@B).c {$(SRCDIR)}.idl.ih: $(SC) $(SC_FLAGS) -s "ih" $(SRCDIR)\$(@B).idl {$(SRCDIR)}.idl.h: $(SC) $(SC_FLAGS) -s "h" $(SRCDIR)\$(@B).idl {$(SRCDIR)}.idl.def: $(SC) $(SC_FLAGS) -s "def" $(SRCDIR)\$(@B).idl {$(SRCDIR)}.idl{$(CMPDIR)}.ih: $(SC) $(SC_FLAGS) -s "ih" -d $(CMPDIR) $(SRCDIR)\$(@B).idl {$(SRCDIR)}.idl{$(CMPDIR)}.h: $(SC) $(SC_FLAGS) -s "h" -d $(CMPDIR) $(SRCDIR)\$(@B).idl {$(SRCDIR)}.idl{$(CMPDIR)}.def: $(SC) $(SC_FLAGS) -s "def" -d $(CMPDIR) $(SRCDIR)\$(@B).idl !else .idl.c: $(SC) $(SC_FLAGS) -s "c" $(@B).idl @touch $(@B).c .idl.ih: $(SC) $(SC_FLAGS) -s "ih" $(@B).idl .idl.h: $(SC) $(SC_FLAGS) -s "h" $(@B).idl .idl.def: $(SC) $(SC_FLAGS) -s "def" $(@B).idl .idl{$(CMPDIR)}.ih: $(SC) $(SC_FLAGS) -s "ih" -d $(CMPDIR) $(@B).idl .idl{$(CMPDIR)}.h: $(SC) $(SC_FLAGS) -s "h" -d $(CMPDIR) $(@B).idl .idl{$(CMPDIR)}.def: $(SC) $(SC_FLAGS) -s "def" -d $(CMPDIR) $(@B).idl !endif # - source to object rules !ifdef SRCDIR {$(SRCDIR)}.c{$(BINDIR)}.obj: $(CC) $(C_FLAGS) -Fo$*.obj $(SRCDIR)\$(@B).c {$(SRCDIR)}.rc{$(CMPDIR)}.res: $(RC) -r $(RC_FLAGS) $(SRCDIR)\$(@B).rc $*.res {$(SRCDIR)}.rc{$(BINDIR)}.res: $(RC) -r $(RC_FLAGS) $(SRCDIR)\$(@B).rc $*.res !else .c{$(BINDIR)}.obj: $(CC) $(C_FLAGS) -Fo$*.obj $(@B).c .rc{$(CMPDIR)}.res: $(RC) -r $(RC_FLAGS) $(@B).rc $*.res .rc{$(BINDIR)}.res: $(RC) -r $(RC_FLAGS) $(@B).rc $*.res !endif # - object to executable rules {$(BINDIR)}.obj{$(BINDIR)}$(DLLEXT): @echo @<NUL 2>&1] !else !include $(PROJECTFILE) !endif