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