-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
62 lines (49 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
55
56
57
58
59
60
61
62
# Makefile for Fox's Tale game
# Set compiler options
CC=g++
CFLAGS=-c -I./include -DROLL
LDFLAGS=-L./lib -lsfml-graphics -lsfml-audio -lsfml-window -lsfml-system -mwindows -DROLL
# Define source files and object files
SOURCES=$(wildcard ./src/*.cpp)
OBJECTS=$(patsubst ./src/%.cpp, ./obj/%.o, $(SOURCES))
# Define executable name
EXECUTABLE=FoxsTale
# Define cleaning targets
CLEAN_TARGETS=clean cleanall
# Define help message
HELP_MESSAGE=\
"Available targets:\n"\
"compile - Compile the game.\n"\
"clean - Delete all object files.\n"\
"cleanall- Delete all object files and the executable.\n"\
"desktop - Create a desktop shortcut to the executable.\n"\
"help - Display this help message.\n"
# Define targets
.PHONY: all
all: compile
.PHONY: compile
compile: $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CC) $(LDFLAGS) $^ -o $@
mv $(EXECUTABLE) ./bin/
./obj/%.o: ./src/%.cpp
$(CC) $(CFLAGS) $< -o $@
.PHONY: clean
clean:
rm -f ./obj/*.o
.PHONY: cleanall
cleanall: clean
rm -f ./bin/$(EXECUTABLE)
.PHONY: desktop
desktop:
@echo "[Desktop Entry]" > FoxsTale.desktop
@echo "Type=Application" >> FoxsTale.desktop
@echo "Name=Fox's Tale" >> FoxsTale.desktop
@echo "Icon=$(PWD)/icon.png" >> FoxsTale.desktop
@echo "Exec=$(PWD)/bin/$(EXECUTABLE)" >> FoxsTale.desktop
@echo "Categories=Game" >> FoxsTale.desktop
@chmod +x FoxsTale.desktop
@mv FoxsTale.desktop ~/Desktop/
.PHONY: help
help:
@echo $(HELP_MESSAGE)