vgbc/Makefile

31 lines
533 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
@./$<
%.o: %.cpp $(headers)
g++ $(CXX_FLAGS) -c -o $@ $<
libemu.a: $(emu-objs)
ar -rc $@ $^
vgbc: main.o libemu.a
g++ $(CXX_FLAGS) -o $@ $^
vgbc.test: $(test-objs) libemu.a
g++ $(CXX_FLAGS) -o $@ $^