vgbc/Makefile

36 lines
677 B
Makefile

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 main.o
headers := $(wildcard */*.h)
.PHONY: all test clean
all: vgbc
clean:
rm -rf $(clean-objs)
test: vgbc.test
@echo " ... run test $<"; \
./$< $(if $(V),-s,)
%.o: %.cpp $(headers)
@echo " ... build $@"; \
g++ $(CXX_FLAGS) -c -o $@ $<
libemu.a: $(emu-objs)
@echo " ... pack $@"; \
ar -rc $@ $^
vgbc: main.o libemu.a
@echo " ==> link $@"; \
g++ $(CXX_FLAGS) -o $@ $^
vgbc.test: $(test-objs) libemu.a
@echo " ==> link $@"; \
g++ $(CXX_FLAGS) -o $@ $^