aboutsummaryrefslogtreecommitdiffstats
path: root/x11-wm/antiwm/files/patch-Makefile
blob: 2f267008cea2689e8725cd91e3f2414c650738ba (plain) (blame)
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
--- ./Makefile.orig 2008-08-01 02:59:17.000000000 +0200
+++ ./Makefile  2011-06-24 15:12:36.000000000 +0200
@@ -1,22 +1,36 @@
 # install directory
-INSTALL_DIR=/usr/local/bin
+PREFIX?= /usr/local/
 
 # enable debug messages 
 DEBUG = -DDEBUG
 
-CC = gcc
-LIBS = -lX11
-LDFLAGS = -L/usr/lib
-CFLAGS = -O2 -Wall -I/usr/X11R6/include 
+# compiler and linker
+CC?= gcc
+
+# paths
+X11INC = $(LOCALBASE)/include
+X11LIB = $(LOCALBASE)/lib
+
+# includes and libs
+INCS = -I. -I/usr/include -I${X11INC}
+LIBS = -L/usr/lib -lc -L${X11LIB} -lX11
+
+# flags
+LDFLAGS+= ${LIBS}
+CFLAGS+= ${INCS}
 
 SRC = main.o events.o manage.o list.o bar.o
 HEADERS = bar.h conf.h data.h events.h list.h manage.h antiwm.h
 
+all: antiwm
+
 antiwm: $(SRC)
-   gcc $(SRC) -o $@ $(CFLAGS) $(LDFLAGS) $(LIBS) 
+   $(CC) $(SRC) -o $@ $(CFLAGS) $(LDFLAGS)
 
-install: antiwm
-   cp antiwm $(INSTALL_DIR)
+install: all
+   @mkdir -p ${DESTDIR}${PREFIX}/bin
+   @cp -f antiwm ${PREFIX}/bin
+   @chmod 755 ${DESTDIR}${PREFIX}/bin/antiwm
 
 %.o : %.c $(HEADERS)
    $(CC) -c $(CFLAGS) $(DEBUG) $< -o $@