-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (41 loc) · 1.46 KB
/
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
48
49
50
51
52
53
54
55
GAME := us
CC = $(shell brew --prefix llvm)/bin/clang
CFLAGS = -std=c99 -Wall -Wno-missing-braces -g -DDEBUG
LDFLAGS =
ROOT = ./
BIN = ./bin
INCLUDES = -I./src/*.h
SRCS = $(shell find src -name "*.c")
SDL_PATH = lib/sdl
SDL_BIN = $(BIN)/$(SDL_PATH)
SDL_MIXER_PATH = lib/sdl_mixer
SDL_MIXER_BIN = $(BIN)/$(SDL_MIXER_PATH)
INCLUDES += -I$(SDL_PATH)/include -I$(SDL_MIXER_PATH)/include
LDFLAGS += -L$(SDL_BIN) -L$(SDL_MIXER_BIN) -Wl,-rpath -Wl,${ROOT} -lSDL3 -lSDL3_mixer
timeco:
$(CC) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(SRCS) -o $(BIN)/$@
sdl:
$(shell mkdir -p $(SDL_BIN))
cmake -S $(SDL_PATH) -B $(SDL_BIN) -DSDL_STATIC=ON -DCMAKE_OSX_ARCHITECTURES="x86_64"
cd $(SDL_BIN) && make -j 10
sdl_mixer:
$(shell mkdir -p $(SDL_MIXER_BIN))
cmake -S $(SDL_MIXER_PATH) -B $(SDL_MIXER_BIN) -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_PREFIX_PATH=$(shell pwd)/bin/lib/sdl
cd $(SDL_MIXER_BIN) && make -j 10
all: sdl sdl_mixer timeco
install:
cp $(BIN)/timeco $(BIN)/$(GAME)
cp $(SDL_BIN)/libSDL3.0.dylib $(BIN)/$(GAME)
cp $(SDL_BIN)/libSDL3.dylib $(BIN)/$(GAME)
cp $(SDL_BIN)/libSDL3.a $(BIN)/$(GAME)
cp $(SDL_MIXER_BIN)/libSDL3_mixer.dylib $(BIN)/$(GAME)
cp $(SDL_MIXER_BIN)/libSDL3_mixer.0.dylib $(BIN)/$(GAME)
cp $(SDL_MIXER_BIN)/libSDL3_mixer.0.0.0.dylib $(BIN)/$(GAME)
run: install
cd $(BIN)/$(GAME) && ./timeco
clean-all:
find bin ! -name 'src' ! -name 'util' -type d -maxdepth 1 -mindepth 1 -exec rm -rf {} +
clean:
rm -f $(BIN)/timeco
serve:
bundle exec jekyll serve --watch