-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (40 loc) · 1.38 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
CC=cc
CFLAGS=-I. -Iinclude -std=gnu99
LDFLAGS=-L.
PREFIX=/usr/local
SONAME=0
all: cleanpath
config.h: config.h.in
rm -f config.h
sed 's/cmakedefine/define/;s/@HAVE_CONFSTR@/1/' config.h.in > config.h.tmp
mv config.h.tmp config.h
main.o: config.h
$(CC) -c $(CFLAGS) $(LDFLAGS) src/main.c
cleanpath.o: config.h
$(CC) -c $(CFLAGS) $(LDFLAGS) -fPIC lib/cleanpath.c
libcleanpath.so: cleanpath.o
$(CC) -o libcleanpath.so.$(SONAME) -fPIC -shared cleanpath.o
ln -s -f libcleanpath.so.$(SONAME) libcleanpath.so
libcleanpath.a: cleanpath.o
ar -crs libcleanpath.a cleanpath.o
cleanpath: main.o libcleanpath.a libcleanpath.so
$(CC) $(CFLAGS) $(LDFLAGS) -o cleanpath main.o libcleanpath.a
install: cleanpath
mkdir -p $(DESTDIR)$(PREFIX)/bin
mkdir -p $(DESTDIR)$(PREFIX)/include/cleanpath
mkdir -p $(DESTDIR)$(PREFIX)/lib
mkdir -p $(DESTDIR)$(PREFIX)/share/man1
mkdir -p $(DESTDIR)$(PREFIX)/share/man3
install -m 755 cleanpath $(DESTDIR)$(PREFIX)/bin
install -m 755 libcleanpath.so $(DESTDIR)$(PREFIX)/lib
install -m 755 libcleanpath.so.$(SONAME) $(DESTDIR)$(PREFIX)/lib
install -m 644 include/cleanpath/cleanpath.h $(DESTDIR)$(PREFIX)/include/cleanpath
install -m 644 docs/man/cleanpath.1 $(DESTDIR)$(PREFIX)/share/man1
install -m 644 docs/man/cleanpath_filter.3 $(DESTDIR)$(PREFIX)/share/man1
.PHONY:
clean:
rm -f cleanpath
rm -f *.o
rm -f config.h
rm -f libcleanpath.a
rm -f libcleanpath.so*