aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 80adf039d884f0af5da7df4b9d4a4d6b4a70613d (plain) (blame)
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
.POSIX:

CONFIGFILE = config.mk
include $(CONFIGFILE)

BIN = getpgrp setpgrp
OBJ = $(@:=.o)
MAN = $(@:=.1)
HDR = arg.h


all: $(BIN)
$(OBJ): $(@:.o=.c) $(HDR)

getpgrp: getpgrp.o
	$(CC) -o $@ $@.o $(LDFLAGS)

setpgrp: setpgrp.o
	$(CC) -o $@ $@.o $(LDFLAGS)

.c.o:
	$(CC) -c -o $@ $< $(CFLAGS) $(CPPFLAGS)

install: $(BIN)
	mkdir -p -- "$(DESTDIR)$(PREFIX)/bin"
	mkdir -p -- "$(DESTDIR)$(MANPREFIX)/man1"
	cp -- $(BIN) "$(DESTDIR)$(PREFIX)/bin/"
	cp -- $(MAN) "$(DESTDIR)$(MANPREFIX)/man1/"

uninstall:
	-cd -- "$(DESTDIR)$(PREFIX)/bin/" && rm -f -- $(BIN)
	-cd -- "$(DESTDIR)$(MANPREFIX)/man1/" && rm -f -- $(MAN)

clean:
	-rm -rf -- $(BIN) *.o *.su

.SUFFIXES:
.SUFFIXES: .o .c

.PHONY: all install uninstall clean