include Makefile.inc OBJDIR = $(BUILDDIR)/$(OBJ)/cpphs CPPHS = $(DST)/cpphs$(EXE) TARGET = $(CPPHS) VERSION = 1.5 SRCS = Language/Preprocessor/Cpphs.hs \ Language/Preprocessor/Cpphs/CppIfdef.hs \ Language/Preprocessor/Cpphs/HashDefine.hs \ Language/Preprocessor/Cpphs/MacroPass.hs \ Language/Preprocessor/Cpphs/Options.hs \ Language/Preprocessor/Cpphs/Position.hs \ Language/Preprocessor/Cpphs/ReadFirst.hs \ Language/Preprocessor/Cpphs/RunCpphs.hs \ Language/Preprocessor/Cpphs/SymTab.hs \ Language/Preprocessor/Cpphs/Tokenise.hs \ Language/Preprocessor/Unlit.hs \ Text/ParserCombinators/HuttonMeijer.hs \ cpphs.hs DIRS = Language/Preprocessor \ Language/Preprocessor/Cpphs \ Text/ParserCombinators \ . FLATSRCS = $(shell for file in $(SRCS); do basename $$file ; done) OBJS = $(patsubst %.hs, $(OBJDIR)/%.$O, $(SRCS)) CFILES = $(patsubst %.hs, %.$C, $(SRCS)) AUX = README LICENCE* CHANGELOG cpphs.hugs cpphs.compat cpphs.cabal \ Setup.hs \ tests/[A-BD-Z]* tests/[a-np-z]* \ docs/[a-z]* HC = $(LOCAL)nhc98 # can be overridden by caller HC=... HFLAGS = $(shell echo $(BUILDOPTS)) #-$(CFG) ifeq "nhc98" "$(findstring nhc98, ${HC})" HEAP = -H4M -package base endif ifeq "ghc" "$(findstring ghc, ${HC})" HFLAGS += $(shell ${LOCAL}fixghc ${GHCSYM} -package base) endif ifeq "hbc" "$(findstring hbc, ${HC})" hbc: $(FLATSRCS) sed -e 's/System.IO.Unsafe/IOExts/' CppIfdef.hs >hbc mv hbc CppIfdef.hs sed -e 's/System.IO.Unsafe/IOExts/' MacroPass.hs >hbc cp -a hbc MacroPass.hs all: hbc endif all: $(TARGET) install: $(TARGET) cfiles: cleanC $(CFILES) fromC: $(OBJDIR) $(LOCAL)/nhc98 -c -d $(OBJDIR) $(CFILES) $(LOCAL)nhc98 -H8M -o $(TARGET) $(OBJS) $(STRIP) $(TARGET) clean: cleanHi cleanO cleanO: rm -f $(OBJS) cleanHi: for dir in $(DIRS); do rm -f $$dir/*.hi; done cleanC: for dir in $(DIRS); do rm -f $$dir/*.hc $$dir/*.c; done realclean: clean cleanC rm -f *.raw *.html haddock.css haskell_icon.gif rm -f $(TARGET) package: tar cf tmp.tar $(SRCS) $(AUX) mkdir cpphs-$(VERSION) cd cpphs-$(VERSION); tar xf ../tmp.tar tar zcf cpphs-$(VERSION).tar.gz cpphs-$(VERSION) zip -r cpphs-$(VERSION).zip cpphs-$(VERSION) rm -r tmp.tar cpphs-$(VERSION) haddock: $(SRCS) mkdir -p docs/cpphs for dir in $(DIRS); do mkdir -p docs/cpphs/$$dir; done for file in $(SRCS); \ do HsColour -anchorHTML $$file \ >docs/cpphs/`dirname $$file`/`basename $$file .hs`.html;\ done haddock --html --title=cpphs --odir=docs/cpphs --package=cpphs \ --source-module="%{MODULE/.//}.html" \ --source-entity="%{MODULE/.//}.html#%{NAME}" \ $(SRCS) flat: @echo $(FLATSRCS) $(CPPHS): $(OBJDIR) $(OBJS) $(HC) $(HFLAGS) $(HEAP) -o $@ $(OBJS) $(STRIP) $@ $(OBJDIR): mkdir -p $(OBJDIR) || $(TRUE) for dir in $(DIRS); do mkdir -p $(OBJDIR)/$$dir || $(TRUE); done $(OBJS): $(OBJDIR)/%.$O : %.hs $(HC) $(HFLAGS) -c -o $@ $< $(CFILES): %.$C : %.hs $(HC) $(HFLAGS) -C $< #$(FLATSRCS): $(SRCS) # -cp $(SRCS) . # dependencies generated by hmake -Md: ${OBJDIR}/Language/Preprocessor/Cpphs/Options.o: ${OBJDIR}/Language/Preprocessor/Cpphs/RunCpphs.o: \ ${OBJDIR}/Language/Preprocessor/Cpphs/CppIfdef.o \ ${OBJDIR}/Language/Preprocessor/Cpphs/MacroPass.o \ ${OBJDIR}/Language/Preprocessor/Cpphs/Options.o \ ${OBJDIR}/Language/Preprocessor/Unlit.o ${OBJDIR}/Language/Preprocessor/Cpphs/MacroPass.o: \ ${OBJDIR}/Language/Preprocessor/Cpphs/HashDefine.o \ ${OBJDIR}/Language/Preprocessor/Cpphs/Tokenise.o \ ${OBJDIR}/Language/Preprocessor/Cpphs/SymTab.o \ ${OBJDIR}/Language/Preprocessor/Cpphs/Position.o \ ${OBJDIR}/Language/Preprocessor/Cpphs/Options.o ${OBJDIR}/Language/Preprocessor/Cpphs/HashDefine.o: ${OBJDIR}/Language/Preprocessor/Cpphs/Tokenise.o: \ ${OBJDIR}/Language/Preprocessor/Cpphs/HashDefine.o \ ${OBJDIR}/Language/Preprocessor/Cpphs/Position.o ${OBJDIR}/Language/Preprocessor/Cpphs/ReadFirst.o: \ ${OBJDIR}/Language/Preprocessor/Cpphs/Position.o ${OBJDIR}/Language/Preprocessor/Cpphs/Position.o: ${OBJDIR}/Language/Preprocessor/Cpphs/ReadFirst.o: \ ${OBJDIR}/Language/Preprocessor/Cpphs/Position.o \ ${OBJDIR}/Language/Preprocessor/Cpphs/SymTab.o ${OBJDIR}/Language/Preprocessor/Cpphs/Position.o: ${OBJDIR}/Text/ParserCombinators/HuttonMeijer.o: ${OBJDIR}/Language/Preprocessor/Cpphs/SymTab.o: ${OBJDIR}/Language/Preprocessor/Cpphs/CppIfdef.o: \ ${OBJDIR}/Language/Preprocessor/Cpphs/SymTab.o \ ${OBJDIR}/Text/ParserCombinators/HuttonMeijer.o \ ${OBJDIR}/Language/Preprocessor/Cpphs/Position.o \ ${OBJDIR}/Language/Preprocessor/Cpphs/ReadFirst.o \ ${OBJDIR}/Language/Preprocessor/Cpphs/Tokenise.o \ ${OBJDIR}/Language/Preprocessor/Cpphs/Options.o \ ${OBJDIR}/Language/Preprocessor/Cpphs/HashDefine.o \ ${OBJDIR}/Language/Preprocessor/Cpphs/MacroPass.o ${OBJDIR}/Language/Preprocessor/Cpphs.o: \ ${OBJDIR}/Language/Preprocessor/Cpphs/CppIfdef.o \ ${OBJDIR}/Language/Preprocessor/Cpphs/MacroPass.o \ ${OBJDIR}/Language/Preprocessor/Cpphs/RunCpphs.o \ ${OBJDIR}/Language/Preprocessor/Cpphs/Options.o ${OBJDIR}/Language/Preprocessor/Unlit.o: ${OBJDIR}/cpphs.o: \ ${OBJDIR}/Language/Preprocessor/Cpphs.o # C-files dependencies. Language/Preprocessor/Cpphs/Options.hc: Language/Preprocessor/Cpphs/RunCpphs.hc: \ Language/Preprocessor/Cpphs/CppIfdef.hc \ Language/Preprocessor/Cpphs/MacroPass.hc \ Language/Preprocessor/Cpphs/Options.hc \ Language/Preprocessor/Unlit.hc Language/Preprocessor/Cpphs/MacroPass.hc: \ Language/Preprocessor/Cpphs/HashDefine.hc \ Language/Preprocessor/Cpphs/Tokenise.hc \ Language/Preprocessor/Cpphs/SymTab.hc \ Language/Preprocessor/Cpphs/Position.hc \ Language/Preprocessor/Cpphs/Options.hc Language/Preprocessor/Cpphs/HashDefine.hc: Language/Preprocessor/Cpphs/Tokenise.hc: \ Language/Preprocessor/Cpphs/HashDefine.hc \ Language/Preprocessor/Cpphs/Position.hc Language/Preprocessor/Cpphs/ReadFirst.hc: \ Language/Preprocessor/Cpphs/Position.hc Language/Preprocessor/Cpphs/Position.hc: Text/ParserCombinators/HuttonMeijer.hc: Language/Preprocessor/Cpphs/SymTab.hc: Language/Preprocessor/Cpphs/CppIfdef.hc: \ Language/Preprocessor/Cpphs/SymTab.hc \ Text/ParserCombinators/HuttonMeijer.hc \ Language/Preprocessor/Cpphs/Position.hc \ Language/Preprocessor/Cpphs/ReadFirst.hc \ Language/Preprocessor/Cpphs/Tokenise.hc \ Language/Preprocessor/Cpphs/Options.hc \ Language/Preprocessor/Cpphs/HashDefine.hc \ Language/Preprocessor/Cpphs/MacroPass.hc Language/Preprocessor/Cpphs.hc: \ Language/Preprocessor/Cpphs/CppIfdef.hc \ Language/Preprocessor/Cpphs/MacroPass.hc \ Language/Preprocessor/Cpphs/RunCpphs.hc \ Language/Preprocessor/Cpphs/Options.hc Language/Preprocessor/Unlit.hc: cpphs.hc: Language/Preprocessor/Cpphs.hc