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