Package: defendguin / 0.0.12-7

makefile Patch series | download
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
Description: use LDFLAGS and DESTDIR in Makefile
  Add DEB_CFLAGS to CFLAGS and use CPPFLAGS so that hardening flags are used.
  Use DESTDIR as PREFIX and fix BIN/DATA/MAN_PREFIX.
  Remove obsolete image before installing it.
Author: Christian T. Steigies <cts@debian.org>
Last-Update: 2018-11-22
Index: defendguin/Makefile
===================================================================
--- defendguin.orig/Makefile
+++ defendguin/Makefile
@@ -11,10 +11,10 @@
 
 CFLAGS=-Wall -O2
 #DATA_PREFIX=$(PWD)/data/
-PREFIX=/usr/local
-MAN_PREFIX=$(PREFIX)
-BIN_PREFIX=$(PREFIX)/bin
-DATA_PREFIX=$(PREFIX)/share/defendguin/
+PREFIX=$(DESTDIR)/usr
+MAN_PREFIX=$(PREFIX)/share/man/man6
+BIN_PREFIX=$(PREFIX)/games
+DATA_PREFIX=$(PREFIX)/share/games/defendguin/
 JOY=YES
 
 
@@ -24,8 +24,8 @@ SDL_CFLAGS := $(shell sdl-config --cflag
 SDL_LDFLAGS := $(shell sdl-config --libs) -L/usr/X11R6/lib
 MIXER=-lSDL_mixer
 NOSOUNDFLAG=__SOUND
-CFLAGS=-Wall $(SDL_CFLAGS) -DDATA_PREFIX=\"$(DATA_PREFIX)\" -D$(NOSOUNDFLAG) \
-	-DJOY_$(JOY)
+CFLAGS= $(DEB_CFLAGS) $(SDL_CFLAGS) \
+	-DDATA_PREFIX=\"$(DATA_PREFIX)\" -D$(NOSOUNDFLAG) -DJOY_$(JOY)
 SDL_LIB=$(SDL_LDFLAGS) $(MIXER)
 
 
@@ -38,18 +38,20 @@ nosound:
 
 install:	defendguin
 	install -d $(DATA_PREFIX)
+	-rm data/images/loader/loading-orig.bmp.gz
 	cp -R data/* $(DATA_PREFIX)
 	chmod -R a+rX,g-w,o-w $(DATA_PREFIX)
+	-mkdir -p $(BIN_PREFIX)
 	cp defendguin $(BIN_PREFIX)/
 	chmod a+rx,g-w,o-w $(BIN_PREFIX)/defendguin
-	-mkdir -p $(MAN_PREFIX)/man/man6/
-	cp src/defendguin.6 $(MAN_PREFIX)/man/man6/
-	chmod a+rx,g-w,o-w $(MAN_PREFIX)/man/man6/defendguin.6
+	-mkdir -p $(MAN_PREFIX)
+	cp src/defendguin.6 $(MAN_PREFIX)/
+	chmod a+rx,g-w,o-w $(MAN_PREFIX)/defendguin.6
 
 uninstall:
 	-rm -r $(DATA_PREFIX)
-	-rm $(PREFIX)/bin/defendguin
-	-rm $(PREFIX)/man/man6/defendguin.6
+	-rm $(BIN_PREFIX)/defendguin
+	-rm $(MAN_PREFIX)/defendguin.6
 
 clean:
 	-rm defendguin
@@ -59,11 +61,10 @@ clean:
 # Main executable:
 
 defendguin:	obj/defendguin.o
-	$(CC) $(CFLAGS) obj/defendguin.o -o defendguin $(SDL_LIB) -lm
+	$(CC) $(CFLAGS) $(CPPFLAGS) obj/defendguin.o -o defendguin $(SDL_LIB) -lm $(LDFLAGS)
 
 
 # Main object:
 
 obj/defendguin.o:	src/defendguin.c
-	$(CC) $(CFLAGS)	src/defendguin.c -c -o obj/defendguin.o
-
+	$(CC) $(CFLAGS)	$(CPPFLAGS) src/defendguin.c -c -o obj/defendguin.o