packvfs
annotate 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 |
rev | line source |
---|---|
nuclear@0 | 1 PREFIX = /usr/local |
nuclear@0 | 2 dbg = -g |
nuclear@0 | 3 |
nuclear@0 | 4 src = $(wildcard src/*.c) |
nuclear@0 | 5 obj = $(src:.c=.o) |
nuclear@0 | 6 dep = $(obj:.o=.d) |
nuclear@0 | 7 name = packvfs |
nuclear@0 | 8 |
nuclear@0 | 9 somajor = 0 |
nuclear@0 | 10 sominor = 1 |
nuclear@0 | 11 |
nuclear@0 | 12 lib_a = lib$(name).a |
nuclear@0 | 13 |
nuclear@0 | 14 ifeq ($(shell uname -s), Darwin) |
nuclear@0 | 15 lib_so = lib$(name).dylib |
nuclear@0 | 16 shared = -dynamiclib |
nuclear@0 | 17 else |
nuclear@0 | 18 pic = -fPIC |
nuclear@0 | 19 devlink = lib$(name).so |
nuclear@0 | 20 soname = $(devlink).$(somajor) |
nuclear@0 | 21 lib_so = $(soname).$(sominor) |
nuclear@0 | 22 shared = -shared -Wl,-soname=$(soname) |
nuclear@0 | 23 endif |
nuclear@0 | 24 |
nuclear@0 | 25 CFLAGS = -pedantic -Wall $(dbg) $(opt) $(pic) |
nuclear@0 | 26 |
nuclear@2 | 27 .PHONY: all |
nuclear@2 | 28 all: $(lib_so) $(lib_a) |
nuclear@2 | 29 |
nuclear@0 | 30 $(lib_so): $(obj) |
nuclear@0 | 31 $(CC) -o $@ $(shared) $(obj) $(LDFLAGS) |
nuclear@0 | 32 |
nuclear@0 | 33 $(lib_a): $(obj) |
nuclear@0 | 34 $(AR) rcs $@ $(obj) |
nuclear@0 | 35 |
nuclear@0 | 36 -include $(dep) |
nuclear@0 | 37 |
nuclear@0 | 38 .PHONY: clean |
nuclear@0 | 39 clean: |
nuclear@0 | 40 rm -f $(obj) $(lib_a) |
nuclear@2 | 41 |
nuclear@2 | 42 .PHONY: install |
nuclear@2 | 43 install: all |
nuclear@2 | 44 mkdir -p $(INSTDIR)$(PREFIX)/include $(INSTDIR)$(PREFIX)/lib |
nuclear@2 | 45 cp src/pvfs.h $(INSTDIR)$(PREFIX)/include/pvfs.h |
nuclear@2 | 46 cp $(lib_a) $(INSTDIR)$(PREFIX)/lib/$(lib_a) |
nuclear@2 | 47 cp $(lib_so) $(INSTDIR)$(PREFIX)/lib/$(lib_so) |
nuclear@2 | 48 [ -n "$(devlink)" ] && \ |
nuclear@2 | 49 cd $(INSTDIR)$(PREFIX)/lib && \ |
nuclear@2 | 50 rm -f $(soname) $(devlink) && \ |
nuclear@2 | 51 ln -s $(lib_so) $(soname) && \ |
nuclear@2 | 52 ln -s $(soname) $(devlink) || \ |
nuclear@2 | 53 true |
nuclear@2 | 54 |
nuclear@2 | 55 .PHONY: uninstall |
nuclear@2 | 56 uninstall: |
nuclear@2 | 57 rm -f $(INSTDIR)$(PREFIX)/include/pvfs.h |
nuclear@2 | 58 rm -f $(INSTDIR)$(PREFIX)/lib/$(lib_a) |
nuclear@2 | 59 rm -f $(INSTDIR)$(PREFIX)/lib/$(lib_so) |
nuclear@2 | 60 [ -n "$(devlink)" ] && \ |
nuclear@2 | 61 rm -f $(INSTDIR)$(PREFIX)/lib/$(soname) && \ |
nuclear@2 | 62 rm -f $(INSTDIR)$(PREFIX)/lib/$(devlink) || \ |
nuclear@2 | 63 true |