diff options
| author | Mike Wey | 2011-01-30 20:47:45 +0100 |
|---|---|---|
| committer | Mike Wey | 2011-01-30 20:47:45 +0100 |
| commit | e220eacb23dc5460ca72f90a366d4b3ac57147b7 (patch) | |
| tree | e5a8cfd7e9599a31b72febd94107451a0def69ff /GNUmakefile | |
| parent | 8f8144c50993c4043d5b08ab9881e017e392d064 (diff) | |
Add makefile
Diffstat (limited to 'GNUmakefile')
| -rw-r--r-- | GNUmakefile | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 0000000..b48f5f4 --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,75 @@ +#makeAll.sh +SHELL=/bin/sh +prefix=/usr/local + +OS=$(shell uname || uname -s) +ARCH=$(shell arch || uname -m) + +all: lib + +ifndef DC + ifneq ($(strip $(shell which dmd 2>/dev/null)),) + DC=dmd + else ifneq ($(strip $(shell which ldc 2>/dev/null)),) + DC=ldc + else + DC=gdc + endif +endif + +ifeq ("$(DC)","dmd") + DCFLAGS=-O + output=-of$@ +else ifeq ("$(DC)","ldc") + DCFLAGS=-O + output=-of$@ +else + DCFLAGS=-O2 + output=-o $@ +endif + +ifeq ("$(OS)","Darwin") + LDFLAGS+=-Wl,-undefined,dynamic_lookup +else ifeq ("$(OS)","Linux") + LDFLAGS+=-L-ldl +endif + +AR=ar +RANLIB=ranlib + +####################################################################### + +LIBNAME_DMAGICK = libdmagick.a +SOURCES_DMAGICK = $(shell find \ + dmagick \ + -name '*.d' ) +OBJECTS_DMAGICK = $(shell echo $(SOURCES_DMAGICK) | sed -e 's/\.d/\.o/g') + +####################################################################### + +lib: $(LIBNAME_DMAGICK) + +$(LIBNAME_DMAGICK): IMPORTS=-Idmagick +$(LIBNAME_DMAGICK): $(OBJECTS_DMAGICK) + $(AR) rcs $@ $^ + $(RANLIB) $@ + +####################################################################### + +%.o : %.d + $(DC) $(DCFLAGS) $(IMPORTS) -c $< $(output) + +####################################################################### + +install: lib + install -d $(DESTDIR)$(prefix)/include/d + (echo $(SOURCES_DMAGICK) | xargs tar c) | (cd $(DESTDIR)$(prefix)/include/d; tar xv) + install -d $(DESTDIR)$(prefix)/lib + install -m 644 $(LIBNAME_DMAGICK) $(DESTDIR)$(prefix)/lib + +uninstall: + rm -rf $(DESTDIR)$(prefix)/include/d/dmagick + rm -f $(DESTDIR)$(prefix)/lib/$(LIBNAME_DMAGICK) + +clean: + -rm -f $(LIBNAME_DMAGICK) $(OBJECTS_DMAGICK) |
