Browse code

Improve Makefile compatibility

make now runs cleanly on default BSD make. This uglies it up a little,
but it was so close it might as well be made as widely compatible as
possible.

John Hawthorn authored on 26/04/2016 05:10:34
Showing 1 changed files

  • Makefile index 43ba4da..5d0056c 100644
... ...
@@ -11,19 +11,22 @@ INSTALL=install
11 11
 INSTALL_PROGRAM=$(INSTALL)
12 12
 INSTALL_DATA=${INSTALL} -m 644
13 13
 
14
+OBJECTS=fzy.o match.o tty.o choices.o
15
+TESTOBJECTS=fzytest.o match.o choices.o
16
+
14 17
 all: fzy
15 18
 
16
-fzytest: fzytest.o match.o choices.o
17
-	$(CC) $(CFLAGS) $(CCFLAGS) -o $@ $^
19
+fzytest: $(TESTOBJECTS)
20
+	$(CC) $(CFLAGS) $(CCFLAGS) -o $@ $(TESTOBJECTS)
18 21
 
19 22
 test: check
20 23
 check: fzytest
21 24
 	$(DEBUGGER) ./fzytest
22 25
 
23
-fzy: fzy.o match.o tty.o choices.o
24
-	$(CC) $(CFLAGS) $(CCFLAGS) -o $@ $^
26
+fzy: $(OBJECTS)
27
+	$(CC) $(CFLAGS) $(CCFLAGS) -o $@ $(OBJECTS)
25 28
 
26
-%.o: %.c config.h
29
+.c.o: config.h
27 30
 	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
28 31
 
29 32
 config.h:
... ...
@@ -39,6 +42,6 @@ fmt:
39 42
 	clang-format -i *.c *.h
40 43
 
41 44
 clean:
42
-	$(RM) fzy fzytest *.o
45
+	rm -f fzy fzytest *.o
43 46
 
44 47
 .PHONY: test check all clean install fmt