2023-08-26 19:04:02 +02:00
|
|
|
include Makeconf
|
|
|
|
|
2023-08-29 23:19:13 +02:00
|
|
|
test-srcs := $(wildcard tests/*.cpp)
|
|
|
|
|
2023-08-28 21:56:54 +02:00
|
|
|
emu-objs := $(addsuffix .o,$(modules))
|
2023-08-29 23:19:13 +02:00
|
|
|
test-objs := $(patsubst %.cpp,%.o,$(test-srcs))
|
2023-08-29 23:22:20 +02:00
|
|
|
clean-objs := $(emu-objs) $(test-objs) libemu.a vgbc vgbc.test
|
|
|
|
|
2023-08-29 23:18:51 +02:00
|
|
|
headers := $(wildcard */*.h)
|
2023-08-28 21:56:54 +02:00
|
|
|
|
|
|
|
.PHONY: all test clean
|
|
|
|
|
|
|
|
all: vgbc $(test-targets)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf $(clean-objs)
|
|
|
|
|
2023-08-28 22:31:24 +02:00
|
|
|
test: vgbc.test
|
2023-08-28 23:07:53 +02:00
|
|
|
@./$<
|
2023-08-26 19:04:02 +02:00
|
|
|
|
2023-08-29 23:18:51 +02:00
|
|
|
%.o: %.cpp $(headers)
|
|
|
|
g++ $(CXX_FLAGS) -c -o $@ $<
|
2023-08-26 19:04:02 +02:00
|
|
|
|
2023-08-28 21:56:54 +02:00
|
|
|
libemu.a: $(emu-objs)
|
|
|
|
ar -rc $@ $^
|
|
|
|
|
2023-08-28 22:31:24 +02:00
|
|
|
vgbc: main.c libemu.a
|
2023-08-28 21:56:54 +02:00
|
|
|
g++ $(CXX_FLAGS) -o $@ $^
|
|
|
|
|
2023-08-29 23:19:13 +02:00
|
|
|
vgbc.test: $(test-objs) libemu.a
|
2023-08-28 21:56:54 +02:00
|
|
|
g++ $(CXX_FLAGS) -o $@ $^
|