/html/
/joy/
/lib/
+/libwrk/
/mou/
/ser/
/targetutil/
- sudo apt-get install linuxdoc-tools linuxdoc-tools-info binutils-mingw-w64-i686 gcc-mingw-w64-i686
script:
- make all doc
- - make -C src clean all CC=i686-w64-mingw32-gcc AR=i686-w64-mingw32-ar PROGEXT=.exe
+ - make -C src clean all CROSS_COMPILE=i686-w64-mingw32-
after_success:
- make -C doc gh-pages
env:
-.PHONY: all doc html info gh-pages mostlyclean clean install
+ifneq ($(shell echo),)
+ CMD_EXE = 1
+endif
+
+.PHONY: all mostlyclean clean install doc html info gh-pages
.SUFFIXES:
-ifeq ($(shell echo),)
+all mostlyclean install:
+
+ifdef CMD_EXE
+
+clean doc:
+
+else # CMD_EXE
SGMLS := $(wildcard *.sgml)
GH_PAGES = ../../gh-pages
-all mostlyclean install:
+clean:
+ $(RM) -r ../html ../info
doc: html info
info: $(addprefix ../info/,$(SGMLS:.sgml=.info))
-clean:
- $(RM) -r ../html ../info
-
../html ../info:
@mkdir $@
git --work-tree=$(GH_PAGES) --git-dir=$(GH_PAGES)/.git push
endif
-else # cmd.exe
-
-all doc mostlyclean clean install:
-
-endif # cmd.exe
+endif # CMD_EXE
+ifneq ($(shell echo),)
+ CMD_EXE = 1
+endif
+
+.PHONY: all mostlyclean clean install lib $(TARGETS)
+
+.SUFFIXES:
+
CBMS = c128 \
c16 \
c64 \
ser \
tgi
+ifdef CMD_EXE
+ DIRLIST = $(strip $(foreach dir,$1,$(wildcard $(dir))))
+ MKDIR = mkdir $(subst /,\,$1)
+ RMDIR = $(if $(DIRLIST),rmdir /s /q $(subst /,\,$(DIRLIST)))
+else
+ MKDIR = mkdir -p $1
+ RMDIR = $(RM) -r $1
+endif
+
# Every target requires its individual vpath setting but the vpath directive
# acts globally. Therefore each target is built in a separate make instance.
endif
endif
-DIRLIST = $(strip $(foreach dir,$1,$(wildcard $(dir))))
-
-ifeq ($(shell echo),)
- MKDIR = mkdir -p $1
- RMDIR = $(RM) -r $1
-else
- MKDIR = mkdir $(subst /,\,$1)
- RMDIR = $(if $(DIRLIST),rmdir /s /q $(subst /,\,$(DIRLIST)))
-endif
-
-.SUFFIXES:
-
-.PHONY: all lib $(TARGETS) mostlyclean clean install
-
ifndef TARGET
datadir = $(prefix)/share/cc65
-INSTALLDIRS = ../asminc ../cfg ../include \
- $(filter-out $(wildcard ../include/*.*),$(wildcard ../include/*)) \
- ../lib ../targetutil $(addprefix ../,$(DRVTYPES))
-
-INSTALL = install
-
all lib: $(TARGETS)
-$(TARGETS):
- @$(MAKE) --no-print-directory $@
-
mostlyclean:
$(call RMDIR,../libwrk)
clean:
$(call RMDIR,../libwrk ../lib ../targetutil $(addprefix ../,$(DRVTYPES)))
+ifdef CMD_EXE
+
install:
- $(foreach dir,$(INSTALLDIRS),$(INSTALL_recipe))
-##########
+else # CMD_EXE
+
+INSTALL = install
+
+INSTALLDIRS = ../asminc ../cfg ../include \
+ $(filter-out $(wildcard ../include/*.*),$(wildcard ../include/*)) \
+ ../lib ../targetutil $(addprefix ../,$(DRVTYPES))
define INSTALL_recipe
$(INSTALL) -d $(subst ..,$(DESTDIR)$(datadir),$(dir))
$(INSTALL) -m644 $(dir)/*.* $(subst ..,$(DESTDIR)$(datadir),$(dir))
-endef
+endef # INSTALL_recipe
+
+install:
+ $(foreach dir,$(INSTALLDIRS),$(INSTALL_recipe))
+
+endif # CMD_EXE
-##########
+$(TARGETS):
+ @$(MAKE) --no-print-directory $@
else # TARGET
include $(SRCDIR)/targetutil/Makefile.inc
endif
-##########
-
define DRVTYPE_template
$1_SRCDIR = $$(SRCDIR)/$1
DEPS += $$($1_OBJS:.o=.d)
-endef
-
-##########
+endef # DRVTYPE_template
$(foreach drvtype,$(DRVTYPES),$(eval $(call DRVTYPE_template,$(drvtype))))
export CC65_HOME := $(abspath ..)
-##########
-
define ASSEMBLE_recipe
$(if $(TRAVIS),,@echo $(TARGET) - $<)
@$(CA65) -t $(TARGET) $(CA65FLAGS) --create-dep $(@:.o=.d) -o $@ $<
-endef
-
-##########
+endef # ASSEMBLE_recipe
define COMPILE_recipe
@$(CC65) -t $(TARGET) $(CC65FLAGS) --create-dep $(@:.o=.d) --dep-target $@ -o $(@:.o=.s) $<
@$(CA65) -t $(TARGET) -o $@ $(@:.o=.s)
-endef
-
-##########
+endef # COMPILE_recipe
../libwrk/$(TARGET)/%.o: %.s | ../libwrk/$(TARGET)
$(ASSEMBLE_recipe)
-.SUFFIXES:
+ifneq ($(shell echo),)
+ CMD_EXE = 1
+endif
-.PHONY: all bin $(PROGS) mostlyclean clean install avail unavail
+.PHONY: all mostlyclean clean install avail unavail bin $(PROGS)
-ifeq ($(shell echo),)
+.SUFFIXES:
PROGS = ar65 \
ca65 \
LD65_OBJ = $(datadir)/lib
LD65_CFG = $(datadir)/cfg
+CC = $(CROSS_COMPILE)gcc
+AR = $(CROSS_COMPILE)ar
+
CFLAGS += -MMD -MP -O -I common $(USER_CFLAGS) \
-Wall -Wextra -Wno-char-subscripts \
-DCA65_INC=$(CA65_INC) -DCC65_INC=$(CC65_INC) \
LDLIBS += -lm
-INSTALL = install
+ifdef CMD_EXE
+ EXE_SUFFIX=.exe
+endif
+
+ifdef CROSS_COMPILE
+ EXE_SUFFIX=.exe
+endif
+
+ifdef CMD_EXE
+ DIRLIST = $(strip $(foreach dir,$1,$(wildcard $(dir))))
+ MKDIR = mkdir $(subst /,\,$1)
+ RMDIR = $(if $(DIRLIST),rmdir /s /q $(subst /,\,$(DIRLIST)))
+else
+ MKDIR = mkdir -p $1
+ RMDIR = $(RM) -r $1
+endif
all bin: $(PROGS)
mostlyclean:
- $(RM) -r ../wrk
+ $(call RMDIR,../wrk)
clean:
- $(RM) -r ../wrk ../bin
+ $(call RMDIR,../wrk ../bin)
-install:
- $(if $(prefix),,$(error variable `prefix' must be set))
- $(INSTALL) -d $(DESTDIR)$(bindir)
- $(INSTALL) ../bin/* $(DESTDIR)$(bindir)
+ifdef CMD_EXE
-avail:
- $(foreach prog,$(PROGS),$(AVAIL_recipe))
+install avail unavail:
-unavail:
- $(foreach prog,$(PROGS),$(UNAVAIL_recipe))
+else # CMD_EXE
-##########
+INSTALL = install
define AVAIL_recipe
ln -s $(abspath ../bin/$(prog)) /usr/local/bin/$(prog)
-endef
-
-##########
+endef # AVAIL_recipe
define UNAVAIL_recipe
$(RM) /usr/local/bin/$(prog)
-endef
+endef # UNAVAIL_recipe
+
+install:
+ $(if $(prefix),,$(error variable `prefix' must be set))
+ $(INSTALL) -d $(DESTDIR)$(bindir)
+ $(INSTALL) ../bin/* $(DESTDIR)$(bindir)
+
+avail:
+ $(foreach prog,$(PROGS),$(AVAIL_recipe))
+
+unavail:
+ $(foreach prog,$(PROGS),$(UNAVAIL_recipe))
-##########
+endif # CMD_EXE
define OBJS_template
$$($1_OBJS): | ../wrk/$1
../wrk/$1:
- @mkdir -p $$@
+ @$$(call MKDIR,$$@)
DEPS += $$($1_OBJS:.o=.d)
-endef
-
-##########
+endef # OBJS_template
define PROG_template
$$(eval $$(call OBJS_template,$1))
-../bin/$1$(PROGEXT): $$($1_OBJS) ../wrk/common/common.a | ../bin
+../bin/$1$(EXE_SUFFIX): $$($1_OBJS) ../wrk/common/common.a | ../bin
$$(CC) $$(LDFLAGS) -o $$@ $$^ $$(LDLIBS)
-$1: ../bin/$1$(PROGEXT)
-
-endef
+$1: ../bin/$1$(EXE_SUFFIX)
-##########
+endef # PROG_template
../wrk/%.o: %.c
@echo $<
@$(CC) -c $(CFLAGS) -o $@ $<
../bin:
- @mkdir $@
+ @$(call MKDIR,$@)
$(eval $(call OBJS_template,common))
+
../wrk/common/common.a: $(common_OBJS)
$(AR) r $@ $?
$(foreach prog,$(PROGS),$(eval $(call PROG_template,$(prog))))
-include $(DEPS)
-
-else # cmd.exe
-
-all bin:
- msbuild cc65.sln /p:configuration=release /consoleloggerparameters:disableconsolecolor
-
-mostlyclean:
- $(if $(wildcard ../wrk),rmdir /s /q ..\wrk)
-
-clean:
- msbuild cc65.sln /p:configuration=release /consoleloggerparameters:disableconsolecolor /target:$@
-
-install avail unavail:
-
-endif # cmd.exe