Add source repository stanza to cabal file
[hsc2hs.git] / Makefile.nhc98
1 include Makefile.inc
2
3 OBJDIR = ${BUILDDIR}/obj/hsc2hs
4 TARGET = ${DST}/hsc2hs$(EXE)
5
6 SRCS   = Main.hs
7 FROMC  = ../libraries/base/System/Console/GetOpt.$C \
8          ../libraries/directory/System/Directory.$C \
9          ../libraries/base/Data/List.$C \
10          ../libraries/process/System/Cmd.$C \
11          ../libraries/base/System/IO.$C \
12          ../libraries/base/Control/Monad.$C \
13          ../libraries/base/Control/Exception/Base.$C \
14          ../libraries/base/Foreign/C/String.$C \
15          ../libraries/base/Foreign/Marshal/Alloc.$C \
16          ../libraries/base/System/Posix/Internals.$C \
17          ../libraries/filepath/System/FilePath/Posix.$C \
18          ../libraries/base/Foreign/Marshal/Array.$C \
19          ../libraries/base/Foreign/Marshal/Utils.$C \
20          ../libraries/base/NHC/PosixTypes.$C \
21          ../libraries/base/Data/Typeable.$C \
22          ../libraries/base/Data/HashTable.$C \
23          ../libraries/base/NHC/SizedTypes.$C \
24          ../libraries/base/Data/Bits.$C \
25          ../libraries/base/Foreign/C/Types.$C
26
27 FMERROR = ../libraries/base/Foreign/Marshal/Error.$C
28 SIERROR = ../libraries/base/System/IO/Error.$C
29 FCERROR = ../libraries/base/Foreign/C/Error.$C
30
31 #REALC =  ../libraries/base/cbits/dirUtils.c
32
33 CINCLUDES = -I../libraries/base/include -I../libraries/directory/include
34
35 #        ../libraries/base/Control/Exception.$C \
36 #        ../libraries/base/System/Posix/Types.$C \
37
38 ifeq "$(findstring ghc, ${HC})" "ghc"
39 HFLAGS = $(shell $(LOCAL)fixghc $(GHCSYM) -package base -package lang -package process -package directory )
40 export HFLAGS
41 endif
42 ifeq "$(findstring hbc, ${HC})" "hbc"
43 HFLAGS =
44 export HFLAGS
45 endif
46 ifeq "$(findstring nhc98, ${HC})" "nhc98"
47 HFLAGS = -package base -package filepath -package directory -package process +CTS -H4M -CTS
48 export HFLAGS
49 endif
50
51 all: $(TARGET)
52 install: $(TARGET)
53 cfiles: cleanC $(SRCS)
54         $(HMAKE) -hc=$(LOCAL)nhc98 -package base -package filepath \
55         -package directory -package process -DBUILD_NHC -C Main.hs
56 clean:
57         -rm -f *.hi *.o $(OBJDIR)/*.o
58 cleanC: clean
59         -rm -f *.hc *.c
60 realclean: clean cleanC
61         -rm -f $(OBJDIR)/Main$(EXE)
62
63 $(TARGET): $(OBJDIR) $(SRCS)
64         $(HMAKE) -hc=$(HC) Main -d$(OBJDIR) -DBUILD_NHC \
65                 $(shell echo "${BUILDOPTS}") $(HFLAGS) $(CYGFLAG)
66         mv $(OBJDIR)/Main$(EXE) $(TARGET)
67         $(HOSTSTRIP) $(TARGET)
68
69 $(OBJDIR):
70         mkdir -p $(OBJDIR)
71
72 fromC: $(OBJDIR)
73         cp $(FROMC) .
74         cp $(FMERROR) ./FMError.$C
75         cp $(SIERROR) ./SIError.$C
76         cp $(FCERROR) ./FCError.$C
77         $(LOCAL)nhc98 -cpp -o $(TARGET) -d$(OBJDIR) $(CINCLUDES) *.$C $(REALC)
78         $(HOSTSTRIP) $(TARGET)
79