-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
41 lines (30 loc) · 936 Bytes
/
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
CC = clang
PYTHON ?= python3
TEST_POOL ?= 1
TESTS ?= all
CFLAGS ?= -std=c99 -Wall -Wextra -pedantic -O3
CFLAGS_DEPS ?= $(CFLAGS) -MMD -MP
OBJ = $(patsubst src/%.c,obj/%.o,$(wildcard src/*.c)) $(patsubst src/peripherals/%.c,obj/peripherals/%.o,$(wildcard src/peripherals/*.c))
OBJ_PLUS = $(OBJ) obj/instructions.o
DEPS = $(OBJ:.o=.d)
TARGET := atsim
.PHONY: all run clean instructions test
all: bin/$(TARGET) $(OBJ_PLUS)
obj/%.o: src/%.c
@mkdir -p $(dir $@)
$(CC) $(CFLAGS_DEPS) -c -o $@ $<
bin/$(TARGET): $(OBJ_PLUS)
@mkdir -p bin
$(CC) $(CFLAGS) -o bin/$(TARGET) $^
src/instructions.c: instructions.py
$(PYTHON) instructions.py
instructions: src/instructions.c
run: bin/$(TARGET)
./bin/$(TARGET) $(ARGS)
test:
$(PYTHON) test/instruction_tests.py --python=$(PYTHON) --pool=$(TEST_POOL) --tests=$(TESTS)
clean:
$(RM) $(OBJ)
$(RM) $(DEPS)
$(RM) bin/$(TARGET)
-include $(DEPS)