6 top_srcdir = @top_srcdir@
7 top_builddir = @top_builddir@
10 include $(top_builddir)/Makefile.common
14 PORTS = $(shell cat ../ports.build)
15 ALLPORTS = $(shell cat ../ports.all)
16 PORT_LIBS = $(PORTS:%=%/port.a)
21 CPPFLAGS += -I$(srcdir)
24 ifdef SDCC_SUB_VERSION
25 CFLAGS += -DSDCC_SUB_VERSION_STR=\"$(SDCC_SUB_VERSION)\"
28 SLIBOBJS = NewAlloc.o MySystem.o BuildCmd.o dbuf.o dbuf_string.o findme.o
30 OBJECTS = SDCCy.o SDCChasht.o SDCCmain.o \
31 SDCCsymt.o SDCCopt.o SDCCast.o SDCCmem.o SDCCval.o \
32 SDCCicode.o SDCCbitv.o SDCCset.o SDCClabel.o \
33 SDCCBBlock.o SDCCloop.o SDCCcse.o SDCCcflow.o SDCCdflow.o \
34 SDCClrange.o SDCCptropt.o SDCCpeeph.o SDCCglue.o \
35 SDCCasm.o SDCCmacro.o SDCCutil.o SDCCdebug.o cdbFile.o SDCCdwarf2.o\
39 ifeq ($(USE_ALT_LEX), 1)
46 SLIBSOURCES = $(patsubst %.o,$(SLIB)/%.c,$(SLIBOBJS))
47 SOURCES = $(patsubst %.o,%.c,$(OBJECTS))
49 TARGET = $(top_builddir)/bin/sdcc$(EXEEXT)
51 # Compiling entire program or any subproject
52 # ------------------------------------------
53 all: checkconf version.h $(TARGET)
60 $(top_builddir)/support/gc/libgc.a:
61 $(MAKE) -C $(top_builddir)/support/gc
63 # Compiling and installing everything and runing test
64 # ---------------------------------------------------
65 install: all installdirs
66 $(INSTALL) $(TARGET) `echo $(DESTDIR)$(bindir)/sdcc$(EXEEXT)|sed '$(transform)'`
67 $(STRIP) `echo $(DESTDIR)$(bindir)/sdcc$(EXEEXT)|sed '$(transform)'`
70 # Deleting all the installed files
71 # --------------------------------
73 rm -f $(DESTDIR)$(bindir)/sdcc$(EXEEXT)
75 # Performing self-test
76 # --------------------
80 # Performing installation test
81 # ----------------------------
85 # Creating installation directories
86 # ---------------------------------
88 $(INSTALL) -d $(DESTDIR)$(bindir)
91 # Creating dependencies
92 # ---------------------
93 dep: version.h Makefile.dep
95 Makefile.dep: version.h $(SOURCES) $(SLIBSOURCES) $(SPECIAL)
96 $(CPP) $(CPPFLAGS) $(M_OR_MM) $(filter %.c,$^) >Makefile.dep
98 # don't include Makefile.dep for the listed targets:
99 ifeq "$(findstring $(MAKECMDGOALS),uninstall check installcheck installdirs checkconf \
100 clean distclean mostlyclean realclean)" ""
101 -include Makefile.dep
103 include $(srcdir)/clean.mk
108 $(TARGET): $(SLIBOBJS) $(OBJECTS) $(PORT_LIBS)
109 $(CC) $(LDFLAGS) -o $@ $(SLIBOBJS) $(OBJECTS) $(PORT_LIBS) $(LIBDIRS) $(LIBS)
112 $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
114 $(SLIBOBJS):%.o:$(SLIB)/%.c
115 $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
117 reswords.h: reswords.gperf Makefile
118 gperf -o -k1,2,4 -t -C -N is_reserved_word $< > $@
120 altlex.o: altlex.c SDCCy.h reswords.h
125 $(YACC) -d -v -o $@ $<
127 SDCClex.c: SDCC.lex SDCCy.h
130 version.h: ../ChangeLog
131 $(AWK) -f $(srcdir)/version.awk $< > $@
144 # Remaking configuration
145 # ----------------------
147 @if [ -f $(top_builddir)/devel ]; then\
148 $(MAKE) -f $(srcdir)/conf.mk srcdir="$(srcdir)" top_builddir="$(top_builddir)" \
152 # End of main_in.mk/main.mk