1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322
|
#
# sdcc project main Makefile
#
SHELL = /bin/sh
VPATH = @srcdir@
srcdir = @srcdir@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
EXEEXT = @EXEEXT@
include Makefile.common
SDCC_LIBS = support/makebin
SDCC_SCRIPTS = support/scripts
SDCC_DOC = doc
# Parts that are not normally compiled but need to be cleaned
SDCC_EXTRA = support/regression support/valdiag
SDCC_PACKIHX = support/packihx
SDCC_SDBINUTILS = support/sdbinutils
ifneq ($(OPT_DISABLE_HC08)$(OPT_DISABLE_S08), 11)
SDCC_AS += sdas/as6808
SDCC_LD += sdcc-ld6808
endif
ifneq ($(OPT_DISABLE_MOS6502)$(OPT_DISABLE_MOS65C02), 11)
SDCC_AS += sdas/as6500
SDCC_LD += sdcc-ld6808
endif
ifeq ($(OPT_DISABLE_STM8), 0)
SDCC_AS += sdas/asstm8
SDCC_LD += sdcc-ldstm8
endif
ifneq ($(OPT_DISABLE_DS390)$(OPT_DISABLE_DS400), 11)
SDCC_AS += sdas/as8xcxxx
endif
ifeq ($(OPT_DISABLE_MCS51), 0)
SDCC_AS += sdas/as8051
SDCC_LD += sdcc-ld8051
SDCC_MISC += debugger/mcs51
endif
ifneq ($(OPT_DISABLE_Z80)$(OPT_DISABLE_Z180)$(OPT_DISABLE_Z80N), 111)
SDCC_AS += sdas/asz80
SDCC_LD += sdcc-ldz80
endif
ifneq ($(OPT_DISABLE_R2K)$(OPT_DISABLE_R2KA)$(OPT_DISABLE_R3KA), 111)
SDCC_AS += sdas/asrab
SDCC_LD += sdcc-ldz80
endif
ifeq ($(OPT_DISABLE_TLCS90), 0)
SDCC_AS += sdas/astlcs90
endif
ifeq ($(OPT_DISABLE_SM83), 0)
SDCC_AS += sdas/asgb
SDCC_LD += sdcc-ldgb
endif
ifeq ($(OPT_DISABLE_PDK13), 0)
SDCC_AS += sdas/aspdk13
SDCC_LD += sdcc-ldpdk
endif
ifeq ($(OPT_DISABLE_PDK14), 0)
SDCC_AS += sdas/aspdk14
SDCC_LD += sdcc-ldpdk
endif
ifeq ($(OPT_DISABLE_PDK15), 0)
SDCC_AS += sdas/aspdk15
SDCC_LD += sdcc-ldpdk
endif
ifeq ($(OPT_DISABLE_PDK16), 0)
SDCC_AS += sdas/aspdk16
SDCC_LD += sdcc-ldpdk
endif
ifeq ($(OPT_DISABLE_UCSIM), 0)
TARGETS += sdcc-misc
SDCC_MISC += sim/ucsim
PKGS += $(SDCC_MISC)
endif
SDCC_BINUTILS =
ifeq ($(OPT_DISABLE_SDBINUTILS), 0)
TARGETS += sdcc-sdbinutils
PKGS += $(SDCC_SDBINUTILS)
SDBINUTILS_BINS = sdar$(EXEEXT) sdranlib$(EXEEXT) sdnm$(EXEEXT) sdobjcopy$(EXEEXT)
SDCC_BINUTILS = sdcc-sdbinutils
endif
ifeq ($(OPT_DISABLE_DEVICE_LIB), 0)
TARGETS += sdcc-device-lib
PKGS += device/lib
ifeq ($(OPT_DISABLE_NON_FREE), 0)
PKGS += device/non-free/lib
endif
endif
ifeq ($(OPT_DISABLE_PACKIHX), 0)
TARGETS += sdcc-packihx
PKGS += $(SDCC_PACKIHX)
endif
ifeq ($(OPT_ENABLE_DOC), 1)
TARGETS += sdcc-doc
endif
# always install docs, which don't need to be built
PKGS += $(SDCC_DOC)
ifeq ($(OPT_DISABLE_SDCPP), 0)
SDCC_LIBS += support/cpp
endif
TARGETS += sdcc-libs sdcc-cc sdcc-device-inc sdcc-as sdcc-ld sdcc-scripts
PKGS += $(SDCC_LIBS) src device/include
ifeq ($(OPT_DISABLE_NON_FREE), 0)
PKGS += device/non-free/include
endif
PKGS += $(SDCC_AS) sdas/linksrc $(SDCC_SCRIPTS)
PORTS = $(shell cat ports.build)
ALLPORTS = $(shell cat ports.all)
# Compiling entire program or any subproject
# ------------------------------------------
all: checkconf sdcc
tini: checkconf sdcc-tini
sdcc-libs: sdcc-sdbinutils
for lib in $(SDCC_LIBS); do $(MAKE) -C $$lib; done
sdcc-cc: sdcc-libs
$(MAKE) -C src
sdcc-as:
$(foreach as, $(SDCC_AS), $(MAKE) -C $(as) &&) echo "Assemblers built successfully."
sdcc-ld:
$(MAKE) -C sdas/linksrc $(SDCC_LD)
sdcc-misc:
for misc in $(SDCC_MISC); do $(MAKE) -C $$misc ; done
sdcc-scripts:
$(MAKE) -C $(SDCC_SCRIPTS)
sdcc-packihx:
$(MAKE) -C $(SDCC_PACKIHX)
sdcc-sdbinutils:
$(MAKE) -C $(SDCC_SDBINUTILS)
# in some cases (cygwin) the real binaries are in .libs
for bin in $(SDBINUTILS_BINS); do \
if [ -f $(SDCC_SDBINUTILS)/binutils/.libs/$$bin ]; then \
cp $(SDCC_SDBINUTILS)/binutils/.libs/$$bin bin; \
else \
cp $(SDCC_SDBINUTILS)/binutils/$$bin bin; \
fi \
done
sdcc-device-inc:
$(MAKE) -C device/include
ifeq ($(OPT_DISABLE_NON_FREE), 0)
$(MAKE) -C device/non-free/include
endif
sdcc-device-lib: sdcc-cc sdcc-as sdcc-ld $(SDCC_BINUTILS)
$(MAKE) -C device/lib
ifeq ($(OPT_DISABLE_NON_FREE), 0)
$(MAKE) -C device/non-free/lib
endif
sdcc-device-tini:
$(MAKE) -C device/include
ifeq ($(OPT_DISABLE_NON_FREE), 0)
$(MAKE) -C device/non-free/include
endif
$(MAKE) -C device/lib model-ds390 model-ds400
# doc depends on latex and latex2html
sdcc-doc:
$(MAKE) -C doc
sdcc: $(TARGETS)
sdcc-tini: sdcc-cc sdcc-as sdcc-ld sdcc-device-tini sdcc-packihx
$(MAKE) -f main.mk all
# Some interesting sub rules
sdcc-bin: sdcc-cc sdcc-as sdcc-ld sdcc-misc
sdcc-base: sdcc-cc sdcc-as sdcc-ld
# Compiling and installing everything and running test
# ----------------------------------------------------
install: checkconf sdcc
$(MAKE) -f main.mk install
@for pkg in $(PKGS); do\
$(MAKE) -C $$pkg install ;\
done
# Deleting all the installed files
# --------------------------------
uninstall:
$(MAKE) -f main.mk uninstall
@for pkg in $(PKGS); do\
$(MAKE) -C $$pkg uninstall ;\
done
# Deleting all files created by building the program
# --------------------------------------------------
clean:
@echo "+ Cleaning root of the project..."
$(MAKE) -f $(srcdir)/clean.mk clean
@echo "+ Cleaning packages in their directories..."
for pkg in $(PKGS); do\
$(MAKE) -C $$pkg PORTS="$(PORTS)" EXEEXT=$(EXEEXT) clean ;\
done
# Deleting all files created by configuring or building the program
# -----------------------------------------------------------------
distclean:
@echo "+ DistCleaning packages using clean.mk..."
for pkg in $(PKGS); do\
$(MAKE) -C $$pkg PORTS="$(PORTS)" EXEEXT=$(EXEEXT) distclean ;\
done
for pkg in $(SDCC_EXTRA); do \
$(MAKE) -C $$pkg distclean; \
done
@echo "+ DistCleaning root of the project..."
$(MAKE) -f $(srcdir)/clean.mk distclean
# Like clean but some files may still exist
# -----------------------------------------
mostlyclean: clean
$(MAKE) -f $(srcdir)/clean.mk mostlyclean
for pkg in $(PKGS); do\
$(MAKE) -C $$pkg PORTS="$(PORTS)" EXEEXT=$(EXEEXT) mostlyclean ;\
done
# Deleting everything that can reconstructed by this Makefile. It deletes
# everything deleted by distclean plus files created by bison, stc.
# -----------------------------------------------------------------------
realclean: distclean
$(MAKE) -f $(srcdir)/clean.mk realclean
for pkg in $(PKGS); do\
$(MAKE) -C $$pkg PORTS="$(PORTS)" EXEEXT=$(EXEEXT) realclean ;\
done
# Performing self-test
# --------------------
check:
# Performing installation test
# ----------------------------
installcheck:
# Creating dependencies
# ---------------------
dep: $(SDCC_LIBS)
$(MAKE) -f main.mk dep
@for pkg in $(PKGS); do\
$(MAKE) -C $$pkg dep ;\
done
# My rules
# --------
newer: distclean
@if [ -f start ]; then \
tar cvf - \
`find . -newer start -type f -print` |\
gzip -9c >`date '+%m%d%H%M'`.tgz; \
else \
echo "start file not found.\n"; \
exit 1; \
fi
putcopyright:
'put(c)' -s $(STARTYEAR) *.cc *.h *.y *.l
# Remaking configuration
# ----------------------
configure: configure.in
$(SHELL) $(AUTOCONF)
main.mk: $(srcdir)/main_in.mk $(srcdir)/configure.in config.status
$(SHELL) ./config.status
Makefiles: makefiles
makefiles: config.status
config.status: configure
$(SHELL) ./config.status --recheck
makefiles:
$(SHELL) ./config.status
freshconf: main.mk
checkconf:
@if [ -f devel ]; then\
$(MAKE) freshconf;\
fi
# End of Makefile
|