forked from haampie/libtree
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
37 lines (27 loc) · 774 Bytes
/
Makefile
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
ifeq (exists, $(shell [ -e $(CURDIR)/Make.user ] && echo exists ))
include $(CURDIR)/Make.user
endif
CFLAGS ?= -O2
LIBTREE_CFLAGS := -std=c99 -Wall -Wextra -Wshadow -pedantic
LIBTREE_DEFINES := -D_FILE_OFFSET_BITS=64
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
SHAREDIR ?= $(PREFIX)/share
.PHONY: all check install clean
all: libtree
%.o: %.c
$(CC) $(CFLAGS) $(LIBTREE_CFLAGS) $(LIBTREE_DEFINES) -c $?
libtree: libtree.o
$(CC) $(LDFLAGS) $^ -o $@
check:: libtree
install: all
mkdir -p $(DESTDIR)$(BINDIR)
cp -p libtree $(DESTDIR)$(BINDIR)
mkdir -p $(DESTDIR)$(SHAREDIR)/man/man1
cp -p doc/libtree.1 $(DESTDIR)$(SHAREDIR)/man/man1
clean::
rm -f *.o libtree
clean check::
for dir in $(sort $(wildcard tests/*)); do \
$(MAKE) -C $$dir $@ || break ;\
done