1.POSIX:
2.PHONY: all install clean
3
4PREFIX=/usr/local
5BINDIR=$(PREFIX)/bin
6MANDIR=$(PREFIX)/share/man
7ALL_CFLAGS=$(CFLAGS) -std=c99 -Wall -Wextra -Wno-unused-parameter
8OBJ=\
9	build.o\
10	deps.o\
11	env.o\
12	graph.o\
13	htab.o\
14	log.o\
15	parse.o\
16	samu.o\
17	scan.o\
18	tool.o\
19	tree.o\
20	util.o
21HDR=\
22	arg.h\
23	build.h\
24	deps.h\
25	env.h\
26	graph.h\
27	htab.h\
28	log.h\
29	parse.h\
30	scan.h\
31	tool.h\
32	tree.h\
33	util.h
34
35all: samu
36
37.c.o:
38	$(CC) $(ALL_CFLAGS) -c -o $@ $<
39
40samu: $(OBJ)
41	$(CC) $(LDFLAGS) -o $@ $(OBJ)
42
43$(OBJ): $(HDR)
44
45install: samu samu.1
46	mkdir -p $(DESTDIR)$(BINDIR)
47	cp samu $(DESTDIR)$(BINDIR)/
48	mkdir -p $(DESTDIR)$(MANDIR)/man1
49	cp samu.1 $(DESTDIR)$(MANDIR)/man1/
50
51clean:
52	rm -f samu $(OBJ)
53