home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
DMAKE35X.ZIP
/
MAKEFILE.MK
< prev
next >
Wrap
Makefile
|
1990-08-15
|
7KB
|
199 lines
# //// Makefile for DMAKE. \\\\
# The target system is characterized by the following macros imported from
# the environment.
#
# OS - gives the class of operating system
# OSRELEASE - optionally gives the particular release of the OS above.
# OSENVIRONMENT - optionally gives the environment under which the above
# OS is in use.
#
# Valid values for the above macros are:
#
# OS - unix, msdos
# OSRELEASE - bsd43, sysvr3, 386ix
# - tccdos, mscdos (valid only of OS == msdos)
# OSENVIRONMENT - uw {valid for unix, bsd43 configuration only.}
# dynix (valid for unix, bsd43 configuration only.)
#
# See the config.mk file in the relevant subdirectories for additional
# comments describing when a setting is applicable.
# First target in the makefile, do this so that targets declared in the
# included files are never marked as being the first *default* target.
first : all ;
# Pull in the configuration macros, from the environment. OS is required,
# OSRELEASE, and OSENVIRONMENT are optional.
.IMPORT : OS
.IMPORT .IGNORE : OSRELEASE OSENVIRONMENT TMPDIR
# Define the source files
SRC =\
infer.c make.c stat.c expand.c string.c hash.c dag.c dmake.c\
path.c imacs.c sysintf.c parse.c getinp.c quit.c\
basename.c dump.c macparse.c rulparse.c percent.c
# Common Include files.
HDR = dmake.h extern.h struct.h vextern.h patchlvl.h version.h
# Define the TARGET we are making, and where the OBJECT files go.
OBJDIR := objects
TARGET = dmake$E
CFLAGS += -DHELP -I. -Icommon
# Pull in the proper configuration file, based on the value of OS.
.INCLUDE : $(OS)/config.mk
# Set the .SOURCE targets so that we look for things in the right place.
.SOURCE.c :^ .NULL
.SOURCE.h :^ .NULL
.SOURCE$O :^ $(OBJDIR)
.PRECIOUS : $(HDR)
# Must come after the above INCLUDE so that it gets ALL objects.
OBJECTS := {$(SRC:b)}$O
# The main target, make sure the objects directory exists first.
# LDARGS is defined in config.mk file of each OS/OSRELEASE combination.
all : $(TARGET);
$(TARGET) : $(OBJDIR)
$(TARGET) : $(OBJECTS); $(LD) $(LDARGS)
# Other obvious targets...
$(OBJDIR):;- mkdir $@
# Meta rule for making .o's from .c's (give our own so we can move object
# to objects directory in a portable, compiler independent way)
%$O: %.c
$(CC) -c $(CFLAGS) $<
mv $(@:f) $(OBJDIR)
# remaining dependencies should be automatically generated
sysintf$O : $(OS)/sysintf.h
$(OBJECTS) : $(HDR)
.SOURCE.h : common
# Define the macros for printing the source, and pull in the
# makefile portion.
PRINTEXCLUDE = $(OBJDIR) $(OBJDIR).dbg test RCS control man common
.INCLUDE : common/print.mk
clean:; $(RM) -rf dmake dbdmake objects*
#--------------------------------------------------------------------------
# Make the various archives for shipping the thing around.
#
zoo : dmake.zoo ;
shar : dmake.shar;
tar : dmake.tar;
unzoo : dmake.zoo ; zoo xO// dmake.zoo
dmake.zoo .SILENT: src-list
[
echo "" >> $<
echo -n '$@ : $$(ALLSRC);@ zoo aI $$@ < ' >> $<
echo -n '<' >> $<
echo -n '+' >> $<
echo -n '$$(ALLSRC:t"\n")\n' >> $<
echo -n '+' >> $<
echo '>' >> $<
$(MAKECMD) -f $< $@
$(RM) -f $<
]
dmake.shar .SILENT : src-list-shar
[
echo '$@:$$(ALLSRC) ;xshar -vc -o$@ -l40 $$(ALLSRC)' >> $<
$(MAKECMD) -f $< $@
$(RM) -f $<
]
dmake.tar .SILENT : src-list
[
echo '$@:$$(ALLSRC) ;tar -cvf $@ $$(ALLSRC)' >> $<
$(MAKECMD) -f $< $@
$(RM) -f $<
]
src-list .SILENT: clean
echo 'ALLSRC = \' >$@
find . -type f -print |\
sed -e 's/RCS\///' -e 's/,v//' -e 's/$$/\\/' -e 's/^\.\// /'|\
sort -u |\
grep -v tst | grep -v $@ | grep -v LICENSE |\
grep -v '\.zoo' | grep -v '\.tar'| grep -v '\.shar' >> $@
echo ' LICENSE' >> $@
src-list-shar .SILENT: clean
echo 'ALLSRC = \' >$@
find . -print |\
sed -e 's/RCS\///' -e 's/,v//' -e 's/$$/\\/' -e 's/^\.\// /'|\
sort -ur |\
grep -v tst | grep -v $@ | grep -v LICENSE | grep -v RCS |\
grep -v '^\.\\$$' | grep -v '\.zoo' | grep -v '\.tar'|\
grep -v '\.shar' >> $@
echo ' LICENSE' >> $@
#--------------------------------------------------------------------------
# This section can be used to make the necessary script files so that dmake
# can be bootstrapped.
#
# dmake scripts -- makes all the script files at once.
#
SH = $(@:s,-,/,:s/scripts/${SCRIPTFILE})
MS = MAKESTARTUP=$(@:s,-,/,:s/scripts/startup.mk)
scripts: unix-scripts msdos-scripts
# To add a new environment for UNIX, simply create the appropriate entry
# in the style below for the macro which contains the OS, OSRELEASE and
# OSENVIRONMENT flags. Then add the entry as a recipe line for the target
# unix-scripts.
#
unix-bsd43-scripts-flags = OS=unix OSRELEASE=bsd43 OSENVIRONMENT=
unix-sysvr3-scripts-flags = OS=unix OSRELEASE=sysvr3 OSENVIRONMENT=
unix-386ix-scripts-flags = OS=unix OSRELEASE=386ix OSENVIRONMENT=
unix-bsd43-uw-scripts-flags = OS=unix OSRELEASE=bsd43 OSENVIRONMENT=uw
unix-bsd43-dynix-scripts-flags = OS=unix OSRELEASE=bsd43 OSENVIRONMENT=dynix
unix-scripts:
$(MAKE) SCRIPTFILE=make.sh unix-bsd43-scripts
$(MAKE) SCRIPTFILE=make.sh unix-bsd43-uw-scripts
$(MAKE) SCRIPTFILE=make.sh unix-bsd43-dynix-scripts
$(MAKE) SCRIPTFILE=make.sh unix-sysvr3-scripts
$(MAKE) SCRIPTFILE=make.sh unix-386ix-scripts
unix-%-scripts:; $(MAKECMD) -nus $(MS) $($@-flags) >$(SH)
# We make the standard dos scripts here, but we have to go and fix up the
# make.bat file since it contains names of temporary files for the response
# files required by the linker. We need to also construct the response file
# contents. These two functions are performed by the fix-msdos-%-scripts
# meta-target.
#
# To add a new DOS environment just do what is described for adding a new
# unix environment, and then make certain that the fix-msdos-%-scripts target
# performs the correct function for the new environment.
msdos-tccdos-scripts-flags = OS=msdos OSRELEASE=tccdos OSENVIRONMENT=
msdos-mscdos-scripts-flags = OS=msdos OSRELEASE=mscdos OSENVIRONMENT=
msdos-scripts:
$(MAKE) SCRIPTFILE=make.bat msdos-tccdos-scripts
$(MAKE) SCRIPTFILE=make.bat msdos-mscdos-scripts
msdos-%-scripts:
$(MAKE) -nus $(MS) $($@-flags) >$(SH)
$(MAKE) -s $(MAKEMACROS) $(MS) $($@-flags) fix-msdos-$*-scripts
OBJRSP = $(SH:s,fix/,,:s,${SCRIPTFILE},${*:s/dos/obj/}.rsp,)
LIBRSP = $(SH:s,fix/,,:s,${SCRIPTFILE},${*:s/dos/lib/}.rsp,)
DOSOBJ = $(CSTARTUP) $(OBJDIR)/{$(OBJECTS)}
fix-msdos-%-scripts:
sed -e 's,/tmp/mkA..[0-9]*,$(SH:s,fix/,,:d)$(*:s/dos/obj).rsp,'\
-e 's,/tmp/mkB..[0-9]*,$(SH:s,fix/,,:d)$(*:s/dos/lib).rsp,'\
-e 's,/,\\,g' <$(SH:s,fix/,,) >tmp-out
mv -f tmp-out $(SH:s,fix/,,)
mv <+$(DOSOBJ:s,/,\\,:t"+\n")\n+> $(OBJRSP)
mv <+$(LDLIBS:s,/,\\,:t"+\n")\n+> $(LIBRSP)