-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
39 lines (30 loc) · 842 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
OS := $(shell uname -s | tr A-Z a-z)
CC := c
SOURCE := source
INCLUDE := include
OUT := build
BIN := pixsim
CFDEBUG := -g
CFOPT := -O3
CFLAGS := -std=c99 $(CFDEBUG) -Wall -Wno-unused-function -Wno-switch -Wextra -pedantic -Wconversion
CLIBS := -lSDL2 -lSDL2_image -lSDL2_ttf
ifeq ($(OS), darwin)
PLATFORM := macosx
CC := clang
endif
ifeq ($(OS), linux)
PLATFORM := linux
CC := gcc
endif
prepare:
mkdir build
clean_bin:
rm $(OUT)/$(BIN)
clean:
rm -rf $(OUT)
build_macosx:
make prepare && $(CC) $(CFLAGS) -I./$(INCLUDE) $(SOURCE)/*.c -o $(OUT)/$(BIN) $(CLIBS)
build_linux:
make prepare && $(CC) $(CFLAGS) -g -I./$(INCLUDE) -I./`pkg-config --cflags sdl2` $(SOURCE)/*.c -o $(OUT)/$(BIN) $(CLIBS) -Wl,-Bstatic -lSDL2 -Wl,-Bdynamic -lm -ldl -lrt
.PHONY:
build clean