Add support for the --disable-boehm-gc flag for systems that lack -lgc.
[fw/sdcc] / src / Makefile.in
1 #
2 #
3 #
4
5 PRJDIR          = ..
6
7 include $(PRJDIR)/Makefile.common
8
9 USE_ALT_LEX     = 0
10
11 PORTS           = mcs51 z80 avr ds390
12 PORT_LIBS       = $(PORTS:%=%/port.a)
13
14 ifeq ($(DISABLE_GC),1)
15 LIBS            = -lm @LIBS@
16 else
17 LIBS            = -lgc -lm @LIBS@
18 ifeq ($(HAVE_LIBGC), 1)
19 else
20 LIBDIRS         = -L$(PRJDIR)/support/gc
21 LIBGC           = $(PRJDIR)/support/gc/libgc.a
22 endif
23 endif
24
25 #CFLAGS          += -Werror
26
27 ifdef SDCC_SUB_VERSION
28 CFLAGS          += -DSDCC_SUB_VERSION_STR=\"$(SDCC_SUB_VERSION)\"
29 endif
30
31 OBJECTS         = SDCCy.o SDCCerr.o SDCChasht.o SDCCmain.o \
32                   SDCCsymt.o SDCCopt.o SDCCast.o SDCCmem.o SDCCval.o \
33                   SDCCicode.o SDCCbitv.o SDCCset.o SDCClabel.o \
34                   SDCCBBlock.o SDCCloop.o SDCCcse.o SDCCcflow.o SDCCdflow.o \
35                   SDCClrange.o SDCCptropt.o SDCCpeeph.o SDCCglue.o spawn.o \
36                   asm.o
37
38 SPECIAL         = SDCCy.h 
39 ifeq ($(USE_ALT_LEX), 1)
40 OBJECTS         += altlex.o
41 SPECIAL         += reswords.h
42 else
43 OBJECTS         += SDCClex.o
44 endif
45
46 SOURCES         = $(patsubst %.o,%.c,$(OBJECTS))
47
48 TARGET          = $(PRJDIR)/bin/sdcc
49
50 # Compiling entire program or any subproject
51 # ------------------------------------------
52 all: ports checkconf $(LIBGC) $(TARGET)
53
54 ports:
55         for i in $(PORTS); do $(MAKE) -C $$i; done
56
57 $(PRJDIR)/support/gc/libgc.a:
58         cd $(PRJDIR)/support/gc && $(MAKE)
59
60 # Compiling and installing everything and runing test
61 # ---------------------------------------------------
62 install: all installdirs
63         $(INSTALL) -s $(TARGET) $(bindir)/sdcc
64
65
66 # Deleting all the installed files
67 # --------------------------------
68 uninstall:
69         rm -f $(bindir)/sdcc
70         rm -f $(bindir)/packihx
71
72 # Performing self-test
73 # --------------------
74 check:
75
76
77 # Performing installation test
78 # ----------------------------
79 installcheck:
80
81
82 # Creating installation directories
83 # ---------------------------------
84 installdirs:
85         $(INSTALL) -d $(bindir)
86
87
88 # Creating dependencies
89 # ---------------------
90 dep: Makefile.dep
91
92 Makefile.dep: $(SOURCES) $(SPECIAL) *.h $(PRJDIR)/*.h
93         $(CPP) $(CPPFLAGS) $(M_OR_MM) $(SOURCES) >Makefile.dep
94
95 include Makefile.dep
96 include clean.mk
97
98
99 # My rules
100 # --------
101 $(TARGET): $(OBJECTS) $(PORT_LIBS)
102         $(CC) -o $@ $(OBJECTS) $(PORT_LIBS) $(LIBDIRS) $(LIBS)
103
104 .c.o:
105         $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
106
107 reswords.h: reswords.gperf Makefile
108         gperf -o -k1,2,4 -t -C -N is_reserved_word $< > $@
109
110 altlex.o: altlex.c SDCCy.h reswords.h
111
112 SDCCy.h: SDCCy.c
113
114 SDCCy.c: SDCC.y
115         $(YACC) -d -v -o $@ $<
116
117 SDCClex.c: SDCC.lex SDCCy.h
118         $(LEX) -t $< >$@
119
120 .y.c:
121         rm -f $*.cc $*.h
122         $(YACC) -d $<
123         mv y.tab.c $*.cc
124         mv y.tab.h $*.h
125
126 .l.c:
127         rm -f $*.cc
128         $(LEX) -t $< >$*.cc
129
130
131 # Remaking configuration
132 # ----------------------
133 checkconf:
134         @if [ -f $(PRJDIR)/devel ]; then\
135           $(MAKE) -f $(srcdir)/conf.mk srcdir="$(srcdir)" PRJDIR="$(PRJDIR)" \
136           freshconf;\
137         fi
138
139 # End of main_in.mk/main.mk
140