aboutsummaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2022-02-19 22:44:12 +0100
committerMattias Andrée <maandree@kth.se>2022-02-19 22:44:12 +0100
commit2b6d446becdb7059074ec7aa9f83fcfd3f9fa1db (patch)
tree1c76e330a5a16b1bd6df6356877dbb8d63390f20 /base
parentnew-c-proj: Add -compatibility_version and -current_version of libs on MacOS (diff)
downloaddotfiles-2b6d446becdb7059074ec7aa9f83fcfd3f9fa1db.tar.gz
dotfiles-2b6d446becdb7059074ec7aa9f83fcfd3f9fa1db.tar.bz2
dotfiles-2b6d446becdb7059074ec7aa9f83fcfd3f9fa1db.tar.xz
Improve new-c-proj
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'base')
-rwxr-xr-xbase/new-c-proj10
1 files changed, 9 insertions, 1 deletions
diff --git a/base/new-c-proj b/base/new-c-proj
index 982144f..48f8d83 100755
--- a/base/new-c-proj
+++ b/base/new-c-proj
@@ -106,6 +106,7 @@ if printf '%s\n' "$1" | grep '^lib' >/dev/null 2>/dev/null; then
$1.a: \$(OBJ)
x @rm -f -- \$@
x \$(AR) rc \$@ \$(OBJ)
+ x \$(AR) ts \$@ > /dev/null
$1.\$(LIBEXT): \$(LOBJ)
x \$(CC) \$(LIBFLAGS) -o \$@ \$(LOBJ) \$(LDFLAGS)
@@ -115,6 +116,7 @@ if printf '%s\n' "$1" | grep '^lib' >/dev/null 2>/dev/null; then
x mkdir -p -- "\$(DESTDIR)\$(PREFIX)/include"
x cp -- $1.a "\$(DESTDIR)\$(PREFIX)/lib/"
x cp -- $1.\$(LIBEXT) "\$(DESTDIR)\$(PREFIX)/lib/$1.\$(LIBMINOREXT)"
+ x \$(FIX_INSTALL_NAME) "\$(DESTDIR)\$(PREFIX)/lib/$1.\$(LIBMINOREXT)"
x ln -sf -- $1.\$(LIBMINOREXT) "\$(DESTDIR)\$(PREFIX)/lib/$1.\$(LIBMAJOREXT)"
x ln -sf -- $1.\$(LIBMAJOREXT) "\$(DESTDIR)\$(PREFIX)/lib/$1.\$(LIBEXT)"
x cp -- $1.h "\$(DESTDIR)\$(PREFIX)/include/"
@@ -141,6 +143,8 @@ if printf '%s\n' "$1" | grep '^lib' >/dev/null 2>/dev/null; then
LIBFLAGS = -shared -Wl,-soname,lib\$(LIB_NAME).\$(LIBEXT).\$(LIB_MAJOR)
LIBMAJOREXT = \$(LIBEXT).\$(LIB_MAJOR)
LIBMINOREXT = \$(LIBEXT).\$(LIB_VERSION)
+
+ FIX_INSTALL_NAME = :
EOF
cat <<-EOF | sed 's/x\t/\t/g' > mk/macos.mk
@@ -148,13 +152,17 @@ if printf '%s\n' "$1" | grep '^lib' >/dev/null 2>/dev/null; then
LIBFLAGS = -dynamiclib -Wl,-compatibility_version,\$(LIB_MAJOR) -Wl,-current_version,\$(LIB_VERSION)
LIBMAJOREXT = \$(LIB_MAJOR).\$(LIBEXT)
LIBMINOREXT = \$(LIB_VERSION).\$(LIBEXT)
+
+ FIX_INSTALL_NAME = install_name_tool -id "\$(PREFIX)/lib/$1.\$(LIBMAJOREXT)"
EOF
cat <<-EOF | sed 's/x\t/\t/g' > mk/windows.mk
LIBEXT = dll
- LIBFLAGS = -mdll
+ LIBFLAGS = -shared
LIBMAJOREXT = \$(LIB_MAJOR).\$(LIBEXT)
LIBMINOREXT = \$(LIB_VERSION).\$(LIBEXT)
+
+ FIX_INSTALL_NAME = :
EOF
else
printf '%s\n' "/$1" >> .gitignore