diff --git a/Makefile b/Makefile index 9e7f50b..e5ebd45 100755 --- a/Makefile +++ b/Makefile @@ -18,7 +18,8 @@ dflags = -MT $@ -MMD -MP -MF $(@:%.o=%.d) # $TARGETS is provided by Makefile.cfg. # -TARGETS := $(filter-out fxconv fxsdk,$(TARGETS)) +TARGETS := $(filter-out fxconv,$(TARGETS)) +TARGETS := $(TARGETS:fxsdk=fxsdk.sh) bin = $(TARGETS:%=bin/%) # fxconv has no sources files because it's written in Python, and fxsdk has no @@ -33,15 +34,26 @@ lex = $($1:%.l=build/%.yy.c.o) obj-fxg1a := $(call obj,src-fxg1a) obj-fxos := $(call obj,src-fxos) $(call lex,lex-fxos) +# Sed command to copy install path to fxsdk.sh. On Mac OS, BSD sed is used so +# we need to do it a bit differently with a printf helper to insert a literal +# newline into the command. +sed := '/^PREFIX=\\$$/ a \$(PREFIX)' +ifeq "$(shell uname)" "Darwin" +sed := "$$(printf '/^PREFIX=/ a \\\n$(PREFIX)')" +endif + # Symbolic targets all: $(bin) +all-fxsdk: bin/fxsdk.sh all-fxg1a: bin/fxg1a all-fxos: bin/fxos # Explicit targets +bin/fxsdk.sh: fxsdk/fxsdk.sh + sed -e $(sed) $< > $@ bin/fxg1a: $(obj-fxg1a) | bin/ gcc $^ -o $@ $(lflags) bin/fxos: $(obj-fxos) | bin/ @@ -87,24 +99,21 @@ Makefile.cfg: m644 := -m 644 m755 := -m 755 -sed := -i -e '/^PREFIX=\\$$/ a \$(PREFIX)' -# Disable -m on Mac OS and use sed differently +# Disable -m on Mac OS ifeq "$(shell uname)" "Darwin" m644 := m755 := -sed := -i '' -e "$$(printf '/^PREFIX=/ a \\\n$(PREFIX)')" endif install: $(bin) install -d $(PREFIX)/bin install -d $(PREFIX)/share/fxsdk - install $(bin) $(m755) $(PREFIX)/bin + install $(bin:bin/fxsdk.sh=) $(m755) $(PREFIX)/bin install fxos/*.txt $(m644) $(PREFIX)/share/fxsdk install -d $(PREFIX)/share/fxsdk/assets install fxsdk/assets/* $(m644) $(PREFIX)/share/fxsdk/assets - install fxsdk/fxsdk.sh $(m755) $(PREFIX)/bin/fxsdk - sed $(sed) $(PREFIX)/bin/fxsdk + install bin/fxsdk.sh $(m755) $(PREFIX)/bin/fxsdk install fxconv/fxconv-main.py $(m755) $(PREFIX)/bin/fxconv install fxconv/fxconv.py $(m644) $(PREFIX)/bin diff --git a/configure b/configure index 6984700..ba0fb3f 100755 --- a/configure +++ b/configure @@ -92,7 +92,9 @@ esac; done gen() { - echo "PREFIX = $PREFIX" + # Allow an install script to change the destination at the last second + # to have all files in a separate root before packaging + echo "PREFIX ?= $PREFIX" echo -n "TARGETS =" [[ $BUILD_fxsdk = 1 ]] && echo -n " fxsdk" diff --git a/fxsdk/fxsdk.sh b/fxsdk/fxsdk.sh index 9d13357..73e7ea0 100755 --- a/fxsdk/fxsdk.sh +++ b/fxsdk/fxsdk.sh @@ -2,7 +2,7 @@ set -e -# Note: this line is edited at install time to insert the install folder +# Note: this line is edited at compile time to insert the install folder PREFIX=\ usage_string=$(cat << EOF @@ -210,9 +210,9 @@ LDFLAGS_CG += -Wl,-Map=build-cg/map # Here you can add fxconv options for each converted file, individually. # The syntax is ".". For example, to specify the parameters for a -# font name "hexa.png", you might write: +# font named "hexa.png", you might write: # -# FONT.hexa.png = charset:print grid:size:3x5 grid.padding:1 +# FONT.hexa.png = charset:print grid.size:3x5 grid.padding:1 EOF }