summaryrefslogtreecommitdiff
path: root/mit-pthreads/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'mit-pthreads/scripts')
-rwxr-xr-xmit-pthreads/scripts/GNUmakefile.inc24
-rw-r--r--mit-pthreads/scripts/Makefile.inc30
-rwxr-xr-xmit-pthreads/scripts/pgcc.sh32
3 files changed, 86 insertions, 0 deletions
diff --git a/mit-pthreads/scripts/GNUmakefile.inc b/mit-pthreads/scripts/GNUmakefile.inc
new file mode 100755
index 00000000000..6309f28ca55
--- /dev/null
+++ b/mit-pthreads/scripts/GNUmakefile.inc
@@ -0,0 +1,24 @@
+VPATH := $(VPATH):${srcdir}/scripts
+SCRIPTS= pgcc pg++
+
+abspath := $(shell pwd)
+
+all-bin: $(SCRIPTS)
+
+pgcc: pgcc.sh
+ sed -e 's!EXEC_PREFIX!$(exec_prefix)!g' \
+ -e 's!BUILD_PREFIX!$(abspath)!g' \
+ -e 's!SRC_PREFIX!$(srcdir)!g' \
+ -e 's!COMPILER!gcc!g' \
+ < $(srcdir)/scripts/pgcc.sh > pgcc.new
+ chmod a+x pgcc.new
+ mv -f pgcc.new pgcc
+
+pg++: pgcc.sh
+ sed -e 's!EXEC_PREFIX!$(exec_prefix)!g' \
+ -e 's!BUILD_PREFIX!$(abspath)!g' \
+ -e 's!SRC_PREFIX!$(srcdir)!g' \
+ -e 's!COMPILER!g++!g' \
+ < $(srcdir)/scripts/pgcc.sh > pg++.new
+ chmod a+x pg++.new
+ mv -f pg++.new pg++
diff --git a/mit-pthreads/scripts/Makefile.inc b/mit-pthreads/scripts/Makefile.inc
new file mode 100644
index 00000000000..441f6b51d29
--- /dev/null
+++ b/mit-pthreads/scripts/Makefile.inc
@@ -0,0 +1,30 @@
+.PATH : ${srcdir}/scripts
+SCRIPTS= pgcc pg++
+
+abspath != pwd
+
+all-bin: $(SCRIPTS)
+
+#
+# Objects go in the obj directory for both BSD and GNU make but these
+# scripts get put in the obj dir for BSD and the root dir for GNU.
+#
+pgcc: pgcc.sh
+ sed -e 's!EXEC_PREFIX!$(exec_prefix)!g' \
+ -e 's!BUILD_PREFIX!$(.CURDIR)!g' \
+ -e 's!SRC_PREFIX!$(srcdir)!g' \
+ -e 's!COMPILER!gcc!g' \
+ < $(srcdir)/scripts/pgcc.sh > pgcc.new
+ chmod a+x pgcc.new
+ mv -f pgcc.new pgcc
+ ln -fs obj/pgcc ../pgcc
+
+pg++: pgcc.sh
+ sed -e 's!EXEC_PREFIX!$(exec_prefix)!g' \
+ -e 's!BUILD_PREFIX!$(.CURDIR)!g' \
+ -e 's!SRC_PREFIX!$(srcdir)!g' \
+ -e 's!COMPILER!g++!g' \
+ < $(srcdir)/scripts/pgcc.sh > pg++.new
+ chmod a+x pg++.new
+ mv -f pg++.new pg++
+ ln -fs obj/pg++ ../pg++
diff --git a/mit-pthreads/scripts/pgcc.sh b/mit-pthreads/scripts/pgcc.sh
new file mode 100755
index 00000000000..6bd6cbeccdb
--- /dev/null
+++ b/mit-pthreads/scripts/pgcc.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+pthreads_root=EXEC_PREFIX
+build_root=BUILD_PREFIX
+src_root=SRC_PREFIX
+
+include_dir='-I$pthreads_root/include'
+lib_dir='-L$pthreads_root/lib'
+libs='-lpthread -lm -lgcc -lpthread'
+
+# Might be a good idea to also provide a way to override pthreads_root
+# so that we can use this script in the build tree, before installation.
+if arg="$1" ; then
+ case $arg in
+ -notinstalled)
+ include_dir='-I$build_root/include -I$src_root/include'
+ lib_dir='-L$build_root/obj'
+ shift
+ ;;
+ esac
+fi
+
+for arg in "$@" ; do
+ case $arg in
+ -nostdinc) include_dir= ;;
+ -nostdlib | -c) libs= ;;
+ esac
+done
+
+# Include the -L option in any case, just in case the user provided the
+# names of some libraries we've built threaded versions of.
+eval exec COMPILER '"$@"' $include_dir $lib_dir $libs