summaryrefslogtreecommitdiff
blob: 619aaecf7a89bee93d4c54d03bfb59b8cde95490 (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
Respect LDFLAGS, CFLAGS, CC  #334715
Fix install paths

--- a/Makefile
+++ b/Makefile
@@ -1,33 +1,29 @@
 # Makefile for spectromatic
 
-CFLAGS = -O2 -Wall 
-LIBS = -lgsl -lgslcblas -lpng -lm
+LIBS = -lpng `pkg-config --libs gsl`
 DESTDIR =
-TOPLEVEL_HOME = /usr
+TOPLEVEL_HOME ?= /usr
 
-CC = gcc -I.
-
 SRC = spectromatic.c wave.c
 
 OBJ = $(SRC:.c=.o)
 
 TARGET = spectromatic
 
-install:	all
-	mkdir -p $(DESTDIR)$(TOPLEVEL_HOME)/bin
-	mkdir -p $(DESTDIR)$(TOPLEVEL_HOME)/man/man1
-	install -o root -g root -m 0755 spectromatic $(DESTDIR)$(TOPLEVEL_HOME)/bin
-	install -o root -g root -m 0644 man/spectromatic.1 $(DESTDIR)$(TOPLEVEL_HOME)/man/man1
-
 all:	$(OBJ)
-	$(CC) -o $(TARGET) $(OBJ) $(LIBS)
-	strip $(TARGET)
+	$(CC) $(LDFLAGS) $(OBJ) $(LIBS) -o $(TARGET)
+
+install: $(TARGET)
+	mkdir -p $(DESTDIR)$(TOPLEVEL_HOME)/bin
+	mkdir -p $(DESTDIR)$(TOPLEVEL_HOME)/share/man/man1
+	install -m 0755 spectromatic $(DESTDIR)$(TOPLEVEL_HOME)/bin
+	install -m 0644 man/spectromatic.1 $(DESTDIR)$(TOPLEVEL_HOME)/share/man/man1
 
 clean:
 	$(RM) $(TARGET) $(OBJ)
 
 .c.o:
-	$(CC) $(CFLAGS) -c $< 
+	$(CC) $(CFLAGS) -I. -c $< 
 
 .o:
 	$(CC) $< $(LIBS) -o $@