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