]> mj.ucw.cz Git - libucw.git/commitdiff
fix building shared libraries on Darwin
authorRobert Spalek <robert@ucw.cz>
Sat, 29 Nov 2008 01:06:58 +0000 (17:06 -0800)
committerRobert Spalek <robert@ucw.cz>
Sat, 29 Nov 2008 01:06:58 +0000 (17:06 -0800)
this is a bit of a hack, but it shouldn't have any influence on Linux

build/Makebottom
build/Maketop

index 35229a6d31be75c178e54a2933b4eea629f101cb..36ee4585010aa347183c718e93208540d41457b9 100644 (file)
@@ -65,6 +65,13 @@ endif
        $(M)LD $@
        $(Q)$(CC) $(LSHARED) $(LDFLAGS) -o $@ $(shell PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" $(BUILDSYS)/lib-flags $^) $(LIBS)
        $(Q)$(call symlink-alias,$@,run/$(SO_RUNDIR),$(*F)$(SONAME_INFIX).so$(SONAME_SUFFIX))
+# On Darwin, gcc expects shared libraries in *.dylib instead of *.so.
+# Surprisingly, when a program is run, it suffices to have *.so files.
+# We don't want to mess up the whole build system with configurable
+# suffices and we also don't want to incur an overhead on Linux, so we
+# just create symbolic links on Darwin, if requested.
+%.dylib: %.so
+       cd $(dir $<) && ln -fs $(notdir $<) $(notdir $@)
 
 $(o)/%.pc: $(s)/%.pc $(o)/%.$(LS)
        $(M)PC $<
index 6a2103d99b6fab16aa2272ae61a3508e79d943b0..943cbe395fb376817db099198ca578ca0ccaf682 100644 (file)
@@ -26,21 +26,24 @@ API_LIBS=
 # Various files whose type does not fit into PROGS
 DATAFILES=
 
-ifdef CONFIG_SHARED
-LS=so
-OS=oo
-else
-LS=a
-OS=o
-endif
-
 ifdef CONFIG_DARWIN
+DYNAMIC_LIBRARIES=dylib
 SOEXT=bundle
 HOST_PREFIX=/sw
 else
+DYNAMIC_LIBRARIES=so
 SOEXT=so
 HOST_PREFIX=
 endif
+
+ifdef CONFIG_SHARED
+LS=$(DYNAMIC_LIBRARIES)
+OS=oo
+else
+LS=a
+OS=o
+endif
+
 SO_RUNDIR=lib
 
 # Whenever "make -s" (silent) is run, turn on verbose mode (paradoxical, but gives the right result)