Commit 4283228c authored by Moritz Lipp's avatar Moritz Lipp

Set correct linker flags under Darwin

parent 4b2afe8d
......@@ -35,6 +35,12 @@ ifeq (,$(findstring -DLOCALEDIR,${CPPFLAGS}))
CPPFLAGS += -DLOCALEDIR=\"${LOCALEDIR}\"
endif
UNAME := $(shell uname -s)
ifeq ($(UNAME), Darwin)
SONAME_FLAG = -install_name
SHARED_FLAG = -dynamiclib
endif
all: ${PROJECT} po ${PROJECT}.pc
# pkg-config based version checks
......@@ -91,7 +97,7 @@ lib${PROJECT}.a: ${OBJECTS}
lib${PROJECT}.so.${SOVERSION}: ${OBJECTS}
$(call colorecho,LD,$@)
$(QUIET)${CC} -Wl,-soname,lib${PROJECT}.so.${SOMAJOR} -shared ${LDFLAGS} -o $@ ${OBJECTS} ${LIBS}
$(QUIET)${CC} -Wl,${SONAME_FLAG},lib${PROJECT}.so.${SOMAJOR} ${SHARED_FLAG} ${LDFLAGS} -o $@ ${OBJECTS} ${LIBS}
clean:
$(QUIET)rm -rf \
......@@ -127,7 +133,7 @@ lib${PROJECT}-debug.a: ${DOBJECTS}
lib${PROJECT}-debug.so.${SOVERSION}: ${DOBJECTS}
$(call colorecho,LD,$@)
$(QUIET)${CC} -Wl,-soname,lib${PROJECT}.so.${SOMAJOR} -shared ${LDFLAGS} -o $@ ${DOBJECTS} ${LIBS}
$(QUIET)${CC} -Wl,${SONAME_FLAG},lib${PROJECT}.so.${SOMAJOR} ${SHARED_FLAG} ${LDFLAGS} -o $@ ${DOBJECTS} ${LIBS}
debug: options ${PROJECT}-debug
......
......@@ -66,6 +66,10 @@ CC ?= gcc
# strip
SFLAGS ?= -s
# soname
SONAME_FLAG ?= -soname
SHARED_FLAG ?= -shared
# set to something != 0 if you want verbose build output
VERBOSE ?= 0
......
/* See LICENSE file for license and copyright information */
#define _DEFAULT_SOURCE
#if !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__NetBSD__)
#if !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__APPLE__)
#define _XOPEN_SOURCE 700
#endif
#define _FILE_OFFSET_BITS 64
......@@ -244,7 +244,7 @@ girara_file_open(const char* path, const char* mode)
/*return fp;*/
}
#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__APPLE__)
char*
girara_file_read_line(FILE* file)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment