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