\mshush\sim\sim.mak
Makefile for Simulation Library
This makefile will create both the ascii version and the gui version of SIM
Target specification
First check if a library is specified, if not, create both the gui and the ascii library.
!if !$d(SIMLIB)
No target was specified so build them both.
all: guisim asciisim
Rebuilding the libraries: first clean all object files, then recreate both libraries.
build: clean all
Target for cleaning
clean: cleanascii cleangui delbatches
Macro definition just to hush the resource.mak warnings.
WIN32=1
Get the global macros and commands.
!include resource.mak
!else
The SIMLIB macro was defined, so create the specified library.
First create the configuration file, then the library and clean the configuration file afterwards.
all: $(CONFIG) $(SIMLIB) noconfig
To clean just one library (the specified library):
clean: cleanone
!endif
Requirements
Check if SIM has been installed, and if the SRCDIR and OBJDIR macros are defined.
!if !$d(SIM)
!message set SIM macro in ..\resource.mak
!error SIM macro should have been defined
!endif
!if !$d(SRCDIR)
!error SRCDIR not defined
!endif
!if !$d(OBJDIR)
!error OBJDIR not defined
!endif
Main targets
How to build the gui version of SIM: just run make on the simgui.mak.
guisim:
echo *** make gui version of sim ***
make -f simgui.mak
How to build the ascii version of SIM: just run make on the simascii.mak.
asciisim:
echo *** make ascii version of sim ***
make -f simascii.mak
Where to find the .c and .obj files:
.path.c = $(SRCDIR)
.path.obj = $(OBJDIR)
Which files to put into the library:
SIMOBJ= clock.obj coutanal.obj control.obj analysis.obj generato.obj \
query.obj handlers.obj conditio.obj entity.obj error.obj \
reports.obj histogra.obj queue.obj \
resource.obj schedule.obj \
screen.obj simevent.obj simulati.obj tertiary.obj
Here is where the real building takes place!
This will make sure the object files exist, remove the old library and put all the object files into the library.
$(SIMLIB) : $(SIMOBJ)
$(RM) $(SIMLIB)
&$(LIBRARIAN) $(SIMLIB) { +$** }
Implicit target: how to create an object file from a source (.c) file.
.c.obj:
$(CC) { $< }
Configuration files
The configuration file for compling and linking the WIN32 (gui) library:
config: $(MKDIR) $(RM)
$(MKDIR) $(OBJDIR)
if not exist $(OBJDIR)\guisim $(RM) $(OBJDIR)\*.obj
if not exist $(OBJDIR)\guisim $(RM) $(OBJDIR)\*.
copy &&|
-D$(DEFINES);HUSH;SIM
-I$(INCLUDES)
-n$(OBJDIR)
$(CCWIN32FLAGS)
| bcc32.cfg >NUL
copy &&|
gui version
| $(OBJDIR)\guisim >NUL
The configuration file for compling and linking the DOS16 (ascii) library:
asciiconfig: $(MKDIR) $(RM)
$(MKDIR) $(OBJDIR)
if not exist $(OBJDIR)\asciisim $(RM) $(OBJDIR)\*.obj
if not exist $(OBJDIR)\asciisim $(RM) $(OBJDIR)\*.
copy &&|
-D$(DEFINES);ASCII
-I$(INCLUDES)
-n$(OBJDIR)
$(CCDOS16FLAGS)
| turboc.cfg >NUL
copy &&|
ascii version
| $(OBJDIR)\asciisim >NUL
Cleaning
Library cleaning: just calling the appropiete makefile:
cleangui:
echo *** cleaning object files of gui version of sim ***
make -f simgui.mak clean
cleanascii:
echo *** cleaning object files of ascii version of sim ***
make -f simascii.mak clean
cleanone: $(RMTREE) noconfig
$(RMTREE) $(OBJDIR)
Cleaning the configuration files:
noconfig: $(RM)
$(RM) *.cfg
Removing the object files:
delobj:
$(RM) $(OBJDIR)\*.obj
Installing
Create several directories and put the include and example files for SIM in those directories.
install: $(MKDIR)
$(MKDIR) $(HUSH)\include\sim > nul
$(MKDIR) $(HUSH)\examples > nul
$(MKDIR) $(HUSH)\examples\sim > nul
cls
echo *** install sim ***
echo *** install sim include files ***
xcopy /s $(SIM)\include\sim $(HUSH)\include\sim > nul
echo *** install sim example files ***
xcopy /s $(SIM)\examples $(HUSH)\examples\sim > nul