summaryrefslogtreecommitdiff
blob: 0cd1ca00b44ce99b28ebd07ba3b02e1c2958f78e (plain)
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
--- a/Makefile
+++ b/Makefile
@@ -4,23 +4,23 @@ DESTDIR		?=	/
 
 TARGET		=	xbattbar
 APM_CHECK	=	xbattbar-check-apm
-CPPFLAGS	=	-D_FORTIFY_SOURCE=2
-CFLAGS		=	-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security $(CPPFLAGS)
-LDFLAGS		=	-Wl,-z,relro
+CPPFLAGS	?=	-D_FORTIFY_SOURCE=2
+CFLAGS		?=	-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security
+LDFLAGS		?=	-Wl,-z,relro
 
 all: $(TARGET) $(APM_CHECK)
 
 $(TARGET): obj/xbattbar.o
-	gcc -o $@ $< -lX11 $(LDFLAGS)
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $< $(shell $(PKG_CONFIG) --libs x11)
 
 obj/xbattbar.o: xbattbar.c obj/stamp
-	gcc -MMD -o $@ -c $< $(CFLAGS)
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -MMD -o $@ -c $<
 
 $(APM_CHECK): obj/xbattbar-check-apm.o
-	gcc -o $@ $< $(LDFLAGS)
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ $<
 
 obj/xbattbar-check-apm.o: xbattbar-check-apm.c obj/stamp
-	gcc -MMD -D$(OS_TYPE) -o $@ -c $< $(CFLAGS)
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -MMD -D$(OS_TYPE) -o $@ -c $<
 
 obj/stamp:
 	mkdir obj
@@ -32,12 +32,12 @@ clean:
 
 
 install: $(TARGET) $(APM_CHECK)
-	install -d -m 0755 $(DESTDIR)/usr/lib/$(PROJECT)
+	install -d -m 0755 $(DESTDIR)/usr/$(LIBDIR)/$(PROJECT)
 	install -d -m 0755 $(DESTDIR)/usr/bin
 	install -d -m 0755 $(DESTDIR)/usr/share/man/man1
-	install -m 0755 $(APM_CHECK) $(DESTDIR)/usr/lib/$(PROJECT)/
-	install -m 0755 xbattbar-check-acpi $(DESTDIR)/usr/lib/$(PROJECT)/
-	install -m 0755 xbattbar-check-sys  $(DESTDIR)/usr/lib/$(PROJECT)/
+	install -m 0755 $(APM_CHECK) $(DESTDIR)/usr/$(LIBDIR)/$(PROJECT)/
+	install -m 0755 xbattbar-check-acpi $(DESTDIR)/usr/$(LIBDIR)/$(PROJECT)/
+	install -m 0755 xbattbar-check-sys  $(DESTDIR)/usr/$(LIBDIR)/$(PROJECT)/
 	install -m 0755 $(TARGET) $(DESTDIR)/usr/bin/
 	install -m 0644 xbattbar.man $(DESTDIR)/usr/share/man/man1/$(PROJECT).1