1 ## Process this file with Automake to create Makefile.in
6 ############################################################
7 # common source files for all variants of the sdcc library
8 ############################################################
10 LIBSDCC_SOURCES_COMMON =
11 LIBSDCC_SOURCES_COMMON += ../_divschar.c
12 LIBSDCC_SOURCES_COMMON += ../_divsint.c
13 LIBSDCC_SOURCES_COMMON += ../_divslong.c
14 LIBSDCC_SOURCES_COMMON += ../_divuchar.c
15 LIBSDCC_SOURCES_COMMON += ../_divuint.c
16 LIBSDCC_SOURCES_COMMON += ../_divulong.c
17 LIBSDCC_SOURCES_COMMON += ../_modschar.c
18 LIBSDCC_SOURCES_COMMON += ../_modsint.c
19 LIBSDCC_SOURCES_COMMON += ../_modslong.c
20 LIBSDCC_SOURCES_COMMON += ../_moduchar.c
21 LIBSDCC_SOURCES_COMMON += ../_moduint.c
22 LIBSDCC_SOURCES_COMMON += ../_modulong.c
23 LIBSDCC_SOURCES_COMMON += ../_mulschar.c
24 LIBSDCC_SOURCES_COMMON += ../_muluchar.c
25 LIBSDCC_SOURCES_COMMON += ../_mulint.c
26 LIBSDCC_SOURCES_COMMON += ../_mullong.c
27 LIBSDCC_SOURCES_COMMON += ../_fs2schar.c
28 LIBSDCC_SOURCES_COMMON += ../_fs2sint.c
29 LIBSDCC_SOURCES_COMMON += ../_fs2slong.c
30 LIBSDCC_SOURCES_COMMON += ../_fs2uchar.c
31 LIBSDCC_SOURCES_COMMON += ../_fs2uint.c
32 LIBSDCC_SOURCES_COMMON += ../_fs2ulong.c
33 LIBSDCC_SOURCES_COMMON += ../_fsadd.c
34 LIBSDCC_SOURCES_COMMON += ../_fsdiv.c
35 LIBSDCC_SOURCES_COMMON += ../_fseq.c
36 LIBSDCC_SOURCES_COMMON += ../_fslt.c
37 LIBSDCC_SOURCES_COMMON += ../_fsmul.c
38 LIBSDCC_SOURCES_COMMON += ../_fsneq.c
39 LIBSDCC_SOURCES_COMMON += ../_fssub.c
40 LIBSDCC_SOURCES_COMMON += ../_schar2fs.c
41 LIBSDCC_SOURCES_COMMON += ../_sint2fs.c
42 LIBSDCC_SOURCES_COMMON += ../_slong2fs.c
43 LIBSDCC_SOURCES_COMMON += ../_uchar2fs.c
44 LIBSDCC_SOURCES_COMMON += ../_uint2fs.c
45 LIBSDCC_SOURCES_COMMON += ../_ulong2fs.c
46 LIBSDCC_SOURCES_COMMON += ../idata.c
48 ############################################################
49 # Directories when building from the sdcc sources
50 ############################################################
52 # the directory where sdcc device files can be found
53 DEVICE_TOP_DIR = $(top_srcdir)/../..
55 # the directory where generic device lib sources can be found
56 GENERIC_SRC_DIR = $(DEVICE_TOP_DIR)/lib
58 # If compiling from the installed device sources, use these directories
59 #DEVICE_TOP_DIR = $(top_srcdir)/../../..
60 #GENERIC_SRC_DIR = $(DEVICE_TOP_DIR)/lib/src
62 GENERIC_SRC_DIR_ABS = $(abspath $(GENERIC_SRC_DIR))
64 ############################################################
65 # C preprocessor flags
66 ############################################################
70 AM_CPPFLAGS += -I$(top_srcdir)
71 AM_CPPFLAGS += -I$(DEVICE_TOP_DIR)/include/pic14 -I$(DEVICE_TOP_DIR)/non-free/include/pic14 -I$(DEVICE_TOP_DIR)/include
73 ############################################################
75 ############################################################
78 SDCC_FLAGS += -mpic14 --less-pedantic --no-warn-non-free --i-code-in-asm --fverbose-asm
79 SDCC_FLAGS += --std-c11
81 # extra flags for enhanced cores
83 if !ENABLE_EXTENDED_INSTRUCTIONS
84 SDCC_FLAGS_ENHANCED += --no-extended-instructions
85 endif !ENABLE_EXTENDED_INSTRUCTIONS
87 # extra flags to disable optimizations
88 SDCC_FLAGS_NOOPT = --no-pcode-opt --no-peep
90 # extra flags to enable experimental support
91 SDCC_FLAGS_EXP = --experimental-pcall-all --experimental-pcall-enhanced --experimental-variadics --experimental-ralloc
93 # extra flags when DEBUG is enabled
95 SDCC_FLAGS += --debug --debug-xtra --debug-ralloc --debug-glue
96 SDCC_FLAGS_EXP += --debug-variadics
99 AM_CFLAGS = -p$(ARCH) $(SDCC_FLAGS)
100 AM_CFLAGS_O = -p$(ARCH) $(SDCC_FLAGS) $(SDCC_FLAGS_NOOPT)
101 AM_CFLAGS_X = -p$(ARCH) $(SDCC_FLAGS) $(SDCC_FLAGS_EXP)
102 AM_CFLAGS_OX = -p$(ARCH) $(SDCC_FLAGS) $(SDCC_FLAGS_NOOPT) $(SDCC_FLAGS_EXP)
104 AM_CFLAGS_E = -p$(EARCH) $(SDCC_FLAGS) $(SDCC_FLAGS_ENHANCED)
105 AM_CFLAGS_EO = -p$(EARCH) $(SDCC_FLAGS) $(SDCC_FLAGS_ENHANCED) $(SDCC_FLAGS_NOOPT)
106 AM_CFLAGS_EX = -p$(EARCH) $(SDCC_FLAGS) $(SDCC_FLAGS_ENHANCED) $(SDCC_FLAGS_EXP)
107 AM_CFLAGS_EOX = -p$(EARCH) $(SDCC_FLAGS) $(SDCC_FLAGS_ENHANCED) $(SDCC_FLAGS_NOOPT) $(SDCC_FLAGS_EXP)
109 ############################################################
111 ############################################################
114 AM_CCASFLAGS += -p$(ARCH)
115 AM_CCASFLAGS += -I$(srcdir)
116 AM_CCASFLAGS += -I$(DEVICE_TOP_DIR)/include/pic14 -I$(DEVICE_TOP_DIR)/non-free/include/pic14
118 ############################################################
120 ############################################################
122 # link missing source files to the generic sdcc ones
123 # NOTE: last empty line required because foreach concatenates several copies of this text
124 define link-generic-files
125 $(1)/%.c: $$(GENERIC_SRC_DIR_ABS)/%.c
126 test -e $$(srcdir)/$$@ || ln -s $$< $$@
130 # create links to generic source files in the source directories
131 $(foreach SOURCE_DIR,$(SOURCE_DIRS),$(eval $(call link-generic-files,$(SOURCE_DIR))))
133 # remove links to generic source files
134 # NOTE: last semicolon required because foreach concatenates several copies of this text
135 define remove-generic-links
136 list='$(wildcard $(SOURCE_DIR)/*.c)' ; \
137 for file in $$list ; do \
138 if test -L $$file ; then rm $$file ; fi \
142 # extensions generated by the build process
143 CLEAN_EXTENSIONS = .asm .lst .sym .d .p .g .v .adb
145 # remove intermediate files generated by the build process
146 # NOTE: last semicolon required because foreach concatenates several copies of this text
147 define remove-intermediate-files
148 list='$(wildcard $(addprefix $(SOURCE_DIR)/*,$(CLEAN_EXTENSIONS)))' ; \
149 if test -n "$$list" ; then rm -rf $$list ; fi ;
152 # clean-up (remove intermediate files and links to missing source files)
154 $(foreach SOURCE_DIR,$(SOURCE_DIRS),$(remove-generic-links))
155 $(foreach SOURCE_DIR,$(SOURCE_DIRS),$(remove-intermediate-files))
158 # do not remove intermediate files when DEBUG is enabled
160 list='$(SUBDIRS)'; for subdir in $$list; do \
161 echo "Making $@ in $$subdir"; \
162 (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@); \
165 clean-intermediate: clean-local
166 list='$(SUBDIRS)'; for subdir in $$list; do \
167 echo "Making $@ in $$subdir"; \
168 (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $@); \