-
Notifications
You must be signed in to change notification settings - Fork 2
/
makefile
43 lines (35 loc) · 1.01 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
CC = gcc
CFLAGS = -W -Wall
LDFLAGS = -lallegro -lallegro_image -lallegro_font -lallegro_ttf -lallegro_audio -lallegro_acodec
BIN_DIR = bin
OBJ_DIR = obj
SRC_DIR = src
INC_DIR = include
# Windows Only
# Path to Allegro headers
ALLEGRO_INCLUDE_PATH = allegro/include
# Path to Allegro monolith library
ALLEGRO_MONOLITH_PATH = $(ALLEGRO_INCLUDE_PATH:include=lib/liballegro-5.0.10-monolith-mt.a)
EXE = GalaxyDefenders
SRC = $(wildcard $(SRC_DIR)/*.c)
OBJ = $(subst $(SRC_DIR), $(OBJ_DIR), $(SRC:.c=.o))
all: $(EXE)
$(EXE): $(OBJ)
ifeq ($(OS),Windows_NT)
@if not exist "$(BIN_DIR)" mkdir $(BIN_DIR)
$(CC) -mwindows -o $(BIN_DIR)/$@ $(OBJ) $(ALLEGRO_MONOLITH_PATH)
else
mkdir -p $(BIN_DIR)
$(CC) -I$(INC_DIR) $(LDFLAGS) -o $(BIN_DIR)/$@ $(OBJ)
endif
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
ifeq ($(OS),Windows_NT)
@if not exist "$(OBJ_DIR)" mkdir $(OBJ_DIR)
$(CC) -I$(INC_DIR) -I $(ALLEGRO_INCLUDE_PATH) $(CFLAGS) -c $< -o $@
else
mkdir -p $(OBJ_DIR)
$(CC) -I$(INC_DIR) $(CFLAGS) -c $< -o $@
endif
clean:
$(RM) $(OBJ)
.PHONY: all clean