-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
73 lines (62 loc) · 2.89 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Author: TFM:Pshy#3752 DC:Pshy#7998
OUT_DIR = tfm_lua
TEST_RESULTS_DIR = test_results
DEPS_DIR = deps
# Modulepacks names:
NAME_PSHYVS = $(OUT_DIR)/pshy.games.vs.tfm.lua.txt
NAME_PSHYVS_COMMENTATOR = $(OUT_DIR)/pshy.games.vs_with_commentator.tfm.lua.txt
NAME_VALENTINES_RACING = $(OUT_DIR)/pshy.games.valentines_racing.tfm.lua.txt
NAME_PSHYFUN = $(OUT_DIR)/pshy.games.fun.tfm.lua.txt
NAME_PACMICE = $(OUT_DIR)/pshy.games.pacmice.tfm.lua.txt
NAME_BONUSES = $(OUT_DIR)/pshy.rotations.list.bonuses.tfm.lua.txt
NAME_CHICKENGAME = $(OUT_DIR)/pshy.games.chickengame.tfm.lua.txt
NAME_123SOLEIL = $(OUT_DIR)/pshy.games.123soleil.tfm.lua.txt
NAME_ESSENTIALS_PLUS = $(OUT_DIR)/pshy.essentials.everything.tfm.lua.txt
NAME_FASTTIME = $(OUT_DIR)/pshy.games.fasttime.tfm.lua.txt
NAME_THEBESTSHAMAN = $(OUT_DIR)/pshy.games.thebestshaman.tfm.lua.txt
NAME_EMOTICONS = $(OUT_DIR)/pshy.bases.emoticons.tfm.lua.txt
NAME_ANVILCLICK = $(OUT_DIR)/pshy.games.anvilclick.tfm.lua.txt
NAME_POKEBALL = $(OUT_DIR)/pshy.games.pokeball.tfm.lua.txt
ALL_NAMES = $(NAME_123SOLEIL) $(NAME_POKEBALL) $(NAME_EMOTICONS) $(NAME_PSHYFUN) $(NAME_ANVILCLICK) $(NAME_PSHYVS) $(NAME_BONUSES) $(NAME_CHICKENGAME) $(NAME_THEBESTSHAMAN) $(NAME_PSHYVS_COMMENTATOR) $(NAME_FASTTIME) $(NAME_PACMICE) $(NAME_VALENTINES_RACING) $(NAME_ESSENTIALS_PLUS)
ALL_TESTS = $(patsubst $(OUT_DIR)/%.tfm.lua.txt, $(TEST_RESULTS_DIR)/%.stdout.txt, $(ALL_NAMES))
OPTIONS = --werror --test-init --minify --old-physics
# Rules:
.PHONY: all
all: $(ALL_NAMES)
.PHONY: test
test: $(ALL_TESTS)
%/:
mkdir -p $@
-include $(DEPS_DIR)/*.tfm.lua.txt.d
$(OUT_DIR)/%.tfm.lua.txt: | $(OUT_DIR)/ $(DEPS_DIR)/
@printf "\e[92m Generating %s\n" $@ || true
@printf "\e[94m" || true
./combine.py $(OPTIONS) --deps $(patsubst $(OUT_DIR)/%.tfm.lua.txt, $(DEPS_DIR)/%.tfm.lua.txt.d, $@) --out $@ -- $(patsubst $(OUT_DIR)/%.tfm.lua.txt, %, $@)
@printf "\e[0m" || true
$(TEST_RESULTS_DIR)/%.stdout.txt: $(OUT_DIR)/%.tfm.lua.txt $(NAME_TFMEMULATOR) | $(TEST_RESULTS_DIR)/
@printf "\e[93m \nTesting %s:\n" $< || true
@printf "\e[95m" || true
#(cat $(NAME_TFMEMULATOR) ; echo "\ntfmenv.BasicTest()\n" ; cat $< ; echo "") > $@.test.lua
(echo "\npackage.path = ';./lua/?.lua;./lua/?/init.lua'\npshy = {require = require}\ntfmenv = require(\"pshy.tfm_emulator\")\ntfmenv.InitBasicTest()\ntfmenv.LoadModule(\"$<\")\ntfmenv.BasicTest()\n") > $@.test.lua
@echo 'cat $@.test.lua | lua5.2 > $@'
@echo -n "\e[91m" 1>&2
@cat $@.test.lua | lua > $@
@printf "\e[95mSTDOUT: \e[96m\n" || true
@cat $@
@printf "\e[0m" || true
.PHONY: clean
clean:
@printf "\e[91m" || true
rm -rf $(DEPS_DIR)/*.tfm.lua.txt.d
rmdir $(DEPS_DIR) || true
rm -rf $(TEST_RESULTS_DIR)/*.stdout.txt
rmdir $(TEST_RESULTS_DIR) || true
@printf "\e[0m" || true
.PHONY: fclean
fclean: clean
@printf "\e[91m" || true
rm -rf $(OUT_DIR)/*.tfm.lua.txt
rmdir $(OUT_DIR) || true
@printf "\e[0m" || true
.PHONY: re
re: fclean all