HOI4_randomchanges/Makefile

52 lines
1.5 KiB
Makefile
Raw Normal View History

2023-11-08 19:40:04 +00:00
all: patch/tree/map/definition.csv
DESTDIR ?= install
MODNAME ?= randchgs
MODPATH ?= C:/Users/User/Documents/Paradox Interactive/Hearts of Iron IV/mod/randchgs
2023-11-11 14:57:22 +00:00
nullstring :=
space :=
space +=
replaceQuestionBySpace = $(subst ?,$(space),$1)
replaceSpaceByQuestion = $(subst $(space),?,$1)
2023-11-08 19:40:04 +00:00
2023-11-10 20:17:58 +00:00
# patch
2023-11-08 19:40:04 +00:00
VANILLA_SRC ?= ../vanilla
2023-11-10 20:17:58 +00:00
patchwork/map/definition.csv: $(VANILLA_SRC)/map/definition.csv patches/map_definition.patch
mkdir -p $(@D)
patch -u --binary -N -o $@ $^
2023-11-08 19:40:04 +00:00
2023-11-10 20:17:58 +00:00
#build
2023-11-11 14:57:22 +00:00
patched_requisites := patchwork/map/definition.csv "patchwork/history/countries/ISR - Israel.txt"
build:
mkdir $@
2023-11-10 20:17:58 +00:00
release: build/release.zip
2023-11-11 14:57:22 +00:00
image/$(MODNAME): $(wildcard scr/%) patchwork/map/definition.csv
mkdir -p $@
rsync -rv src/ $@/
rsync -rv patchwork/ $@/
image/$(MODNAME).zip: image/$(MODNAME) image/$(MODNAME).mod
cd image && zip -r $(MODNAME).zip $(MODNAME)
cd image && zip $(MODNAME).zip $(MODNAME).mod
image/$(MODNAME).mod: src/descriptor.mod
cp $< $@
printf '\n%s\n' 'path="$(MODPATH)/$(MODNAME)"' >> $@
2023-11-10 20:17:58 +00:00
build/release.zip: src/* $(patched_requisites) | build
cd src && zip -r ../build/$(@F) ./
cd patchwork && zip -r ../build/$(@F) ./
2023-11-10 20:17:58 +00:00
# install
install: $(DESTDIR)/$(MODNAME).mod | $(DESTDIR)/$(MODNAME)
$(DESTDIR)/$(MODNAME) $(DESTDIR):
mkdir -p $@
2023-11-10 20:17:58 +00:00
$(DESTDIR)/$(MODNAME)/descriptor.mod: build/release.zip | $(DESTDIR)/$(MODNAME)
cd $| && unzip -o $(abspath build/release.zip)
$(DESTDIR)/$(MODNAME).mod: $(DESTDIR)/$(MODNAME)/descriptor.mod
cp $< $@
printf '\n%s\n' 'path="$(MODPATH)/$(MODNAME)"' >> $@
2023-11-10 20:17:58 +00:00
#clean
clean:
rm -rf patchwork build
2023-11-10 20:17:58 +00:00
.PHONY: all release clean patch install