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