Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

OS X support to build JSONSL #3

Merged
merged 1 commit into from

2 participants

@yarrouye

Hey I made some changes to the Makefile to support OS X, if you're interested please pull from my fork.

@mnunberg mnunberg merged commit 8b8aced into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 16, 2013
  1. @yarrouye
This page is out of date. Refresh to see the latest.
Showing with 28 additions and 4 deletions.
  1. +28 −4 Makefile
View
32 Makefile
@@ -1,16 +1,37 @@
+prefix = /opt/local
+exec_prefix= ${prefix}
+libdir = $(exec_prefix)/lib
+
+INSTALL = /usr/bin/install -c
+
+INSTALL_PROGRAM = $(INSTALL)
+
+ifeq ($(patsubst gcc%,gcc,$(notdir $(basename $(CC)))),gcc)
+GCCFLAGS=-ggdb3
+endif
+
LIBJSONSL_DIR+=$(shell pwd)
LDFLAGS+=-L$(LIBJSONSL_DIR) -Wl,-rpath $(LIBJSONSL_DIR)
CFLAGS+=\
-Wall -std=gnu89 -pedantic \
- -O3 -ggdb3 \
+ -O3 $(GCCFLAGS) \
-I$(LIBJSONSL_DIR) -DJSONSL_STATE_GENERIC \
export CFLAGS
export LDFLAGS
+DYLIBPREFIX=lib
+ifeq ($(shell uname -s),Darwin)
+DYLIBSUFFIX=.dylib
+DYLIBFLAGS=-fPIC -fno-common -dynamiclib -Wl,-install_name,$(libdir)/$(LIB_FQNAME)
+else
+DYLIBSUFFIX=.so
+DYLIBFLAGS=-shared -fPIC
+endif
+
LIB_BASENAME=jsonsl
-LIB_PREFIX?=lib
-LIB_SUFFIX?=.so
+LIB_PREFIX?=$(DYLIBPREFIX)
+LIB_SUFFIX?=$(DYLIBSUFFIX)
LIB_FQNAME = $(LIB_PREFIX)$(LIB_BASENAME)$(LIB_SUFFIX)
ifdef STATIC_LIB
@@ -18,11 +39,14 @@ ifdef STATIC_LIB
LIBFLAGS=-c
else
LDFLAGS+=-l$(LIB_BASENAME)
- LIBFLAGS=-shared -fPIC
+ LIBFLAGS=$(DYLIBFLAGS)
endif
all: $(LIB_FQNAME)
+install: all
+ $(INSTALL) $(LIB_FQNAME) $(DESTDIR)$(libdir)
+
.PHONY: examples
examples:
$(MAKE) -C $@
Something went wrong with that request. Please try again.