Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/nhc98/src/hmake/Makefile

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


include Makefile.inc

OBJDIR   = $(BUILDDIR)/$(OBJ)/hmake
CPPHSOBJDIR = $(BUILDDIR)/$(OBJ)/cpphs
MKPROG   = $(DST)/MkProg$(EXE)
OLDER    = $(DST)/Older$(EXE)
MKCONFIG = $(DST)/MkConfig$(EXE)
RUNHS    = $(DST)/runhs$(EXE)
TARGETS  = $(MKPROG) $(OLDER) $(MKCONFIG) $(RUNHS)

SRCS    = QSort.hs Unlit.hs Utils.hs Tsort.hs FileName.hs \
	  Output.hs Order.hs ListUtil.hs Getmodtime.hs \
          MkProg.hs Compiler.hs PreProcessor.hs \
	  PackageConfig.hs RunAndReadStdout.hs Argv.hs
CPPHSSRCS  = \
	  Text/ParserCombinators/HuttonMeijer.hs \
	  Language/Preprocessor/Cpphs/CppIfdef.hs \
	  Language/Preprocessor/Cpphs/Position.hs \
	  Language/Preprocessor/Cpphs/ReadFirst.hs \
	  Language/Preprocessor/Cpphs/Tokenise.hs \
	  Language/Preprocessor/Cpphs/SymTab.hs \
	  Language/Preprocessor/Cpphs/HashDefine.hs \
	  Language/Preprocessor/Cpphs/MacroPass.hs \
	  Language/Preprocessor/Cpphs/Options.hs
CPPSRCS = Graph.hs GetDep.hs Compat.hs Imports.hs Platform.hs Config.hs
CFGSRCS = RunAndReadStdout.hs Config.hs Compiler.hs Platform.hs
RUNSRCS = runhs.hs
 

OBJS      = $(patsubst %.hs, $(OBJDIR)/%.$O, $(SRCS))
CPPHSOBJS = $(patsubst %.hs, $(CPPHSOBJDIR)/%.$O, $(CPPHSSRCS))
CPPOBJS   = $(patsubst %.hs, $(OBJDIR)/%.$O, $(CPPSRCS))
RAWCPP    = $(patsubst %.hs, %.raw, $(SRCS))
CFGOBJS   = $(patsubst %.hs, $(OBJDIR)/%.$O, $(CFGSRCS))
CFILES    = $(patsubst %.hs, %.$C, $(SRCS))
CPPHSCFILES = $(patsubst %.hs, %.$C, $(patsubst %, ../cpphs/%, $(CPPHSSRCS)))
CPPCFILES = $(patsubst %.hs, %.$C, $(CPPSRCS))
CFGCFILES = $(patsubst %.hs, %.$C, $(CFGSRCS))

AUX     = Makefile* BuildNew* HISTORY README* Summary TODO nhcmakeR cfiles \
          hmake hmake.1

HC = $(LOCAL)nhc98	# can be overridden by caller HC=...
BUILDCOMP = nhc		# override this too if you override HC
HFLAGS = -i../cpphs $(shell echo $(BUILDOPTS)) #-$(CFG)

ifeq "nhc" "$(BUILDCOMP)"
HEAP = -H4M
endif
ifeq "ghc" "$(BUILDCOMP)"
HFLAGS += $(shell ${LOCAL}fixghc ${GHCSYM} -package lang)
endif
ifeq "hbc" "$(BUILDCOMP)"
all: hbc
hbc: CppIfdef.hs
	sed -e 's/System.IO.Unsafe/IOExts/' CppIfdef.hs >hbc
	cp -a hbc CppIfdef.hs
endif


all: $(TARGETS)
config:
	sh $(BUILDDIR)/hmake3.config
cfiles: cleanC $(CFILES) $(CPPCFILES) $(CPPHSCFILES) Older.$C MkConfig.$C runhs.$C
fromC: $(OBJDIR)
	$(HC) $(HFLAGS) -H4M -o $(MKPROG) -d $(OBJDIR) $(CFILES) $(CPPCFILES) \
							$(CPPHSCFILES)
	$(HC) $(HFLAGS)      -o $(OLDER)  -d $(OBJDIR) Older.$C
	$(HC) $(HFLAGS)    -o $(MKCONFIG) -d $(OBJDIR) MkConfig.$C $(CFGCFILES)
	$(HC) $(HFLAGS)      -o $(RUNHS)  -d $(OBJDIR) runhs.$C
	$(STRIP) $(MKPROG) $(OLDER) $(MKCONFIG) $(RUNHS)
clean:
	rm -f $(OBJS) $(CPPOBJS) $(CFGOBJS)
	rm -f $(OBJDIR)/runhs.$O $(OBJDIR)/Older.$O $(OBJDIR)/MkConfig.$O
	rm -f *.hi
cleanC: clean
	rm -f *.hc *.c
realclean: cleanC
	rm -f *.raw *.html haddock.css haskell_icon.gif
	rm -f $(TARGETS)
#package:
#	tar zcvf hmake.tar.gz $(SRCS) $(GCSRCS) $(CPPSRCS) Older.hs MkConfig.hs $(AUX)
haddock: $(RAWCPP)
	haddock -h *.raw
	rm *.raw


$(MKPROG): $(OBJDIR) $(CPPHSOBJDIR) $(OBJS) $(CPPOBJS) $(CPPHSOBJS)
	$(HC) $(HFLAGS) $(HEAP) -o $@  $(OBJS) $(CPPOBJS) $(CPPHSOBJS)
	$(STRIP) $@
$(OLDER): $(OBJDIR) $(OBJDIR)/Older.$O
	$(HC) $(HFLAGS) -o $@  $(OBJDIR)/Older.$O
	$(STRIP) $@
$(MKCONFIG): $(OBJDIR) $(OBJDIR)/MkConfig.$O $(CFGOBJS)
	$(HC) $(HFLAGS) -o $@  $(OBJDIR)/MkConfig.$O $(CFGOBJS)
	$(STRIP) $@
$(RUNHS): $(OBJDIR) $(OBJDIR)/runhs.$O
	$(HC) $(HFLAGS) -o $@ $(OBJDIR)/runhs.$O

%.raw:
	cpp -P -traditional $(patsubst %.raw, %.hs, $@) > $@

$(OBJDIR):
	mkdir -p $@ || $(TRUE)
$(CPPHSOBJDIR):
	mkdir -p $@ || $(TRUE)
	mkdir -p $@/Text/ParserCombinators || $(TRUE)
	mkdir -p $@/Language/Preprocessor/Cpphs || $(TRUE)
$(OBJS) : $(OBJDIR)/%.$O : %.hs
	$(HC) $(HFLAGS) -c -o $@ $<
$(CPPHSOBJS) : $(CPPHSOBJDIR)/%.$O : ../cpphs/%.hs
	$(HC) $(HFLAGS) -c -o $@ $<
$(CPPOBJS) $(OBJDIR)/Older.$O $(OBJDIR)/MkConfig.$O $(OBJDIR)/runhs.$O : $(OBJDIR)/%.$O : %.hs
	$(HC) $(HFLAGS) -c -cpp -o $@ $<

$(CFILES) : %.$C : %.hs
	$(HC) $(HFLAGS) -C $<
$(CPPCFILES) Older.$C MkConfig.$C runhs.$C : %.$C : %.hs
	$(HC) $(HFLAGS) -C -cpp $<
$(CPPHSCFILES) : %.$C : %.hs
	$(HC) $(HFLAGS) -C $<

# dependencies generated by hmake -Md:
${OBJDIR}/Output.$O:	${OBJDIR}/ListUtil.$O ${OBJDIR}/FileName.$O \
			${OBJDIR}/Argv.$O ${OBJDIR}/PreProcessor.$O \
			${OBJDIR}/Config.$O ${OBJDIR}/RunAndReadStdout.$O
${OBJDIR}/Utils.$O:	${OBJDIR}/Compat.$O ${OBJDIR}/ListUtil.$O 
${OBJDIR}/Tsort.$O:	${OBJDIR}/Compat.$O 
${OBJDIR}/Graph.$O:	${OBJDIR}/Compat.$O ${OBJDIR}/ListUtil.$O 
${OBJDIR}/QSort.$O:	
${OBJDIR}/Compat.$O:	${OBJDIR}/ListUtil.$O ${OBJDIR}/QSort.$O 
${OBJDIR}/Order.$O:	${OBJDIR}/Compat.$O ${OBJDIR}/Graph.$O \
			${OBJDIR}/ListUtil.$O ${OBJDIR}/Tsort.$O \
			${OBJDIR}/Utils.$O 
${OBJDIR}/PreProcessor.$O: ${OBJDIR}/Argv.$O ${OBJDIR}/Compiler.$O \
			${OBJDIR}/Config.$O ${OBJDIR}/Unlit.$O 
${OBJDIR}/Unlit.$O:	
${OBJDIR}/FileName.$O:	${OBJDIR}/Argv.$O 
${OBJDIR}/Imports.$O:	${OBJDIR}/ListUtil.$O \
			${CPPHSOBJDIR}/Language/Preprocessor/Cpphs/CppIfdef.$O
${OBJDIR}/Getmodtime.$O: 
${OBJDIR}/GetDep.$O:	${OBJDIR}/Getmodtime.$O ${OBJDIR}/Imports.$O \
			${OBJDIR}/FileName.$O ${OBJDIR}/Unlit.$O \
			${OBJDIR}/Argv.$O ${OBJDIR}/PreProcessor.$O \
			${OBJDIR}/Config.$O 
${OBJDIR}/RunAndReadStdout.$O:	${OBJDIR}/Platform.$O
${OBJDIR}/PackageConfig.$O:	${OBJDIR}/Config.$O ${OBJDIR}/Compiler.$O \
			${OBJDIR}/Platform.$O ${OBJDIR}/RunAndReadStdout.$O 
${OBJDIR}/Platform.$O:	
${OBJDIR}/Config.$O:	${OBJDIR}/Compiler.$O ${OBJDIR}/Platform.$O \
			${OBJDIR}/RunAndReadStdout.$O 
${OBJDIR}/Compiler.$O:	
${OBJDIR}/ListUtil.$O:	
${OBJDIR}/Argv.$O:	${OBJDIR}/ListUtil.$O ${OBJDIR}/Compiler.$O \
			${OBJDIR}/Config.$O ${OBJDIR}/PackageConfig.$O \
			${OBJDIR}/Platform.$O
${OBJDIR}/MkProg.$O:	${OBJDIR}/Argv.$O ${OBJDIR}/GetDep.$O \
			${OBJDIR}/Getmodtime.$O ${OBJDIR}/ListUtil.$O \
			${OBJDIR}/Order.$O ${OBJDIR}/Output.$O 
${OBJDIR}/MkConfig.$O:	${OBJDIR}/Compiler.$O ${OBJDIR}/Config.$O
${OBJDIR}/Older.$O:	

${CPPHSOBJDIR}/Text/ParserCombinators/HuttonMeijer.$O:	
${CPPHSOBJDIR}/Language/Preprocessor/Cpphs/HashDefine.$O:
${CPPHSOBJDIR}/Language/Preprocessor/Cpphs/Tokenise.$O:	\
		${CPPHSOBJDIR}/Language/Preprocessor/Cpphs/HashDefine.$O \
		${CPPHSOBJDIR}/Language/Preprocessor/Cpphs/Position.$O
${CPPHSOBJDIR}/Language/Preprocessor/Cpphs/ReadFirst.$O: \
		${CPPHSOBJDIR}/Language/Preprocessor/Cpphs/Position.$O
${CPPHSOBJDIR}/Language/Preprocessor/Cpphs/Position.$O:	
${CPPHSOBJDIR}/Language/Preprocessor/Cpphs/SymTab.$O:	
${CPPHSOBJDIR}/Language/Preprocessor/Cpphs/CppIfdef.$O:	\
		${CPPHSOBJDIR}/Language/Preprocessor/Cpphs/SymTab.$O \
		${CPPHSOBJDIR}/Text/ParserCombinators/HuttonMeijer.$O \
		${CPPHSOBJDIR}/Language/Preprocessor/Cpphs/Position.$O \
		${CPPHSOBJDIR}/Language/Preprocessor/Cpphs/ReadFirst.$O \
		${CPPHSOBJDIR}/Language/Preprocessor/Cpphs/Tokenise.$O \
		${CPPHSOBJDIR}/Language/Preprocessor/Cpphs/Options.$O \
		${CPPHSOBJDIR}/Language/Preprocessor/Cpphs/HashDefine.$O \
		${CPPHSOBJDIR}/Language/Preprocessor/Cpphs/MacroPass.$O



# C-files dependencies.
MkConfig.$C: Compiler.$C Config.$C
Output.$C: ListUtil.$C FileName.$C Argv.$C PreProcessor.$C Config.$C \
	RunAndReadStdout.$C 
Utils.$C: Compat.$C ListUtil.$C 
Tsort.$C: Compat.$C 
Graph.$C: Compat.$C ListUtil.$C 
QSort.$C: 
Compat.$C: ListUtil.$C QSort.$C 
Order.$C: Compat.$C Graph.$C ListUtil.$C Tsort.$C Utils.$C 
PreProcessor.$C: Argv.$C Compiler.$C Config.$C Unlit.$C 
Unlit.$C: 
FileName.$C: Argv.$C 
Imports.$C: ListUtil.$C ../cpphs/Language/Preprocessor/Cpphs/CppIfdef.$C 
Getmodtime.$C: 
GetDep.$C: Getmodtime.$C Imports.$C FileName.$C Unlit.$C Argv.$C \
	PreProcessor.$C Config.$C 
RunAndReadStdout.$C: Platform.$C 
PackageConfig.$C: Config.$C Compiler.$C Platform.$C RunAndReadStdout.$C 
Platform.$C: 
Config.$C: Compiler.$C Platform.$C RunAndReadStdout.$C
Compiler.$C: 
ListUtil.$C: 
Argv.$C: ListUtil.$C Compiler.$C Config.$C PackageConfig.$C Platform.$C 
MkProg.$C: Argv.$C GetDep.$C Getmodtime.$C ListUtil.$C Order.$C Output.$C 

../cpphs/Language/Preprocessor/Cpphs/HashDefine.$C: 
../cpphs/Language/Preprocessor/Cpphs/Tokenise.$C: \
		../cpphs/Language/Preprocessor/Cpphs/HashDefine.$C \
		../cpphs/Language/Preprocessor/Cpphs/Position.$C 
../cpphs/Language/Preprocessor/Cpphs/ReadFirst.$C: \
		../cpphs/Language/Preprocessor/Cpphs/Position.$C
../cpphs/Language/Preprocessor/Cpphs/Position.$C: 
../cpphs/Text/ParserCombinators/HuttonMeijer.$C: 
../cpphs/Language/Preprocessor/Cpphs/SymTab.$C: 
../cpphs/Language/Preprocessor/Cpphs/CppIfdef.$C: \
		../cpphs/Language/Preprocessor/Cpphs/SymTab.$C \
		../cpphs/Text/ParserCombinators/HuttonMeijer.$C \
		../cpphs/Language/Preprocessor/Cpphs/Position.$C \
		../cpphs/Language/Preprocessor/Cpphs/ReadFirst.$C \
		../cpphs/Language/Preprocessor/Cpphs/Tokenise.$C \
		../cpphs/Language/Preprocessor/Cpphs/Options.$C \
		../cpphs/Language/Preprocessor/Cpphs/HashDefine.$C \
		../cpphs/Language/Preprocessor/Cpphs/MacroPass.$C

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].