aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-02-19 00:55:26 +0100
committerMattias Andrée <maandree@kth.se>2021-02-19 00:55:26 +0100
commitbdc40e90514f4aad41a593b8b3e262e30b46dbd5 (patch)
tree88cea5b211ff5624f4a7b71db4534a7a2bb45f0d /Makefile
parentFix arg.h (diff)
downloadorphan-reaper-bdc40e90514f4aad41a593b8b3e262e30b46dbd5.tar.gz
orphan-reaper-bdc40e90514f4aad41a593b8b3e262e30b46dbd5.tar.bz2
orphan-reaper-bdc40e90514f4aad41a593b8b3e262e30b46dbd5.tar.xz
Fix makefile and test2.3.2
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile31
1 files changed, 22 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 50b1276..8e8681f 100644
--- a/Makefile
+++ b/Makefile
@@ -6,25 +6,40 @@ include $(CONFIGFILE)
DEFS = -D'LIBEXECDIR="$(LIBEXECDIR)"'
-all: orphan-reaper reapd orphan-reaper.test reapd.test
-
-.o:
- $(CC) -o $@ $^ $(LDFLAGS)
+all: orphan-reaper reapd orphan-reaper.test reapd.test test
orphan-reaper.o: orphan-reaper.c arg.h
$(CC) -c -o $@ orphan-reaper.c $(CFLAGS) $(CPPFLAGS) $(DEFS)
+orphan-reaper: orphan-reaper.o
+ $(CC) -o $@ orphan-reaper.o $(LDFLAGS)
+
orphan-reaper.test.o: orphan-reaper.c arg.h
$(CC) -c -o $@ orphan-reaper.c $(CFLAGS) $(CPPFLAGS) -DTEST
+orphan-reaper.test: orphan-reaper.test.o
+ $(CC) -o $@ orphan-reaper.test.o $(LDFLAGS)
+
reapd.o: reapd.c
$(CC) -c -o $@ reapd.c $(CFLAGS) $(CPPFLAGS) $(DEFS)
+reapd: reapd.o
+ $(CC) -o $@ reapd.o $(LDFLAGS)
+
reapd.test.o: reapd.c
$(CC) -c -o $@ reapd.c $(CFLAGS) $(CPPFLAGS) -DTEST
-check: orphan-reaper.test reapd.test
- test $$(./orphan-reaper.test sh -c 'true & true & true &' | wc -l) = 4
+reapd.test: reapd.test.o
+ $(CC) -o $@ reapd.test.o $(LDFLAGS)
+
+test.o: test.c
+ $(CC) -c -o $@ test.c $(CFLAGS) $(CPPFLAGS)
+
+test: test.o
+ $(CC) -o $@ test.o $(LDFLAGS)
+
+check: orphan-reaper.test reapd.test test
+ test $$(./orphan-reaper.test ./test | wc -l) = 4
install: orphan-reaper reapd
mkdir -p -- "$(DESTDIR)$(PREFIX)/bin"
@@ -44,8 +59,6 @@ uninstall:
-rm -f -- "$(DESTDIR)$(MANPREFIX)/man1/orphan-reaper.1"
clean:
- -rm -rf -- *.o orphan-reaper reapd orphan-reaper.test reapd.test
-
-SUFFIXES: .o
+ -rm -rf -- *.o orphan-reaper reapd orphan-reaper.test reapd.test test
.PHONY: all check install uninstall clean