diff options
Diffstat (limited to 'makefile')
-rw-r--r-- | makefile | 25 |
1 files changed, 21 insertions, 4 deletions
@@ -29,7 +29,11 @@ DESTDIR = / | |||
29 | INSTALL_PREFIX = usr/local | 29 | INSTALL_PREFIX = usr/local |
30 | # Test | 30 | # Test |
31 | TEST_INPUT = ./spec/inputs | 31 | TEST_INPUT = ./spec/inputs |
32 | TEST_OUTPUT = ./spec/outputs | 32 | TEST_OUTPUT = ./spec/generated |
33 | GEN_OUTPUT = ./spec/outputs | ||
34 | |||
35 | PLAT = macos | ||
36 | |||
33 | #### END PROJECT SETTINGS #### | 37 | #### END PROJECT SETTINGS #### |
34 | 38 | ||
35 | # Optionally you may move the section above to a separate config.mk file, and | 39 | # Optionally you may move the section above to a separate config.mk file, and |
@@ -54,6 +58,7 @@ endif | |||
54 | # Add platform related linker flag | 58 | # Add platform related linker flag |
55 | ifneq ($(UNAME_S),Darwin) | 59 | ifneq ($(UNAME_S),Darwin) |
56 | LINK_FLAGS += -lstdc++fs -Wl,-E | 60 | LINK_FLAGS += -lstdc++fs -Wl,-E |
61 | PLAT = linux | ||
57 | endif | 62 | endif |
58 | 63 | ||
59 | # Function used to check variables. Use on the command line: | 64 | # Function used to check variables. Use on the command line: |
@@ -179,7 +184,7 @@ else | |||
179 | @echo "Beginning release build" | 184 | @echo "Beginning release build" |
180 | endif | 185 | endif |
181 | ifneq ($(NO_LUA),true) | 186 | ifneq ($(NO_LUA),true) |
182 | @$(MAKE) generic -C $(SRC_PATH)/3rdParty/lua | 187 | @$(MAKE) $(PLAT) -C $(SRC_PATH)/3rdParty/lua |
183 | endif | 188 | endif |
184 | @$(START_TIME) | 189 | @$(START_TIME) |
185 | @$(MAKE) all --no-print-directory | 190 | @$(MAKE) all --no-print-directory |
@@ -231,7 +236,6 @@ dirs: | |||
231 | @echo "Creating directories" | 236 | @echo "Creating directories" |
232 | @mkdir -p $(dir $(OBJECTS)) | 237 | @mkdir -p $(dir $(OBJECTS)) |
233 | @mkdir -p $(BIN_PATH) | 238 | @mkdir -p $(BIN_PATH) |
234 | @mkdir -p $(TEST_OUTPUT) | ||
235 | 239 | ||
236 | # Installs to the set path | 240 | # Installs to the set path |
237 | .PHONY: install | 241 | .PHONY: install |
@@ -254,18 +258,31 @@ clean: | |||
254 | @echo "Deleting directories" | 258 | @echo "Deleting directories" |
255 | @$(RM) -r build | 259 | @$(RM) -r build |
256 | @$(RM) -r bin | 260 | @$(RM) -r bin |
257 | @echo "Deleting generated Lua codes" | ||
258 | @$(RM) -r $(TEST_OUTPUT) | 261 | @$(RM) -r $(TEST_OUTPUT) |
259 | 262 | ||
260 | # Test Yuescript compiler | 263 | # Test Yuescript compiler |
261 | .PHONY: test | 264 | .PHONY: test |
262 | test: release | 265 | test: release |
266 | @mkdir -p $(TEST_OUTPUT) | ||
263 | @echo "Compiling Yuescript codes..." | 267 | @echo "Compiling Yuescript codes..." |
264 | @$(START_TIME) | 268 | @$(START_TIME) |
265 | @./$(BIN_NAME) $(TEST_INPUT) -t $(TEST_OUTPUT) -tl_enabled=true | 269 | @./$(BIN_NAME) $(TEST_INPUT) -t $(TEST_OUTPUT) -tl_enabled=true |
266 | @./$(BIN_NAME) $(TEST_INPUT)/teal-lang.yue -o $(TEST_OUTPUT)/teal-lang.lua | 270 | @./$(BIN_NAME) $(TEST_INPUT)/teal-lang.yue -o $(TEST_OUTPUT)/teal-lang.lua |
267 | @echo -en "Compile time: " | 271 | @echo -en "Compile time: " |
268 | @$(END_TIME) | 272 | @$(END_TIME) |
273 | @./$(BIN_NAME) -e "$$(printf "r = io.popen('git diff --no-index $(TEST_OUTPUT) $(GEN_OUTPUT) | head -5')\\\\read '*a'\nif r ~= ''\n print r\n os.exit 1")" | ||
274 | @$(RM) -r $(TEST_OUTPUT) | ||
275 | @echo "Done!" | ||
276 | |||
277 | # Test Yuescript compiler | ||
278 | .PHONY: gen | ||
279 | gen: release | ||
280 | @echo "Compiling Yuescript codes..." | ||
281 | @$(START_TIME) | ||
282 | @./$(BIN_NAME) $(TEST_INPUT) -t $(GEN_OUTPUT) -tl_enabled=true | ||
283 | @./$(BIN_NAME) $(TEST_INPUT)/teal-lang.yue -o $(GEN_OUTPUT)/teal-lang.lua | ||
284 | @echo -en "Compile time: " | ||
285 | @$(END_TIME) | ||
269 | 286 | ||
270 | # Main rule, checks the executable and symlinks to the output | 287 | # Main rule, checks the executable and symlinks to the output |
271 | all: $(BIN_PATH)/$(BIN_NAME) | 288 | all: $(BIN_PATH)/$(BIN_NAME) |