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