-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakefile
38 lines (29 loc) · 803 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
BIN = ./bin
OUT = $(BIN)/app
INSTALL_FOLDER = /usr/bin
INSTALL = $(INSTALL_FOLDER)/cnake
SRC = $(wildcard src/*.c)
DEPS = $(wildcard src/*.h)
OBJ = $(addsuffix .o,$(subst src/,$(BIN)/,$(basename $(SRC))))
CSTD = c11
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
CSTD = gnu11
endif
CC = gcc
CFLAGS = -O2 -std=$(CSTD) -Wall -Wextra -Werror -pedantic -Wno-deprecated-declarations
LIBS = -lm -lSDL2main -lSDL2 -lSDL2_image -lSDL2_ttf -lSDL2_mixer
$(OUT): $(BIN) $(OBJ) $(SRC)
cp -r ./res/cnake_assets ./bin/
$(CC) $(CFLAGS) -o $(OUT) $(OBJ) $(LIBS)
$(BIN)/%.o: src/%.c $(DEPS)
$(CC) -c $< $(CFLAGS) -o $@
$(BIN):
mkdir -p $(BIN)
install: $(OUT)
cp $(OUT) $(INSTALL)
cp -r ./res/cnake_assets $(INSTALL_FOLDER)/
clean:
rm -r $(BIN)/*
all:
@echo compile, install, clean