Skip to content

Commit

Permalink
some Mac OS X love.
Browse files Browse the repository at this point in the history
  • Loading branch information
agentzh committed Jun 17, 2015
1 parent edc7c10 commit 55903b4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ src/cli.[ch]
*.output
*.so
*.a
*.dylib
sregex-cli
go
releng
Expand Down
39 changes: 20 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ INSTALL_ANAME= libsregex.a
INSTALL_SONAME= libsregex.so.$(MAJVER).$(MINVER).$(RELVER)
INSTALL_SOSHORT1= libsregex.so
INSTALL_SOSHORT2= libsregex.so.$(MAJVER)
INSTALL_DYLIBNAME= libsregex.$(MAJVER).$(MINVER).$(RELVER).dylib
INSTALL_DYLIBSHORT1= libsregex.dylib
INSTALL_DYLIBSHORT2= libsregex.$(MAJVER).dylib

ifeq (Darwin,$(shell uname -s))
INSTALL_SONAME= libsregex.$(MAJVER).$(MINVER).$(RELVER).dylib
INSTALL_SOSHORT1= libsregex.dylib
INSTALL_SOSHORT2= libsregex.$(MAJVER).dylib
endif

INSTALL_T= $(INSTALL_BIN)/$(FILE_T)

INSTALL_STATIC= $(INSTALL_LIB)/$(INSTALL_ANAME)
Expand All @@ -46,28 +50,25 @@ INSTALL_SHORT2= $(INSTALL_LIB)/$(INSTALL_SOSHORT2)

INSTALL_DIRS= $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_BIN)

ifeq (,$(findstring Windows,$(OS)))
ifeq (Darwin,$(shell uname -s))
INSTALL_SONAME= $(INSTALL_DYLIBNAME)
INSTALL_SHORT1= $(INSTALL_LIB)/$(INSTALL_DYLIBSHORT1)
INSTALL_SHORT2= $(INSTALL_LIB)/$(INSTALL_DYLIBSHORT2)
LDCONFIG= :
else
ifeq (SunOS,$(shell uname -s))
INSTALL_X=cp -p
INSTALL_F=cp -p
endif
TARGET_SONAME= libsregex.so.$(MAJVER)

ifeq (Darwin,$(shell uname -s))
TARGET_SONAME= libsregex.$(MAJVER).dylib
LDCONFIG= :
else
ifeq (SunOS,$(shell uname -s))
INSTALL_X=cp -p
INSTALL_F=cp -p
endif
endif

TARGET_SONAME= libsregex.so.$(MAJVER)
TARGET_DYLIBNAME= libsregex.$(MAJVER).dylib
TARGET_DYLIBPATH= $(or $(PREFIX),/usr/local)/lib/$(TARGET_DYLIBNAME)
TARGET_DYLIBPATH= $(PREFIX)/lib/$(TARGET_SONAME)
TARGET_XSHLDFLAGS= -shared -fpic -Wl,-soname,$(TARGET_SONAME)
TARGET_AR=ar rcus
HOST_SYS:= $(shell uname -s)

ifeq (Darwin,$(HOST_SYS))
FILE_SO= libsregex.dylib
TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fpic
TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER)
endif
Expand Down Expand Up @@ -145,7 +146,7 @@ $(FILE_A): $(lib_o_files)
$(Q)$(DASM) $(DASM_FLAGS) -o $@ $<

clean:
$(HOST_RM) src/*.o $(lib_o_files) core $(TARGET) \
$(HOST_RM) *.dylib *.so *.so.* src/*.o $(lib_o_files) core $(TARGET) \
src/sregex/*.output \
$(FILE_T) $(FILE_SO) $(FILE_A)

Expand Down Expand Up @@ -182,7 +183,7 @@ install: all
uninstall:
@echo "==== Uninstalling sregex $(VERSION) to $(PREFIX) ===="
$(UNINSTALL) $(INSTALL_T)
$(UNINSTALL) $(INSTALL_LIB)/libsregex.so
$(UNINSTALL) $(INSTALL_LIB)/$(FILE_SO)
$(UNINSTALL) $(INSTALL_LIB)/libsregex.a
$(UNINSTALL) $(INSTALL_SHORT1)
$(UNINSTALL) $(INSTALL_SHORT2)
Expand Down

0 comments on commit 55903b4

Please sign in to comment.