1 ################################################################
3 ################################################################
5 # This rule goes first to make it the default choice
10 CPPFLAGS += -I../includes
11 CPPFLAGS += -D__HUGS__
16 CFLAGS += -Wstrict-prototypes
17 CFLAGS += -Wmissing-prototypes
18 CFLAGS += -Wmissing-declarations
19 #CFLAGS += -Wredundant-decls
20 #CFLAGS += -Wnested-externs
23 CFLAGS += -Waggregate-return
24 CFLAGS += -Wpointer-arith
25 CFLAGS += -Wbad-function-cast
26 #CFLAGS += -Wcast-qual
27 #CFLAGS += -Wcast-align
28 #CFLAGS += -Wconversion
30 #CFLAGS += -ggdb3 -O0 # debug with gdb, minimal confusion
31 #CFLAGS += -pg -O2 # Profile with gprof
32 #CFLAGS += -pg -g # Profile more with gprof
33 #CFLAGS += -pg -g -a # Profile basic blocks with gprof (disnae work)
34 #CFLAGS += -O2 -g # Run it - but put a little debugging help in
36 #CFLAGS += -O6 # Just run it
38 C_FILES = $(wildcard *.c)
39 S_FILES = $(wildcard *.S)
40 HC_FILES = $(wildcard *.hc)
42 LIBOBJS += $(patsubst %.c,%.o,$(C_FILES))
43 LIBOBJS += $(patsubst %.S,%.o,$(S_FILES))
44 LIBOBJS += $(patsubst %.hc,%.o,$(HC_FILES))
50 @$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
53 @$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
56 @ $(CC) $(CFLAGS) $(CPPFLAGS) -xc -c $< -o $@
58 # We can build an archive
59 $(LIBRARY): $(LIBOBJS)
63 # Or we can build a shared library
64 # (The shared library is nicer because it's linked with all the libs
65 # that the rts depends on. But it has the problem that the bfd code
66 # can't see the symbols defined in the library - though that may be easy
68 $(LIBRARY:.a=.so): $(LIBOBJS)
70 $(CC) -shared $^ -L$(HOME)/lib -lm -lbfd -liberty -o $@
76 etags ../*/*.{c,h,hc,S}
78 ################################################################
79 # Floppy disk for me to take home at night
80 ################################################################
82 # We avoid using zip because we're fed up being bitten by the
83 # default=non-recursive bug
86 TEST_DIR = $(GHC_DIR)/tests/rts
87 RTS_DIR = $(GHC_DIR)/rts
88 LIB_DIR = $(GHC_DIR)/lib
89 GMP_DIR = $(GHC_DIR)/rts/gmp
90 INC_DIR = $(GHC_DIR)/includes
91 HUGS_DIR = $(GHC_DIR)/interpreter
93 TARFILES += $(GHC_DIR)/CVS
95 TARFILES += $(INC_DIR)/*.h
96 TARFILES += $(INC_DIR)/CVS
98 TARFILES += $(RTS_DIR)/*.{c,h,hc,S}
99 TARFILES += $(RTS_DIR)/comments
100 TARFILES += $(RTS_DIR)/adr
101 TARFILES += $(RTS_DIR)/CVS
103 TARFILES += $(TEST_DIR)/Makefile
104 TARFILES += $(TEST_DIR)/.gdbinit
105 TARFILES += $(TEST_DIR)/*.{c,h}
106 TARFILES += $(TEST_DIR)/CVS
108 TARFILES += $(GMP_DIR)
110 TARFILES += $(LIB_DIR)/*/CVS
111 TARFILES += $(LIB_DIR)/*/*.{lhs,hi-boot}
112 TARFILES += $(LIB_DIR)/*/cbits/*.{c,h}
114 TARFILES += $(HUGS_DIR)
117 cd ../../../$(GMP_DIR) && make clean
118 cd ../../../$(HUGS_DIR) && make clean
119 cd ../../..; tar zcvf rts.tgz $(TARFILES)
120 ls -l ../../../rts.tgz
121 echo todo: add unlit to tarfile
125 - cp ../../../rts.tgz /mnt/floppy
128 ################################################################
130 ################################################################
132 DEP_FILES += $(C_FILES:.c=.d)
133 DEP_FILES += $(S_FILES:.S=.d)
134 DEP_FILES += $(HC_FILES:.hc=.d)
138 #Copied from the gmake manual - builds a dependency file for every C file
140 @echo "Making dependency file $@"
141 @$(SHELL) -ec '$(CC) -MM $(CPPFLAGS) $< \
142 | sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@ \
143 ; [ -s $@ ] || rm -f $@'
145 @echo "Making dependency file $@"
146 @$(SHELL) -ec '$(CC) -MM $(CPPFLAGS) $< \
147 | sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@ \
148 ; [ -s $@ ] || rm -f $@'
150 @echo "Making dependency file $@"
151 @$(SHELL) -ec '$(CC) -MM $(CPPFLAGS) -xc $< \
152 | sed '\''s/\($*\)\.hc\.o[ :]*/\1.o $@ : /g'\'' > $@ \
153 ; [ -s $@ ] || rm -f $@'
158 ################################################################
160 ################################################################