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