packvfs

view Makefile @ 2:dc23ab0545a6

- fleshed out some more fucntions with the code for the case where file/dir are real - added install/uninstall targets to the makefile - added pvfsh (packvfs shell) test program
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 04 Nov 2013 03:50:55 +0200
parents df5e9ee65a50
children
line source
1 PREFIX = /usr/local
2 dbg = -g
4 src = $(wildcard src/*.c)
5 obj = $(src:.c=.o)
6 dep = $(obj:.o=.d)
7 name = packvfs
9 somajor = 0
10 sominor = 1
12 lib_a = lib$(name).a
14 ifeq ($(shell uname -s), Darwin)
15 lib_so = lib$(name).dylib
16 shared = -dynamiclib
17 else
18 pic = -fPIC
19 devlink = lib$(name).so
20 soname = $(devlink).$(somajor)
21 lib_so = $(soname).$(sominor)
22 shared = -shared -Wl,-soname=$(soname)
23 endif
25 CFLAGS = -pedantic -Wall $(dbg) $(opt) $(pic)
27 .PHONY: all
28 all: $(lib_so) $(lib_a)
30 $(lib_so): $(obj)
31 $(CC) -o $@ $(shared) $(obj) $(LDFLAGS)
33 $(lib_a): $(obj)
34 $(AR) rcs $@ $(obj)
36 -include $(dep)
38 .PHONY: clean
39 clean:
40 rm -f $(obj) $(lib_a)
42 .PHONY: install
43 install: all
44 mkdir -p $(INSTDIR)$(PREFIX)/include $(INSTDIR)$(PREFIX)/lib
45 cp src/pvfs.h $(INSTDIR)$(PREFIX)/include/pvfs.h
46 cp $(lib_a) $(INSTDIR)$(PREFIX)/lib/$(lib_a)
47 cp $(lib_so) $(INSTDIR)$(PREFIX)/lib/$(lib_so)
48 [ -n "$(devlink)" ] && \
49 cd $(INSTDIR)$(PREFIX)/lib && \
50 rm -f $(soname) $(devlink) && \
51 ln -s $(lib_so) $(soname) && \
52 ln -s $(soname) $(devlink) || \
53 true
55 .PHONY: uninstall
56 uninstall:
57 rm -f $(INSTDIR)$(PREFIX)/include/pvfs.h
58 rm -f $(INSTDIR)$(PREFIX)/lib/$(lib_a)
59 rm -f $(INSTDIR)$(PREFIX)/lib/$(lib_so)
60 [ -n "$(devlink)" ] && \
61 rm -f $(INSTDIR)$(PREFIX)/lib/$(soname) && \
62 rm -f $(INSTDIR)$(PREFIX)/lib/$(devlink) || \
63 true