nuclear@0: PREFIX = /usr/local nuclear@0: dbg = -g nuclear@0: nuclear@0: src = $(wildcard src/*.c) nuclear@0: obj = $(src:.c=.o) nuclear@0: dep = $(obj:.o=.d) nuclear@0: name = packvfs nuclear@0: nuclear@0: somajor = 0 nuclear@0: sominor = 1 nuclear@0: nuclear@0: lib_a = lib$(name).a nuclear@0: nuclear@0: ifeq ($(shell uname -s), Darwin) nuclear@0: lib_so = lib$(name).dylib nuclear@0: shared = -dynamiclib nuclear@0: else nuclear@0: pic = -fPIC nuclear@0: devlink = lib$(name).so nuclear@0: soname = $(devlink).$(somajor) nuclear@0: lib_so = $(soname).$(sominor) nuclear@0: shared = -shared -Wl,-soname=$(soname) nuclear@0: endif nuclear@0: nuclear@0: CFLAGS = -pedantic -Wall $(dbg) $(opt) $(pic) nuclear@0: nuclear@2: .PHONY: all nuclear@2: all: $(lib_so) $(lib_a) nuclear@2: nuclear@0: $(lib_so): $(obj) nuclear@0: $(CC) -o $@ $(shared) $(obj) $(LDFLAGS) nuclear@0: nuclear@0: $(lib_a): $(obj) nuclear@0: $(AR) rcs $@ $(obj) nuclear@0: nuclear@0: -include $(dep) nuclear@0: nuclear@0: .PHONY: clean nuclear@0: clean: nuclear@0: rm -f $(obj) $(lib_a) nuclear@2: nuclear@2: .PHONY: install nuclear@2: install: all nuclear@2: mkdir -p $(INSTDIR)$(PREFIX)/include $(INSTDIR)$(PREFIX)/lib nuclear@2: cp src/pvfs.h $(INSTDIR)$(PREFIX)/include/pvfs.h nuclear@2: cp $(lib_a) $(INSTDIR)$(PREFIX)/lib/$(lib_a) nuclear@2: cp $(lib_so) $(INSTDIR)$(PREFIX)/lib/$(lib_so) nuclear@2: [ -n "$(devlink)" ] && \ nuclear@2: cd $(INSTDIR)$(PREFIX)/lib && \ nuclear@2: rm -f $(soname) $(devlink) && \ nuclear@2: ln -s $(lib_so) $(soname) && \ nuclear@2: ln -s $(soname) $(devlink) || \ nuclear@2: true nuclear@2: nuclear@2: .PHONY: uninstall nuclear@2: uninstall: nuclear@2: rm -f $(INSTDIR)$(PREFIX)/include/pvfs.h nuclear@2: rm -f $(INSTDIR)$(PREFIX)/lib/$(lib_a) nuclear@2: rm -f $(INSTDIR)$(PREFIX)/lib/$(lib_so) nuclear@2: [ -n "$(devlink)" ] && \ nuclear@2: rm -f $(INSTDIR)$(PREFIX)/lib/$(soname) && \ nuclear@2: rm -f $(INSTDIR)$(PREFIX)/lib/$(devlink) || \ nuclear@2: true