Initial revision
[fw/sdcc] / src / Makefile.in
1 #
2 #
3 #
4
5 # Version
6 VERSION         = @VERSION@
7 VERSIONHI       = @VERSIONHI@
8 VERSIONLO       = @VERSIONLO@
9 VERSIONP        = @VERSIONP@
10
11 # Programs
12 SHELL           = /bin/sh
13 CC              = @CC@
14 CPP             = @CPP@
15 RANLIB          = @RANLIB@
16 INSTALL         = @INSTALL@
17 YACC            = @YACC@ 
18 LEX             = @LEX@ 
19 AWK             = @AWK@
20 # Directories
21 PRJDIR          = ..
22
23 prefix          = @prefix@
24 exec_prefix     = @exec_prefix@
25 bindir          = @bindir@
26 libdir          = @libdir@
27 datadir         = @datadir@
28 includedir      = @includedir@
29 mandir          = @mandir@
30 man1dir         = $(mandir)/man1
31 man2dir         = $(mandir)/man2
32 infodir         = @infodir@
33 srcdir          = @srcdir@
34
35 # Flags
36 DEFS            = $(subs -DHAVE_CONFIG_H,,@DEFS@)
37 CPPFLAGS        = @CPPFLAGS@ -I$(PRJDIR) -I$(PRJDIR)/support
38 CFLAGS          = @CFLAGS@ -Wall
39 M_OR_MM         = @M_OR_MM@
40 LIBS            = -lgc @LIBS@
41 LIBDIRS         = -L$(PRJDIR)/support/gc
42
43 OBJECTS         = SDCCy.o SDCClex.o SDCCerr.o SDCChasht.o SDCCmain.o \
44                   SDCCsymt.o SDCCopt.o SDCCast.o SDCCmem.o SDCCval.o \
45                   SDCCralloc.o SDCCicode.o SDCCbitv.o SDCCset.o SDCClabel.o \
46                   SDCCBBlock.o SDCCloop.o SDCCcse.o SDCCcflow.o SDCCdflow.o \
47                   SDCClrange.o SDCCptropt.o SDCCgen51.o SDCCpeeph.o SDCCglue.o spawn.o
48 SOURCES         = $(patsubst %.o,%.c,$(OBJECTS))
49
50 TARGET          = $(PRJDIR)/bin/sdcc
51
52
53 # Compiling entire program or any subproject
54 # ------------------------------------------
55 all: checkconf $(PRJDIR)/support/gc/libgc.a $(TARGET)
56
57 $(PRJDIR)/support/gc/libgc.a:
58         cd $(PRJDIR)/support/gc && $(MAKE)
59
60
61 # Compiling and installing everything and runing test
62 # ---------------------------------------------------
63 install: all installdirs
64         $(INSTALL) -s $(TARGET) $(bindir)/sdcc
65
66
67 # Deleting all the installed files
68 # --------------------------------
69 uninstall:
70         rm -f $(bindir)/sdcc
71
72
73 # Performing self-test
74 # --------------------
75 check:
76
77
78 # Performing installation test
79 # ----------------------------
80 installcheck:
81
82
83 # Creating installation directories
84 # ---------------------------------
85 installdirs:
86         $(INSTALL) -d $(bindir)
87
88
89 # Creating dependencies
90 # ---------------------
91 dep: Makefile.dep
92
93 Makefile.dep: $(SOURCES) *.h $(PRJDIR)/*.h
94         $(CPP) $(CPPFLAGS) $(M_OR_MM) $(SOURCES) >Makefile.dep
95
96 include Makefile.dep
97 include clean.mk
98
99
100 # My rules
101 # --------
102 $(TARGET): $(OBJECTS)
103         $(CC) -o $@ $(OBJECTS) $(LIBDIRS) $(LIBS)
104
105 .c.o:
106         $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
107
108 SDCCy.c: SDCC.y
109         $(YACC) -d -v -o $@ $<
110
111 SDCClex.c: SDCC.lex SDCCy.h
112         $(LEX) -t $< >$@
113
114 SDCCpeeph.rul: SDCCpeeph.def
115         $(AWK) -f SDCCpeeph.awk SDCCpeeph.def > SDCCpeeph.rul
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