-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathMakefile
88 lines (72 loc) · 2.22 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
PREFIX?= /usr
CC?= gcc
ifeq ($(DEBUG),1)
CFLAGS?= -O0 -ggdb -DDEBUG -Wall
else
CFLAGS?= -O2 -finline-functions -funswitch-loops -fgcse-after-reload -fpredictive-commoning -ftree-vectorize
endif
ifeq ($(PLATFORM), rpi1)
CFLAGS= -O2 -march=armv6j -mfpu=vfp -mfloat-abi=hard
DATADIR= "\"./\""
endif
ifeq ($(PLATFORM), rpi23)
CFLAGS= -O2 -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard
DATADIR= "\"./\""
endif
ifeq ($(PLATFORM), rpi4_64)
CFLAGS= -O2 -march=armv8-a+crc+simd -mtune=cortex-a72
DATADIR= "\"./\""
endif
DATADIR?="\"$(PREFIX)/share/abbayev2\""
LDFLAGS?= -Wl,-z,relro
CFLAGS+= `sdl2-config --cflags` -DDATADIR=$(DATADIR)
LIBS= `sdl2-config --libs` -lSDL2_image -lSDL2_mixer -lm
PROG= abbayev2
SRCS= src/drawing.c \
src/ending.c \
src/enemies.c \
src/game.c \
src/gameover.c \
src/history.c \
src/jean.c \
src/loading.c \
src/main.c \
src/startscreen.c
OBJS = $(SRCS:%.c=%.o)
all: $(PROG)
$(PROG): $(OBJS)
@echo linking $@
@$(CC) $(OBJS) $(LDFLAGS) $(LIBS) -o $@
.SUFFIXES: .c .o
.c.o:
@echo compile $<
@$(CC) $(CFLAGS) -c $< -o $@
clean:
@echo cleaning...
@rm -f $(OBJS) $(PROG)
# Installation
install: $(PROG)
mkdir -p $(DESTDIR)$(PREFIX)/bin
cp $(PROG) $(DESTDIR)$(PREFIX)/bin
mkdir -p $(DESTDIR)$(PREFIX)/share/applications
cp abbaye.desktop $(DESTDIR)$(PREFIX)/share/applications
mkdir -p $(DESTDIR)$(PREFIX)/share/abbayev2/sounds
cp ./sounds/* $(DESTDIR)$(PREFIX)/share/abbayev2/sounds
mkdir -p $(DESTDIR)$(PREFIX)/share/abbayev2/data
cp ./data/* $(DESTDIR)$(PREFIX)/share/abbayev2/data
mkdir -p $(DESTDIR)$(PREFIX)/share/pixmaps
cp abbaye.png $(DESTDIR)$(PREFIX)/share/pixmaps
mkdir -p $(DESTDIR)$(PREFIX)/share/abbayev2/graphics
cp -r ./graphics/* $(DESTDIR)$(PREFIX)/share/abbayev2/graphics
mkdir -p $(DESTDIR)$(PREFIX)/share/appdata
cp ./appdata/abbaye.appdata.xml $(DESTDIR)$(PREFIX)/share/appdata
uninstall:
rm $(DESTDIR)$(PREFIX)/bin/$(PROG)
rm $(DESTDIR)$(PREFIX)/share/applications/abbaye.desktop
rm $(DESTDIR)$(PREFIX)/share/pixmaps/abbaye.png
rm -rf $(DESTDIR)$(PREFIX)/share/abbayev2
rm $(DESTDIR)$(PREFIX)/share/appdata/abbaye.appdata.xml
# ignore if not empty
-rmdir $(DESTDIR)$(PREFIX)/bin
-rmdir $(DESTDIR)$(PREFIX)/share/applications
-rmdir $(DESTDIR)$(PREFIX)/share/pixmaps