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)
23 ifdef SDCC_SUB_VERSION
24 CFLAGS += -DSDCC_SUB_VERSION_STR=\"$(SDCC_SUB_VERSION)\"
27 SLIBOBJS = SDCCerr.o NewAlloc.o MySystem.o BuildCmd.o dbuf.o dbuf_string.o findme.o
29 OBJECTS = SDCCy.o SDCChasht.o SDCCmain.o \
30 SDCCsymt.o SDCCopt.o SDCCast.o SDCCmem.o SDCCval.o \
31 SDCCicode.o SDCCbitv.o SDCCset.o SDCClabel.o \
32 SDCCBBlock.o SDCCloop.o SDCCcse.o SDCCcflow.o SDCCdflow.o \
33 SDCClrange.o SDCCptropt.o SDCCpeeph.o SDCCglue.o \
34 asm.o SDCCmacro.o SDCCutil.o SDCCdebug.o cdbFile.o SDCCdwarf2.o
37 ifeq ($(USE_ALT_LEX), 1)
44 SLIBSOURCES = $(patsubst %.o,$(SLIB)/%.c,$(SLIBOBJS))
45 SOURCES = $(patsubst %.o,%.c,$(OBJECTS))
47 TARGET = $(top_builddir)/bin/sdcc$(EXEEXT)
49 # Compiling entire program or any subproject
50 # ------------------------------------------
51 all: checkconf version.h $(TARGET)
58 $(top_builddir)/support/gc/libgc.a:
59 $(MAKE) -C $(top_builddir)/support/gc
61 # Compiling and installing everything and runing test
62 # ---------------------------------------------------
63 install: all installdirs
64 $(INSTALL) $(TARGET) `echo $(DESTDIR)$(bindir)/sdcc$(EXEEXT)|sed '$(transform)'`
65 $(STRIP) `echo $(DESTDIR)$(bindir)/sdcc$(EXEEXT)|sed '$(transform)'`
68 # Deleting all the installed files
69 # --------------------------------
71 rm -f $(DESTDIR)$(bindir)/sdcc$(EXEEXT)
73 # Performing self-test
74 # --------------------
78 # Performing installation test
79 # ----------------------------
83 # Creating installation directories
84 # ---------------------------------
86 $(INSTALL) -d $(DESTDIR)$(bindir)
89 # Creating dependencies
90 # ---------------------
91 dep: version.h Makefile.dep
93 Makefile.dep: version.h $(SOURCES) $(SLIBSOURCES) $(SPECIAL)
94 $(CPP) $(CPPFLAGS) $(M_OR_MM) $(filter %.c,$^) >Makefile.dep
96 # don't include Makefile.dep for the listed targets:
97 ifeq "$(findstring $(MAKECMDGOALS),uninstall check installcheck installdirs checkconf \
98 clean distclean mostlyclean realclean)" ""
101 include $(srcdir)/clean.mk
106 $(TARGET): $(SLIBOBJS) $(OBJECTS) $(PORT_LIBS)
107 $(CC) $(LDFLAGS) -o $@ $(SLIBOBJS) $(OBJECTS) $(PORT_LIBS) $(LIBDIRS) $(LIBS)
110 $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
112 $(SLIBOBJS):%.o:$(SLIB)/%.c
113 $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
115 reswords.h: reswords.gperf Makefile
116 gperf -o -k1,2,4 -t -C -N is_reserved_word $< > $@
118 altlex.o: altlex.c SDCCy.h reswords.h
123 $(YACC) -d -v -o $@ $<
125 SDCClex.c: SDCC.lex SDCCy.h
128 version.h: ../ChangeLog
129 $(AWK) -f $(srcdir)/version.awk $< > $@
142 # Remaking configuration
143 # ----------------------
145 @if [ -f $(top_builddir)/devel ]; then\
146 $(MAKE) -f $(srcdir)/conf.mk srcdir="$(srcdir)" top_builddir="$(top_builddir)" \
150 # End of main_in.mk/main.mk