From 0d9c1a63330d8db66c0de1c11c7cc9983a2d9235 Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Wed, 13 Jun 2018 22:58:56 -0400 Subject: [PATCH] Add a gen phase to the build. Add the xcode compatibility fix to the build. Add the option to copy files to the disk image to the build but the copy script does not yet do the copies. Separate the build from build and run targets in xcode for Apple II projects. Add a doNotBuild target with the appropriate build settings so we get code completion working even with cc65 header files. --- Makefile | 26 +++++ make/createDiskImage | 23 ++++- make/head.mk | 20 ++++ make/tail.mk | 10 +- .../TemplateInfo.plist | 52 +++++++++- .../___PACKAGENAME___.xcscheme | 98 +++++++++++++++++++ .../TemplateInfo.plist | 52 +++++++++- .../___PACKAGENAME___.xcscheme | 98 +++++++++++++++++++ 8 files changed, 364 insertions(+), 15 deletions(-) create mode 100644 pkg/Templates/Apple II/Apple II Asm Project.xctemplate/___PACKAGENAME___.xcscheme create mode 100644 pkg/Templates/Apple II/Apple II C Project.xctemplate/___PACKAGENAME___.xcscheme diff --git a/Makefile b/Makefile index 4727205..3c9af2f 100644 --- a/Makefile +++ b/Makefile @@ -85,6 +85,32 @@ SRCDIRS+= # the path to it by uncommenting the following line: # export JAVA=/usr/bin/java +# If you want to copy one or more files or directories to the target disk +# image, add the root directory to this variable. All files will be +# copied from the source to the target using the same path from the source. +# +# For example, if you set COPYDIRS to dir and in your project you have +# the following files: +# dir/mySystemFile +# dir/newDir/anotherFile +# +# Then, during the copy phase, mySystemFile will be copied into the root +# of the disk and anotherFile will be copied into a directory named +# newDir. Note that the build will _not_ create directories on your +# destination disk image. You must make sure that this directory +# exists in the template disk image in the make directory already. +COPYDIRS= + +# Add any rules you want to execute before any compiles or assembly +# commands are called here, if any. You can generate .c, .s or .h +# files for example. You can generate data files. Whatever you +# might need. +gen: + +# For any files you generated in the gen target above, you should +# add rules in genclean to remove those generated files when you +# clean your build. +genclean: # Do not change anything else below here... include make/tail.mk diff --git a/make/createDiskImage b/make/createDiskImage index 276c036..9cb1497 100755 --- a/make/createDiskImage +++ b/make/createDiskImage @@ -29,10 +29,19 @@ then fi APPLECOMMANDER=$1 -MACHINE=$2 -DISKIMAGE=$3 -PROGRAM=$4 -STARTADDR=`echo $5 | sed 's/^0*//'` +shift + +MACHINE=$1 +shift + +DISKIMAGE=$1 +shift + +PROGRAM=$1 +shift + +STARTADDR=`echo $1 | sed 's/^0*//'` +shift if [ ! -f "$PROGRAM" ] then @@ -206,3 +215,9 @@ then else "$JAVA" -jar "$APPLECOMMANDER" -p "$DISKIMAGE" "$TARGETFILE" $FILETYPE < "$PROGRAM" fi + +for DIR in $* +do + echo Write the code to copy $DIR to the disk image + exit 1 +done diff --git a/make/head.mk b/make/head.mk index 410608f..9190343 100644 --- a/make/head.mk +++ b/make/head.mk @@ -27,3 +27,23 @@ CPU=6502 CFLAGS= ASMFLAGS= LDFLAGS= + +XCODE_PATH=/Applications/Xcode.app +XCODE_INFO=$(XCODE_PATH)/Contents/Info.plist + +CC65_PLUGIN_PATH=$(HOME)/Library/Developer/Xcode/Plug-ins/cc65.ideplugin +CC65_PLUGIN_INFO=$(CC65_PLUGIN_PATH)/Contents/Info.plist + +XCODE_PLUGIN_COMPATIBILITY=DVTPlugInCompatibilityUUID + + +.PHONY: all gen genclean xcodefix + +all: + @make xcodefix + @make gen + @make build + +xcodefix: + defaults write "$(CC65_PLUGIN_INFO)" $(XCODE_PLUGIN_COMPATIBILITY)s -array `defaults read "$(XCODE_INFO)" $(XCODE_PLUGIN_COMPATIBILITY)` + diff --git a/make/tail.mk b/make/tail.mk index 29d6f5d..32ef931 100644 --- a/make/tail.mk +++ b/make/tail.mk @@ -32,10 +32,6 @@ LINK_ARGS= EXECCMD= ALLTARGET=$(DISKIMAGE) -UNAME_S := $(shell uname -s) -ifeq ($(UNAME_S),Darwin) - ALLTARGET=execute -endif ifneq ($(START_ADDR),) # If the MACHINE is set to an option which does not support a variable start @@ -71,9 +67,9 @@ ifeq ($(filter $(MACHINE), apple2 apple2enh),) MACHCONFIG += -C $(MACHINE).cfg endif -.PHONY: all execute clean +.PHONY: build execute clean -all: $(ALLTARGET) +build: $(ALLTARGET) clean: rm -f "$(PGM)" @@ -90,7 +86,7 @@ $(PGM): $(OBJS) $(CL65) $(MACHCONFIG) --mapfile $(MAPFILE) $(LDFLAGS) -o "$(PGM)" $(OBJS) $(DISKIMAGE): $(PGM) - make/createDiskImage $(AC) $(MACHINE) "$(DISKIMAGE)" "$(PGM)" "$(START_ADDR)" + make/createDiskImage $(AC) $(MACHINE) "$(DISKIMAGE)" "$(PGM)" "$(START_ADDR)" $(COPYDIRS) execute: $(DISKIMAGE) osascript make/V2Make.scpt "$(CWD)" "$(PGM)" "$(CWD)/make/DevApple.vii" "$(EXECCMD)" diff --git a/pkg/Templates/Apple II/Apple II Asm Project.xctemplate/TemplateInfo.plist b/pkg/Templates/Apple II/Apple II Asm Project.xctemplate/TemplateInfo.plist index ad1235e..6cfb521 100644 --- a/pkg/Templates/Apple II/Apple II Asm Project.xctemplate/TemplateInfo.plist +++ b/pkg/Templates/Apple II/Apple II Asm Project.xctemplate/TemplateInfo.plist @@ -13,7 +13,8 @@ make/head.mk make/prodos_template.dsk make/tail.mk - make/V2Make.scpt + make/V2Make.scpt + ../___PACKAGENAME___.xcodeproj/xcshareddata/xcschemes/___PACKAGENAME___.xcscheme Definitions @@ -82,6 +83,15 @@ Path Makefile + + ../___PACKAGENAME___.xcodeproj/xcshareddata/xcschemes/___PACKAGENAME___.xcscheme + + Group + + Supporting Files + + Path + ___PACKAGENAME___.xcscheme Kind @@ -130,7 +140,45 @@ Release - + + + ProductType + com.apple.product-type.tool + TargetIdentifier + com.apple.dt.commandLineToolTarget + Name + doNotBuild + SharedSettings + + PRODUCT_NAME + doNotBuild + GCC_PREPROCESSOR_DEFINITIONS + __fastcall__="" + HEADER_SEARCH_PATHS + /usr/local/lib/cc65/include + + BuildPhases + + + Class + Sources + + + Class + Frameworks + + + Class + CopyFiles + DstPath + /usr/share/man/man1/ + DstSubfolderSpec + 0 + RunOnlyForDeploymentPostprocessing + YES + + + diff --git a/pkg/Templates/Apple II/Apple II Asm Project.xctemplate/___PACKAGENAME___.xcscheme b/pkg/Templates/Apple II/Apple II Asm Project.xctemplate/___PACKAGENAME___.xcscheme new file mode 100644 index 0000000..61815a2 --- /dev/null +++ b/pkg/Templates/Apple II/Apple II Asm Project.xctemplate/___PACKAGENAME___.xcscheme @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pkg/Templates/Apple II/Apple II C Project.xctemplate/TemplateInfo.plist b/pkg/Templates/Apple II/Apple II C Project.xctemplate/TemplateInfo.plist index 352c1a1..f14f212 100644 --- a/pkg/Templates/Apple II/Apple II C Project.xctemplate/TemplateInfo.plist +++ b/pkg/Templates/Apple II/Apple II C Project.xctemplate/TemplateInfo.plist @@ -13,7 +13,8 @@ make/head.mk make/prodos_template.dsk make/tail.mk - make/V2Make.scpt + make/V2Make.scpt + ../___PACKAGENAME___.xcodeproj/xcshareddata/xcschemes/___PACKAGENAME___.xcscheme Definitions @@ -82,6 +83,15 @@ Path Makefile + + ../___PACKAGENAME___.xcodeproj/xcshareddata/xcschemes/___PACKAGENAME___.xcscheme + + Group + + Supporting Files + + Path + ___PACKAGENAME___.xcscheme Kind @@ -130,7 +140,45 @@ Release - + + + ProductType + com.apple.product-type.tool + TargetIdentifier + com.apple.dt.commandLineToolTarget + Name + doNotBuild + SharedSettings + + PRODUCT_NAME + doNotBuild + GCC_PREPROCESSOR_DEFINITIONS + __fastcall__="" + HEADER_SEARCH_PATHS + /usr/local/lib/cc65/include + + BuildPhases + + + Class + Sources + + + Class + Frameworks + + + Class + CopyFiles + DstPath + /usr/share/man/man1/ + DstSubfolderSpec + 0 + RunOnlyForDeploymentPostprocessing + YES + + + diff --git a/pkg/Templates/Apple II/Apple II C Project.xctemplate/___PACKAGENAME___.xcscheme b/pkg/Templates/Apple II/Apple II C Project.xctemplate/___PACKAGENAME___.xcscheme new file mode 100644 index 0000000..61815a2 --- /dev/null +++ b/pkg/Templates/Apple II/Apple II C Project.xctemplate/___PACKAGENAME___.xcscheme @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +