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-30 10:36:06 +02:00
|
|
|
clean-objs := $(emu-objs) $(test-objs) libemu.a vgbc vgbc.test main.o
|
2023-08-29 23:22:20 +02:00
|
|
|
|
2023-08-29 23:18:51 +02:00
|
|
|
headers := $(wildcard */*.h)
|
2023-08-28 21:56:54 +02:00
|
|
|
|
|
|
|
.PHONY: all test clean
|
|
|
|
|
2023-08-30 00:03:44 +02:00
|
|
|
all: vgbc
|
2023-08-28 21:56:54 +02:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf $(clean-objs)
|
|
|
|
|
2023-08-28 22:31:24 +02:00
|
|
|
test: vgbc.test
|
2023-08-30 10:48:05 +02:00
|
|
|
@echo " ... run test $<"; \
|
|
|
|
./$< $(if $(V),-s,)
|
2023-08-26 19:04:02 +02:00
|
|
|
|
2023-08-29 23:18:51 +02:00
|
|
|
%.o: %.cpp $(headers)
|
2023-08-30 10:48:05 +02:00
|
|
|
@echo " ... build $@"; \
|
2023-08-29 23:18:51 +02:00
|
|
|
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)
|
2023-08-30 10:48:05 +02:00
|
|
|
@echo " ... pack $@"; \
|
2023-08-28 21:56:54 +02:00
|
|
|
ar -rc $@ $^
|
|
|
|
|
2023-08-30 10:36:06 +02:00
|
|
|
vgbc: main.o libemu.a
|
2023-08-30 10:48:05 +02:00
|
|
|
@echo " ==> link $@"; \
|
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-30 10:48:05 +02:00
|
|
|
@echo " ==> link $@"; \
|
2023-08-28 21:56:54 +02:00
|
|
|
g++ $(CXX_FLAGS) -o $@ $^
|
2023-08-31 23:53:20 +02:00
|
|
|
|
|
|
|
vgbc.inspect: cartridge/inspector.o libemu.a
|
|
|
|
@echo " ==> link $@"; \
|
|
|
|
g++ $(CXX_FLAGS) -o $@ $^
|