mirror of
https://git.planet-casio.com/Lephenixnoir/fxsdk.git
synced 2024-12-28 20:43:37 +01:00
build: rewrite PREFIX in fxsdk.sh at compile-time
This makes it possible to change PREFIX at the last minute when running install, effectively installing the files into a false packaging root while retaining the same contents as if installed normally.
This commit is contained in:
parent
e66035da44
commit
7d31294dc6
3 changed files with 22 additions and 11 deletions
23
Makefile
23
Makefile
|
@ -18,7 +18,8 @@ dflags = -MT $@ -MMD -MP -MF $(@:%.o=%.d)
|
||||||
# $TARGETS is provided by Makefile.cfg.
|
# $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/%)
|
bin = $(TARGETS:%=bin/%)
|
||||||
|
|
||||||
# fxconv has no sources files because it's written in Python, and fxsdk has no
|
# 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-fxg1a := $(call obj,src-fxg1a)
|
||||||
obj-fxos := $(call obj,src-fxos) $(call lex,lex-fxos)
|
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
|
# Symbolic targets
|
||||||
|
|
||||||
all: $(bin)
|
all: $(bin)
|
||||||
|
|
||||||
|
all-fxsdk: bin/fxsdk.sh
|
||||||
all-fxg1a: bin/fxg1a
|
all-fxg1a: bin/fxg1a
|
||||||
all-fxos: bin/fxos
|
all-fxos: bin/fxos
|
||||||
|
|
||||||
# Explicit targets
|
# Explicit targets
|
||||||
|
|
||||||
|
bin/fxsdk.sh: fxsdk/fxsdk.sh
|
||||||
|
sed -e $(sed) $< > $@
|
||||||
bin/fxg1a: $(obj-fxg1a) | bin/
|
bin/fxg1a: $(obj-fxg1a) | bin/
|
||||||
gcc $^ -o $@ $(lflags)
|
gcc $^ -o $@ $(lflags)
|
||||||
bin/fxos: $(obj-fxos) | bin/
|
bin/fxos: $(obj-fxos) | bin/
|
||||||
|
@ -87,24 +99,21 @@ Makefile.cfg:
|
||||||
|
|
||||||
m644 := -m 644
|
m644 := -m 644
|
||||||
m755 := -m 755
|
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"
|
ifeq "$(shell uname)" "Darwin"
|
||||||
m644 :=
|
m644 :=
|
||||||
m755 :=
|
m755 :=
|
||||||
sed := -i '' -e "$$(printf '/^PREFIX=/ a \\\n$(PREFIX)')"
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
install: $(bin)
|
install: $(bin)
|
||||||
install -d $(PREFIX)/bin
|
install -d $(PREFIX)/bin
|
||||||
install -d $(PREFIX)/share/fxsdk
|
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 fxos/*.txt $(m644) $(PREFIX)/share/fxsdk
|
||||||
install -d $(PREFIX)/share/fxsdk/assets
|
install -d $(PREFIX)/share/fxsdk/assets
|
||||||
install fxsdk/assets/* $(m644) $(PREFIX)/share/fxsdk/assets
|
install fxsdk/assets/* $(m644) $(PREFIX)/share/fxsdk/assets
|
||||||
install fxsdk/fxsdk.sh $(m755) $(PREFIX)/bin/fxsdk
|
install bin/fxsdk.sh $(m755) $(PREFIX)/bin/fxsdk
|
||||||
sed $(sed) $(PREFIX)/bin/fxsdk
|
|
||||||
install fxconv/fxconv-main.py $(m755) $(PREFIX)/bin/fxconv
|
install fxconv/fxconv-main.py $(m755) $(PREFIX)/bin/fxconv
|
||||||
install fxconv/fxconv.py $(m644) $(PREFIX)/bin
|
install fxconv/fxconv.py $(m644) $(PREFIX)/bin
|
||||||
|
|
||||||
|
|
4
configure
vendored
4
configure
vendored
|
@ -92,7 +92,9 @@ esac; done
|
||||||
|
|
||||||
gen()
|
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 ="
|
echo -n "TARGETS ="
|
||||||
|
|
||||||
[[ $BUILD_fxsdk = 1 ]] && echo -n " fxsdk"
|
[[ $BUILD_fxsdk = 1 ]] && echo -n " fxsdk"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
set -e
|
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=\
|
PREFIX=\
|
||||||
|
|
||||||
usage_string=$(cat << EOF
|
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.
|
# Here you can add fxconv options for each converted file, individually.
|
||||||
# The syntax is "<type>.<file>". For example, to specify the parameters for a
|
# The syntax is "<type>.<file>". 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
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue