Skip to content

Commit 906a420

Browse files
committed
update Makefile
1 parent ce92c61 commit 906a420

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

example/Makefile

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,26 @@ BUILD_DIR := build
44
DIST_DIR := dist
55
TEST_DIR := test
66
TEST_OK_DIR := $(TEST_DIR)/ok
7-
TEST_FAIL_DIR := $(TEST_DIR)/fail
7+
TEST_FAIL_DIR := $(TEST_DIR)/fail
8+
TEST_EXEC_DIR := ..
89

9-
PROJECT := example
10-
TARGET := $(DIST_DIR)/$(PROJECT).nes
11-
DEBUG := $(DIST_DIR)/$(PROJECT).dbg
12-
SOURCES := $(shell find $(SRC_DIR) -type f -name '*.asm')
13-
OBJECTS := $(SOURCES:$(SRC_DIR)/%.asm=$(BUILD_DIR)/%.o)
14-
NES_CFG := $(CONFIG_DIR)/nes.cfg
10+
PROJECT := example
11+
TARGET := $(DIST_DIR)/$(PROJECT).nes
12+
DEBUG := $(DIST_DIR)/$(PROJECT).dbg
13+
SOURCES := $(shell find $(SRC_DIR) -type f -name '*.asm')
14+
OBJECTS := $(SOURCES:$(SRC_DIR)/%.asm=$(BUILD_DIR)/%.o)
15+
NES_CFG := $(CONFIG_DIR)/nes.cfg
1516

16-
TEST_OK := $(shell find $(TEST_OK_DIR) -type f -name '*.test.json' | sort)
17-
TEST_FAIL := $(shell find $(TEST_FAIL_DIR) -type f -name '*.test.json' | sort)
18-
TEST_IDS := $(TEST_OK:%.test.json=%.test) $(TEST_FAIL:%.test.json=%.test)
17+
TEST_OK := $(shell find $(TEST_OK_DIR) -type f -name '*.test.json' | sort)
18+
TEST_FAIL := $(shell find $(TEST_FAIL_DIR) -type f -name '*.test.json' | sort)
19+
TEST_IDS := $(TEST_OK:%.test.json=%.test) $(TEST_FAIL:%.test.json=%.test)
1920

2021
AS := ca65
21-
ASFLAGS := --cpu 6502 --target nes --debug-info
22+
ASFLAGS := --cpu 6502 --target nes --debug-info
2223
LD := ld65
23-
LDFLAGS :=
24-
TEST_EXEC := ../6502_tester
24+
LDFLAGS :=
25+
TEST_EXEC := $(TEST_EXEC_DIR)/6502_tester
26+
TEST_FAILED_CODE := 200
2527

2628
.PHONY : all build test clean
2729

@@ -41,13 +43,13 @@ test : $(TEST_EXEC) $(TEST_IDS)
4143
@echo "All tests passed."
4244

4345
$(TEST_EXEC) :
44-
make -C ..
46+
make -C $(TEST_EXEC_DIR)
4547

4648
$(TEST_OK_DIR)/%.test : $(TEST_OK_DIR)/%.test.json
4749
$(TEST_EXEC) -d $(DEBUG) --quiet-ok --quiet-summary -t $<
4850

4951
$(TEST_FAIL_DIR)/%.test : $(TEST_FAIL_DIR)/%.test.json
50-
$(TEST_EXEC) -d $(DEBUG) --quiet-fail --quiet-summary -t $< && { exit 1; } || { [ $$? -eq 200 ] && exit 0 || exit 1; }
52+
$(TEST_EXEC) -d $(DEBUG) --quiet-fail --quiet-summary -t $< && { exit 1; } || { [ $$? -eq $(TEST_FAILED_CODE) ] && exit 0 || exit 1; }
5153

5254
clean :
5355
rm -rf $(BUILD_DIR)

0 commit comments

Comments
 (0)