nuclear@0: src = $(wildcard src/*.c) nuclear@0: obj = $(src:.c=.o) nuclear@7: dep = $(obj:.o=.d) nuclear@0: lib_a = libpsys.a nuclear@10: hdr = $(wildcard src/*.h) nuclear@7: nuclear@7: ifeq ($(shell uname -s), Darwin) nuclear@12: lib_so = libpsys.dylib nuclear@7: shared = -dynamiclib nuclear@12: libgl = -framework OpenGL nuclear@7: else nuclear@7: somajor = 0 nuclear@7: sominor = 1 nuclear@7: soname = libpsys.so.$(somajor) nuclear@7: lib_so = $(soname).$(sominor) nuclear@10: devlink = libpsys.so nuclear@7: shared = -shared -Wl,-soname,$(soname) nuclear@12: libgl = -lGL nuclear@7: endif nuclear@7: nuclear@0: nuclear@0: CC = gcc nuclear@7: AR = ar nuclear@9: CFLAGS = -std=c89 -pedantic -Wall $(dbg) $(opt) -fPIC -Isrc nuclear@12: LDFLAGS = -lanim -limago -lvmath $(libgl) nuclear@0: nuclear@0: .PHONY: all nuclear@0: all: $(lib_a) $(lib_so) nuclear@0: nuclear@0: $(lib_a): $(obj) nuclear@7: $(AR) rcs $@ $(obj) nuclear@0: nuclear@0: $(lib_so): $(obj) nuclear@7: $(CC) $(shared) -o $@ $(obj) $(LDFLAGS) nuclear@7: nuclear@7: -include $(dep) nuclear@7: nuclear@7: %.d: %.c nuclear@7: @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@ nuclear@7: nuclear@0: nuclear@0: .PHONY: install nuclear@0: install: $(lib_a) $(lib_so) nuclear@10: mkdir -p $(DESTDIR)$(PREFIX)/include/psys nuclear@10: cp $(hdr) $(DESTDIR)$(PREFIX)/include/psys/ nuclear@10: cp $(lib_a) $(DESTDIR)$(PREFIX)/lib/$(lib_a) nuclear@10: cp $(lib_so) $(DESTDIR)$(PREFIX)/lib/$(lib_so) nuclear@10: [ -n "$(soname)" ] \ nuclear@10: && cd $(DESTDIR)$(PREFIX)/lib \ nuclear@10: && rm -f $(soname) $(devlink) \ nuclear@10: && ln -s $(lib_so) $(soname) \ nuclear@10: && ln -s $(soname) $(devlink) \ nuclear@10: || true nuclear@0: nuclear@0: .PHONY: uninstall nuclear@0: uninstall: nuclear@12: rm -f $(DESTDIR)$(PREFIX)/include/psys/*.h nuclear@12: rmdir $(DESTDIR)$(PREFIX)/include/psys nuclear@12: rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_a) nuclear@12: rm -f $(DESTDIR)$(PREFIX)/lib/$(lib_so) nuclear@12: [ -n "$(soname)" ] \ nuclear@12: && cd $(DESTDIR)$(PREFIX)/lib \ nuclear@12: && rm -f $(soname) $(devlink) \ nuclear@12: || true nuclear@0: nuclear@0: .PHONY: clean nuclear@0: clean: nuclear@7: rm -f $(obj) $(lib_so) $(lib_a)