medfall

A super great game engine
Log | Files | Refs

rules.mk (1092B)


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# This file contains Makefile rules to actually build things

# Create the binaries
$(BINS): %: $(BIN_COMMON_OBJS)
	@printf "\e[1;31mbuilding $@\e[0m\n"
	@$(CXX) -o $@ $^ $(LDFLAGS)

# Create stb_*.cc and then stb_*.o
STB_OBJS := $(addprefix stb_,$(addsuffix .o,$(STBS)))

# The STB libraries need you to pass -DSTB_*_IMPLEMENTATION to get the actual code
STB_CXXFLAGS := $(shell echo $(addprefix -DSTB_,$(addsuffix _IMPLEMENTATION,$(STBS))) | tr a-z A-Z)

$(STB_OBJS): %.o: %.h
	@printf "\e[1;32mbuilding $<\e[0m\n"
	@$(CXX) $(STB_CXXFLAGS) $(CXXFLAGS) -x c++ -c -o $@ $<

# Build *.o from *.cc
# The -M* stuff is for generating dependency lists
%.o: %.cc
	@printf "\e[1;32mbuilding $<\e[0m\n"
	@mkdir -p .deps
	@$(CXX) $(CXXFLAGS) -c -o $@ $< -MMD -MP -MF .deps/$(subst /,_,$*).d $(WARNINGS)

# Build *.a from *.o
%.a:
	@printf "\e[1;35mbuilding $@\e[0m\n"
	@$(AR) rs $@ $^

# Generate visitor headers
visitors/%.h:
	@mkdir -p visitors
	scripts/gen_visitors.lua $^ > $@

clean:
	rm -f $(BINS) *.o rng/*.o server/*.o *.a *.so test_lockfree
	rm -rf visitors
	rm -rf .deps

-include .deps/*.d