-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
39 lines (29 loc) · 1 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
# Define the default compiler and flags
CC = clang
CFLAGS = -std=c99 -Wall -Wno-missing-braces -Wunused-result -D_DEFAULT_SOURCE
# Define the project name and source file
PROJECT_NAME = pmg
PROJECT_SOURCE = main.c
RAYLIB_PATH = ../../raylib
INCLUDE_PATHS = -I$(RAYLIB_PATH)/src -I$(RAYLIB_PATH)/src/external -I$(RAYLIB_PATH)/src/extras
LDFLAGS = -L$(RAYLIB_PATH)/src -L$(RAYLIB_PATH)/src/platform
# Define the libraries required on linking
LDLIBS = -lraylib -framework OpenGL -framework Cocoa -framework IOKit -framework CoreAudio -framework CoreVideo
# Define the build mode (DEBUG or RELEASE)
BUILD_MODE = RELEASE
# Define the object files
OBJS = $(PROJECT_SOURCE:.c=.o)
# Default target
all: $(PROJECT_NAME)
# Build the project
$(PROJECT_NAME): $(OBJS)
$(CC) -o $@ $(OBJS) $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS)
# Compile source files
%.o: %.c
$(CC) -c $< -o $@ $(CFLAGS) $(INCLUDE_PATHS)
# Run the project
run: $(PROJECT_NAME)
./$(PROJECT_NAME)
# Clean everything
clean:
rm -fv *.o $(PROJECT_NAME)