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