-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·54 lines (40 loc) · 1.41 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
44
45
46
47
48
49
50
51
52
53
54
# Compiler variables
CXX_mac = clang
CXX_linux = gcc
CXX_win = clang
CFLAGS = -Wall -O3
LDFLAGS = -L$(shell brew --prefix allegro)/lib -lallegro -lallegro_primitives -lallegro_audio -lallegro_acodec -lallegro_font -lallegro_ttf -lallegro_main
INCLUDE = -I$(shell brew --prefix allegro)/include/allegro5
# Object files
OBJS = blasteroids.o spaceship.o blast.o asteroid.o bbox.o utils.o
# Output files for different platforms
OUT_mac = blasteroid_mac # Output for macOS
OUT_linux = blasteroid_linux # Output for Linux
OUT_win = blasteroid.exe # Output for Windows
# Default target: build for all platforms
all: mac linux win
# Clean target
clean:
rm -rf *.o $(OUT_mac) $(OUT_linux) $(OUT_win)
# macOS target
mac: $(OBJS)
$(CXX_mac) $(OBJS) -o $(OUT_mac) $(INCLUDE) $(CFLAGS) $(LDFLAGS)
# Linux target
linux: $(OBJS)
$(CXX_linux) $(OBJS) -o $(OUT_linux) $(INCLUDE) $(CFLAGS) $(LDFLAGS)
# Windows target
win: $(OBJS)
$(CXX_win) $(OBJS) -o $(OUT_win) $(INCLUDE) $(CFLAGS) $(LDFLAGS)
# Compilation rules for object files
blasteroids.o: blasteroids.c
$(CXX_mac) -c blasteroids.c $(INCLUDE) $(CFLAGS)
spaceship.o: spaceship.c
$(CXX_mac) -c spaceship.c $(INCLUDE) $(CFLAGS)
blast.o: blast.c
$(CXX_mac) -c blast.c $(INCLUDE) $(CFLAGS)
asteroid.o: asteroid.c
$(CXX_mac) -c asteroid.c $(INCLUDE) $(CFLAGS)
bbox.o: bbox.c
$(CXX_mac) -c bbox.c $(INCLUDE) $(CFLAGS)
utils.o: utils.c
$(CXX_mac) -c utils.c $(INCLUDE) $(CFLAGS)