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