6 top_srcdir
= @top_srcdir@
7 top_builddir
= @top_builddir@
9 GIT_REVISION
= @GIT_REVISION@
10 SVN_REVISION
= @SVN_REVISION@
12 PORTS
= $(shell cat ..
/ports.build
)
13 ALLPORTS
= $(shell cat ..
/ports.
all)
14 PORT_LIBS
= $(PORTS
:%=%/port.a
)
18 CFLAGS
= @CFLAGS@ @WALL_FLAG@
19 CXXFLAGS
= @CXXFLAGS@ @WALL_FLAG@
20 CPPFLAGS
+= -I
$(srcdir)
23 ifdef SDCC_SUB_VERSION
24 CFLAGS
+= -DSDCC_SUB_VERSION_STR
=\"$(SDCC_SUB_VERSION
)\"
27 SLIBOBJS
= NewAlloc.o dbuf.o dbuf_string.o findme.o
29 OBJECTS
= SDCCy.o SDCChasht.o SDCCmain.o SDCCattr.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 SDCCasm.o SDCCmacro.o SDCCutil.o SDCCdebug.o cdbFile.o SDCCdwarf2.o\
35 SDCCerr.o SDCCsystem.o SDCCgen.o
37 SPECIAL
= SDCCy.h version.h
40 SLIBSOURCES
= $(patsubst %.o
,$(SLIB
)/%.c
,$(SLIBOBJS
))
41 SOURCES
:= $(patsubst %.o
,%.c
,$(OBJECTS
))
43 # C++ sources (.cc extension)
44 CXXSOURCES
+= $(sort $(notdir $(wildcard $(srcdir)/*.
cc)))
45 OBJECTS
+= $(patsubst %.
cc,%.o
,$(CXXSOURCES
))
47 TARGET
= sdcc
$(EXEEXT
)
49 # ------------------------------------------
50 include $(top_builddir
)/Makefile.common
52 # Compiling entire program or any subproject
53 # ------------------------------------------
54 all: checkconf version.h
$(TARGET
)
61 $(top_builddir
)/support
/gc
/libgc.a
:
62 $(MAKE
) -C
$(top_builddir
)/support
/gc
64 # Compiling and installing everything and runing test
65 # ---------------------------------------------------
66 install: all installdirs
67 $(INSTALL
) $(TARGET
) $(DESTDIR
)$(bindir)/`echo sdcc|sed '$(transform)'`$(EXEEXT
)
68 $(STRIP
) $(DESTDIR
)$(bindir)/`echo sdcc|sed '$(transform)'`$(EXEEXT
)
71 # Deleting all the installed files
72 # --------------------------------
73 # NOTE: Deleting sdcpp in here, because the GNU cpp code base does not implement the uninstall target
75 rm -f
$(DESTDIR
)$(bindir)/`echo sdcc|sed '$(transform)'`$(EXEEXT
)
76 rm -f
$(DESTDIR
)$(bindir)/`echo sdcpp|sed '$(transform)'`$(EXEEXT
)
78 # Performing self-test
79 # --------------------
83 # Performing installation test
84 # ----------------------------
88 # Creating installation directories
89 # ---------------------------------
91 $(INSTALL
) -d
$(DESTDIR
)$(bindir)
94 include $(srcdir)/clean.mk
99 $(TARGET
): $(SLIBOBJS
) $(OBJECTS
) $(PORT_LIBS
)
100 $(CXX
) $(CXXFLAGS
) $(LDFLAGS
) -o
$@
$(SLIBOBJS
) $(OBJECTS
) $(PORT_LIBS
) $(LIBDIRS
) $(LIBS
)
103 $(CC
) $(CFLAGS
) $(CPPFLAGS
) -c
$< -o
$@
105 $(SLIBOBJS
):%.o
:$(SLIB
)/%.c
106 $(CC
) $(CFLAGS
) $(CPPFLAGS
) -c
$< -o
$@
108 reswords.h
: reswords.gperf Makefile
109 gperf
-o
-k1
,2,4 -t
-C
-N is_reserved_word
$< > $@
118 SDCClex.c
: SDCC.
lex SDCCy.h
119 $(LEX
) -8 -f
-t
$< >$@
121 # BUG: move if changed only.
122 version.h
: ..
/ChangeLog Makefile
123 if
[ -z
"${GIT_REVISION}" ]; then \
124 $(AWK
) -f
$(srcdir)/version.awk
$< > $@
; \
126 echo
"#ifndef __VERSION_H__" > $@
; \
127 echo
"#define __VERSION_H__" >> $@
; \
128 echo
"// GIT_REVISION ${GIT_REVISION}" >> $@
; \
129 echo
"// BUILD_NUMBERs are empty when not using commit from svn..." >> $@
; \
130 echo
'#define SDCC_BUILD_NUMBER "${SVN_REVISION}"' >> $@
; \
131 echo
"#define SDCC_BUILD_NR ${SVN_REVISION}" >> $@
;\
132 echo
"#endif" >> $@
; \
140 # Remaking configuration
141 # ----------------------
143 @if
[ -f
$(top_builddir
)/devel
]; then\
144 $(MAKE
) -f
$(srcdir)/conf.mk
srcdir="$(srcdir)" top_builddir
="$(top_builddir)" \
148 Makefile
: $(srcdir)/Makefile.in
149 cd
$(top_builddir
); .
/config.status src
/Makefile