Skip to content

Commit

Permalink
add version to .so build
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed May 14, 2013
1 parent 4f61925 commit 871d238
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions posix.mak
Expand Up @@ -149,10 +149,17 @@ endif
# Set DDOC, the documentation generator
DDOC=$(DMD)

# Set VERSION, where the file is that contains the version string
VERSION=../dmd/VERSION

# Set SONAME, the name of the shared library.
# The awk script will produce the last 2 digits of the version string, i.e. 2.063 produces 63
SONAME = libphobos2.so.0.$(shell awk -F. '{ print $$NF + 0 }' $(VERSION))

# Set LIB, the ultimate target
ifeq (,$(findstring win,$(OS)))
LIB = $(ROOT)/libphobos2.a
LIBSO = $(ROOT)/libphobos2so.so
LIBSO = $(ROOT)/$(SONAME).0
else
LIB = $(ROOT)/phobos.lib
endif
Expand Down Expand Up @@ -261,10 +268,16 @@ $(ROOT)/%$(DOTOBJ) : %.c
$(LIB) : $(OBJS) $(ALL_D_FILES) $(DRUNTIME)
$(DMD) $(DFLAGS) -lib -of$@ $(DRUNTIME) $(D_FILES) $(OBJS)

dll : $(LIBSO)
dll : $(ROOT)/libphobos2.so

$(ROOT)/libphobos2.so: $(ROOT)/$(SONAME)
ln -s $(notdir $(LIBSO)) $@

$(ROOT)/$(SONAME): $(LIBSO)
ln -s $(notdir $(LIBSO)) $@

$(LIBSO): $(OBJS) $(ALL_D_FILES) $(DRUNTIME)
$(DMD) $(DFLAGS) -shared -debuglib= -defaultlib= -of$@ $(DRUNTIMESO) $(D_FILES) $(OBJS)
$(DMD) $(DFLAGS) -shared -debuglib= -defaultlib= -of$@ -L-soname=$(SONAME) $(DRUNTIMESO) $(D_FILES) $(OBJS)

ifeq (osx,$(OS))
# Build fat library that combines the 32 bit and the 64 bit libraries
Expand Down

0 comments on commit 871d238

Please sign in to comment.