-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
31 lines (27 loc) · 943 Bytes
/
makefile
File metadata and controls
31 lines (27 loc) · 943 Bytes
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
CC = clang++
CFLAGS = -g
STD = c++20
STDLIB = libc++
MYINCLUDES = src/
SDL3INCLUDE = /usr/lib/sdl3/include
SDL3LIB = /usr/lib/sdl3/build/
SDLSTATICNAME = libSDL3.a
WARNOPTIONS = -Wall
# How to turn a .cpp file into a .o, essentially just compile it
%.o: %.cpp
$(CC) $(WARNOPTIONS) -stdlib=$(STDLIB) -std=$(STD) -I$(SDL3INCLUDE) -I$(MYINCLUDES) $(CFLAGS) -c $< -o $@
# How to build main
MAINSOURCE = main.cpp
MAINOBJECTS = $(MAINSOURCE:.cpp=.o)
MAINEXE = main.exe
main: $(MAINOBJECTS)
$(CC) $(WARNOPTIONS) -stdlib=$(STDLIB) -L$(SDL3LIB) $(MAINOBJECTS) -o $(MAINEXE) -l:$(SDLSTATICNAME)
# How to build tests
TESTSOURCE = $(wildcard tests/*.cpp)
TESTOBJECTS = $(TESTSOURCE:.cpp=.o)
TESTEXE = test.exe
test: $(TESTOBJECTS)
$(CC) $(WARNOPTIONS) -stdlib=$(STDLIB) -L$(SDL3LIB) $(TESTOBJECTS) -o tests/$(TESTEXE) -l:$(SDLSTATICNAME)
all : main test
clean:
rm -f $(wildcard *.exe) $(wildcard *.o) $(wildcard tests/*.exe) $(wildcard tests/*.o)