-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
51 lines (37 loc) · 1.09 KB
/
Makefile
File metadata and controls
51 lines (37 loc) · 1.09 KB
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
# Makefile for libretro frontend using raylib
# Compiler
CC = clang
# Directories
RAYLIB_DIR = ../raylib/src
SRC_DIR = .
OBJ_DIR = obj
# Source files
SOURCES = main.c libretro_frontend.c libretro_environment.c libretro_video.c libretro_audio.c libretro_input.c libretro_core.c
OBJECTS = $(SOURCES:%.c=$(OBJ_DIR)/%.o)
# Libraries
RAYLIB_LIB = $(RAYLIB_DIR)/libraylib_osx.a
LIBS = -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo -framework CoreAudio -framework AudioToolbox -ldl
# Compiler flags
CFLAGS = -std=c99 -Wall -Wextra -O2
INCLUDES = -I$(RAYLIB_DIR) -I$(SRC_DIR)
# Output
TARGET = libretro_raylib
# Default target
all: $(TARGET)
# Create object directory
$(OBJ_DIR):
mkdir -p $(OBJ_DIR)
# Build object files
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c | $(OBJ_DIR)
$(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
# Link executable
$(TARGET): $(OBJECTS) $(RAYLIB_LIB)
$(CC) $(OBJECTS) $(RAYLIB_LIB) $(LIBS) -o $(TARGET)
# Clean build artifacts
clean:
rm -rf $(OBJ_DIR) $(TARGET)
# Install (optional)
install: $(TARGET)
cp $(TARGET) /usr/local/bin/
# Phony targets
.PHONY: all clean install