diff --git a/Makefile b/Makefile index d1980e0..7bd1bc3 100644 --- a/Makefile +++ b/Makefile @@ -55,6 +55,21 @@ ASMFLAGS+= # Add any arguments you want passed to the linker to this variable: LDFLAGS+= +# If you want to copy one or more files or directories to the target disk +# image, add the root directory to this variable. Any directories under +# the source directory which don't exist in the target disk image will be +# created. 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/System/mySystemFile +# dir/newDir/anotherFile +# Then, during the copy phase, mySystemFile will be copied into the System +# folder and a folder newDir will be created and anotherFile will be copied +# into there. +COPYDIRS= + # By default, the build expects that you have GSplus in the path: # /Applications/GSplus.app/Contents/MacOS/gsplus # If you have it in a different location, specify that here. diff --git a/make/createDiskImage b/make/createDiskImage index 9265355..6583071 100755 --- a/make/createDiskImage +++ b/make/createDiskImage @@ -5,15 +5,23 @@ MOUNTDIR=/tmp/a2gs_mount.$$ TMPDISKIMAGE=/tmp/a2gs_diskimage_$$.2mg TEMPLATEDISKIMAGE=make/system601.2mg -if [ $# != 3 ] +if [ $# -lt 3 ] then echo USAGE: $0 diskimage file directory exit 1 fi DISKIMAGE="$1" -FILE="$2" -DEST="${MOUNTDIR}/$3" +shift + +FILE="$1" +shift + +DISKIMAGEDEST="$1" +shift +DEST="${MOUNTDIR}/${DISKIMAGEDEST}" + +COPYDIRS=$* cleanupAndExit() { @@ -58,6 +66,29 @@ then cleanupAndExit fi +OLDDIR=`pwd` +for COPYDIR in $COPYDIRS +do + cd "$COPYDIR" + if [ $? != 0 ] + then + echo Unable to find $COPYDIR + cleanupAndExit + fi + + find . -print | while read FILEORDIR + do + if [ -d "$FILEORDIR" ] + then + mkdir -p "${MOUNTDIR}/$FILEORDIR" + elif [ -f "$FILEORDIR" ] + then + cp "$FILEORDIR" "${MOUNTDIR}/$FILEORDIR" + fi + done + cd "$OLDDIR" +done + umount "$MOUNTDIR" if [ $? != 0 ] then diff --git a/make/tail.mk b/make/tail.mk index 3dc7c2c..c7be210 100644 --- a/make/tail.mk +++ b/make/tail.mk @@ -123,7 +123,7 @@ $(PGM): $(REZ_OBJS) endif $(DISKIMAGE): $(PGM) - make/createDiskImage "$(DISKIMAGE)" "$(PGM)" "$(DISKIMAGEDEST)" + make/createDiskImage "$(DISKIMAGE)" "$(PGM)" "$(DISKIMAGEDEST)" $(COPYDIRS) execute: $(EXECTARGET)