summaryrefslogtreecommitdiff
blob: d6677b9929b72230537de344747ebee6be3f307f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,12 @@
-CFLAGS?=-Wall -g
+CFLAGS ?= -Wall -g
+INCLUDES = $(shell ${PKG_CONFIG} --cflags x11)
+LIBS = $(shell ${PKG_CONFIG} --libs x11) -lm
+BIN_DIST = musca apis xlisten
 
-all:
-	$(CC) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lc -lm -lX11 -o musca musca.c
-	$(CC) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lc -lm -lX11 -o apis apis.c
-	$(CC) $(CFLAGS) -I/usr/X11R6/include -L/usr/X11R6/lib -lc -lm -lX11 -o xlisten xlisten.c
+all: $(BIN_DIST)
+
+$(BIN_DIST):
+	$(CC) $(CFLAGS) $(INCLUDES) $@.c -o $@ $(LDFLAGS) $(LIBS)
 
 clean:
-	rm -f musca apis
+	rm -f $(BIN_DIST)
+
+.PHONY: all clean