vgbc/Makefile

41 lines
788 B
Makefile
Raw Normal View History

2023-08-26 19:04:02 +02:00
include Makeconf
test-srcs := $(wildcard tests/*.cpp)
emu-objs := $(addsuffix .o,$(modules))
test-objs := $(patsubst %.cpp,%.o,$(test-srcs))
clean-objs := $(emu-objs) $(test-objs) libemu.a vgbc vgbc.test vgbc.inspect main.o
2023-08-29 23:22:20 +02:00
headers := $(wildcard */*.h)
.PHONY: all test clean
all: vgbc
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
%.o: %.cpp $(headers)
2023-08-30 10:48:05 +02:00
@echo " ... build $@"; \
g++ $(CXX_FLAGS) -c -o $@ $<
2023-08-26 19:04:02 +02:00
libemu.a: $(emu-objs)
2023-08-30 10:48:05 +02:00
@echo " ... pack $@"; \
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 $@"; \
g++ $(CXX_FLAGS) -o $@ $^
vgbc.test: $(test-objs) libemu.a
2023-08-30 10:48:05 +02:00
@echo " ==> link $@"; \
g++ $(CXX_FLAGS) -o $@ $^
vgbc.inspect: cartridge/inspector.o libemu.a
@echo " ==> link $@"; \
g++ $(CXX_FLAGS) -o $@ $^