Merge pull request #37 from JuliaLang/soname

Build fixes
This commit is contained in:
Viral B. Shah 2014-01-07 20:22:27 -08:00
commit 9bd6ebcc55
2 changed files with 11 additions and 9 deletions

View file

@ -4,8 +4,9 @@ OS := $(shell uname)
VERSION = 0.1.0 VERSION = 0.1.0
VERSION_SPLIT = $(subst ., , $(VERSION)) VERSION_SPLIT = $(subst ., , $(VERSION))
DESTDIR = DESTDIR =
PREFIX = /usr/local prefix = /usr/local
libdir = $(PREFIX)/lib libdir = $(prefix)/lib
includedir = $(prefix)/include
FC = gfortran FC = gfortran
FFLAGS += -O3 FFLAGS += -O3
@ -69,28 +70,29 @@ override OS=WINNT
endif endif
#keep these if statements these separate #keep these if statements these separate
ifeq ($(OS), WINNT) ifeq ($(OS), WINNT)
SHLIB_EXT = dll
SONAME_FLAG = -soname
CFLAGS_add+=-nodefaultlibs CFLAGS_add+=-nodefaultlibs
FFLAGS+=-nodefaultlibs FFLAGS+=-nodefaultlibs
endif endif
ifeq ($(OS), Linux) ifeq ($(OS), Linux)
SHLIB_EXT = so SHLIB_EXT = so
SONAME_FLAG = -soname
CFLAGS_add+=-fPIC CFLAGS_add+=-fPIC
FFLAGS+=-fPIC FFLAGS+=-fPIC
endif endif
ifeq ($(OS), FreeBSD) ifeq ($(OS), FreeBSD)
SHLIB_EXT = so SHLIB_EXT = so
SONAME_FLAG = -soname
CFLAGS_add+=-fPIC CFLAGS_add+=-fPIC
FFLAGS+=-fPIC FFLAGS+=-fPIC
endif endif
ifeq ($(OS), Darwin) ifeq ($(OS), Darwin)
SHLIB_EXT = dylib SHLIB_EXT = dylib
SONAME_FLAG = -install_name
CFLAGS_add+=-fPIC CFLAGS_add+=-fPIC
FFLAGS+=-fPIC FFLAGS+=-fPIC
endif endif
ifeq ($(OS), WINNT)
SHLIB_EXT = dll
endif

View file

@ -26,7 +26,7 @@ all: libopenlibm.a libopenlibm.$(SHLIB_EXT)
libopenlibm.a: $(OBJS) libopenlibm.a: $(OBJS)
$(AR) -rcs libopenlibm.a $(OBJS) $(AR) -rcs libopenlibm.a $(OBJS)
libopenlibm.$(SHLIB_EXT): $(OBJS) libopenlibm.$(SHLIB_EXT): $(OBJS)
$(FC) -shared $(OBJS) $(LDFLAGS) -o libopenlibm.$(SHLIB_EXT).$(VERSION) $(FC) -shared $(OBJS) $(LDFLAGS) -Wl,$(SONAME_FLAG),libopenlibm.$(SHLIB_EXT).$(VERSION) -o libopenlibm.$(SHLIB_EXT).$(VERSION)
ln -s libopenlibm.$(SHLIB_EXT).$(VERSION) libopenlibm.$(SHLIB_EXT).$(word 1,$(VERSION_SPLIT)).$(word 2,$(VERSION_SPLIT)) ln -s libopenlibm.$(SHLIB_EXT).$(VERSION) libopenlibm.$(SHLIB_EXT).$(word 1,$(VERSION_SPLIT)).$(word 2,$(VERSION_SPLIT))
ln -s libopenlibm.$(SHLIB_EXT).$(VERSION) libopenlibm.$(SHLIB_EXT).$(word 1,$(VERSION_SPLIT)) ln -s libopenlibm.$(SHLIB_EXT).$(VERSION) libopenlibm.$(SHLIB_EXT).$(word 1,$(VERSION_SPLIT))
ln -s libopenlibm.$(SHLIB_EXT).$(VERSION) libopenlibm.$(SHLIB_EXT) ln -s libopenlibm.$(SHLIB_EXT).$(VERSION) libopenlibm.$(SHLIB_EXT)
@ -43,6 +43,6 @@ distclean:
install: all install: all
mkdir -p $(DESTDIR)$(libdir) mkdir -p $(DESTDIR)$(libdir)
mkdir -p $(DESTDIR)$(PREFIX)/include mkdir -p $(DESTDIR)$(includedir)
cp -a libopenlibm.$(SHLIB_EXT)* libopenlibm.a $(DESTDIR)$(libdir)/ cp -a libopenlibm.$(SHLIB_EXT)* libopenlibm.a $(DESTDIR)$(libdir)/
cp -a src/openlibm.h $(DESTDIR)$(PREFIX)/include/ cp -a src/openlibm.h $(DESTDIR)$(includedir)/