1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-27 00:29:31 +00:00

Moved from VS2013 to MinGW(-w64).

This commit is contained in:
Oliver Schmidt 2014-03-06 22:32:24 +01:00
parent 3f0af9b241
commit 30125afcc1
5 changed files with 110 additions and 102 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@
/html/
/joy/
/lib/
/libwrk/
/mou/
/ser/
/targetutil/

View File

@ -4,7 +4,7 @@ install:
- 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:

View File

@ -1,8 +1,18 @@
.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)
@ -13,7 +23,8 @@ TOC_LEVEL = 2
GH_PAGES = ../../gh-pages
all mostlyclean install:
clean:
$(RM) -r ../html ../info
doc: html info
@ -21,9 +32,6 @@ html: $(addprefix ../html/,$(SGMLS:.sgml=.html) doc.css doc.png)
info: $(addprefix ../info/,$(SGMLS:.sgml=.info))
clean:
$(RM) -r ../html ../info
../html ../info:
@mkdir $@
@ -50,8 +58,4 @@ ifdef GH_TOKEN
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

View File

@ -1,3 +1,11 @@
ifneq ($(shell echo),)
CMD_EXE = 1
endif
.PHONY: all mostlyclean clean install lib $(TARGETS)
.SUFFIXES:
CBMS = c128 \
c16 \
c64 \
@ -29,6 +37,15 @@ DRVTYPES = emd \
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.
@ -38,45 +55,29 @@ ifeq ($(words $(MAKECMDGOALS)),1)
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)))
install:
$(foreach dir,$(INSTALLDIRS),$(INSTALL_recipe))
ifdef CMD_EXE
##########
install:
else # CMD_EXE
INSTALL = install
INSTALLDIRS = ../asminc ../cfg ../include \
$(filter-out $(wildcard ../include/*.*),$(wildcard ../include/*)) \
../lib ../targetutil $(addprefix ../,$(DRVTYPES))
define INSTALL_recipe
@ -84,9 +85,15 @@ $(if $(prefix),,$(error variable `prefix' must be set))
$(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
@ -183,8 +190,6 @@ ifeq ($(TARGET),$(filter $(TARGET),$(TARGETUTIL)))
include $(SRCDIR)/targetutil/Makefile.inc
endif
##########
define DRVTYPE_template
$1_SRCDIR = $$(SRCDIR)/$1
@ -221,9 +226,7 @@ OBJS += $$($1_STCS)
DEPS += $$($1_OBJS:.o=.d)
endef
##########
endef # DRVTYPE_template
$(foreach drvtype,$(DRVTYPES),$(eval $(call DRVTYPE_template,$(drvtype))))
@ -235,16 +238,12 @@ LD65 := $(if $(wildcard ../bin/ld65*),../bin/ld65,ld65)
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
@ -252,9 +251,7 @@ $(if $(TRAVIS),,@echo $(TARGET) - $<)
@$(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)

View File

@ -1,9 +1,11 @@
ifneq ($(shell echo),)
CMD_EXE = 1
endif
.PHONY: all mostlyclean clean install avail unavail bin $(PROGS)
.SUFFIXES:
.PHONY: all bin $(PROGS) mostlyclean clean install avail unavail
ifeq ($(shell echo),)
PROGS = ar65 \
ca65 \
cc65 \
@ -25,6 +27,9 @@ LD65_LIB = $(datadir)/lib
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) \
@ -34,15 +39,50 @@ CFLAGS += $(if $(TRAVIS),-Werror)
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)
ifdef CMD_EXE
install avail unavail:
else # CMD_EXE
INSTALL = install
define AVAIL_recipe
ln -s $(abspath ../bin/$(prog)) /usr/local/bin/$(prog)
endef # AVAIL_recipe
define UNAVAIL_recipe
$(RM) /usr/local/bin/$(prog)
endef # UNAVAIL_recipe
install:
$(if $(prefix),,$(error variable `prefix' must be set))
@ -55,23 +95,7 @@ avail:
unavail:
$(foreach prog,$(PROGS),$(UNAVAIL_recipe))
##########
define AVAIL_recipe
ln -s $(abspath ../bin/$(prog)) /usr/local/bin/$(prog)
endef
##########
define UNAVAIL_recipe
$(RM) /usr/local/bin/$(prog)
endef
##########
endif # CMD_EXE
define OBJS_template
@ -80,53 +104,35 @@ $1_OBJS := $$(patsubst %.c,../wrk/%.o,$$(wildcard $1/*.c))
$$($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)
$1: ../bin/$1$(EXE_SUFFIX)
endef
##########
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