-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
47 lines (35 loc) · 992 Bytes
/
Makefile
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
41
42
43
44
45
46
47
CXX ?= g++
XXD ?= xxd
STRIP := strip
STANDARD ?= c++20
CXXFLAGS ?= -O3 -Wall -Wextra -pedantic -g
CXXFLAGS += -std=$(STANDARD) -c -Iinclude
LDFLAGS ?= $(shell pkg-config --libs sfml-window sfml-graphics sfml-system sfml-network)
sources := $(shell find src -type f -name "*.cpp")
objects := $(sources:src/%.cpp=build/%.o)
depends := $(sources:src/%.cpp=build/%.d)
assets_o := $(shell find assets -type f)
assets := $(assets_o:assets/%.ttf=include/%.asset)
builddir ?= build
assetdir ?= assets
all: orbitfight
$(builddir)/%.o: src/%.cpp $(assets)
@printf "CC\t%s\n" $@
@mkdir -p $(@D)
@$(CXX) $(CXXFLAGS) -MMD -MP $< -o $@
-include $(depends)
orbitfight: $(objects)
@printf "LD\t%s\n" $(builddir)/$@
@$(CXX) $^ -o $(builddir)/$@ $(LDFLAGS)
include/%.asset: $(assetdir)/%.*
@printf "XXD\t%s\n" $@
@$(XXD) -i $< $@
clean:
rm build/*.o
rm build/*.d
rm include/*.asset
strip: all
$(STRIP) $(builddir)/orbitfight
run: all
@$(builddir)/orbitfight
.PHONY: all clean strip run