Skip to content

Commit 420ee9c

Browse files
author
B. Wilson
committed
make3: Initialize make3 as a copy of make2
Our starting point for make3 is make2. We anticipate that trialing make3 will necessitate it sitting parallel to make3, at least temporarily, and so have opted to copy make2 instead of munging it directly.
1 parent c42aa42 commit 420ee9c

14 files changed

+1673
-5
lines changed

jbuild.scm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@
195195
;;
196196
;; 1) Copy jsrc/jversion-x.h to jsrc/jversion.h and edit values;
197197
;; 2) Set jplatform and j64x environment variables;
198-
;; 3) Run make2/build_jconsole.sh and make2/build_libj.sh;
198+
;; 3) Run make3/build_jconsole.sh and make3/build_libj.sh;
199199
;;
200200
;; However, upstream expects users to run J directly from the source
201201
;; directory; they do not supply a make `install' target. Thus it takes
@@ -206,7 +206,7 @@
206206
;;
207207
;; 1) jsrc/jversion.h as in a typical build;
208208
;; 2) jlibrary/bin/profilex.ijs to point to writable directories;
209-
;; 3) make2/build_*.sh to respect standard build conventions;
209+
;; 3) make3/build_*.sh to respect standard build conventions;
210210
;; 4) jsrc/jconsole.c to fix libedit dlopen; and
211211
;; 5) Hard coded references to addons directory.
212212
(replace 'configure
@@ -228,7 +228,7 @@
228228
;; 1. Short-circuit the fragile compiler detection;
229229
;; 2. Make sure to include our CFLAGS and LFLAGS; and
230230
;; 3. Propagate script errors to top level.
231-
(with-directory-excursion "make2"
231+
(with-directory-excursion "make3"
232232
(for-each
233233
(lambda (file)
234234
(substitute* file
@@ -303,8 +303,8 @@
303303
(setenv "USE_THREAD" "1")
304304
(for-each (lambda (var-val) (apply setenv var-val))
305305
(quote ,extra-envars))
306-
;; The build scripts assume that PWD is make2.
307-
(with-directory-excursion "make2"
306+
;; The build scripts assume that PWD is make3.
307+
(with-directory-excursion "make3"
308308
(let* ((platform ,(if (target-arm?) "raspberry" "linux"))
309309
(target-bit ,(if (target-64bit?) "64" "32"))
310310
(run-script

make3/build_all.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/sh
2+
# build all binaries
3+
4+
realpath()
5+
{
6+
oldpath=`pwd`
7+
if ! cd $1 > /dev/null 2>&1; then
8+
cd ${1##*/} > /dev/null 2>&1
9+
echo $( pwd -P )/${1%/*}
10+
else
11+
pwd -P
12+
fi
13+
cd $oldpath > /dev/null 2>&1
14+
}
15+
16+
cd "$(realpath "$0")"
17+
echo "entering `pwd`"
18+
19+
./clean.sh
20+
21+
if [ "`uname`" != "Darwin" ] && ( [ "`uname -m`" = "armv6l" ] || [ "`uname -m`" = "aarch64" ] ); then
22+
jplatform="${jplatform:=raspberry}"
23+
elif [ "`uname`" = "Darwin" ]; then
24+
jplatform="${jplatform:=darwin}"
25+
else
26+
jplatform="${jplatform:=linux}"
27+
fi
28+
if [ "`uname -m`" = "x86_64" ]; then
29+
if [ -z "${jplatform##*linux*}" ]; then
30+
j64x="${j64x:=j64avx}"
31+
else
32+
j64x="${j64x:=j64}"
33+
fi
34+
elif [ "`uname -m`" = "aarch64" ]; then
35+
j64x="${j64x:=j64}"
36+
elif [ "`uname -m`" = "arm64" ] && [ -z "${jplatform##*darwin*}" ]; then
37+
j64x="${j64x:=j64arm}"
38+
else
39+
j64x="${j64x:=j32}"
40+
fi
41+
42+
jplatform=$jplatform j64x=$j64x ./build_jconsole.sh
43+
jplatform=$jplatform j64x=$j64x ./build_libj.sh
44+
jplatform=$jplatform j64x=$j64x ./build_tsdll.sh

make3/build_jconsole.sh

Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
#!/bin/sh
2+
3+
realpath()
4+
{
5+
oldpath=`pwd`
6+
if ! cd $1 > /dev/null 2>&1; then
7+
cd ${1##*/} > /dev/null 2>&1
8+
echo $( pwd -P )/${1%/*}
9+
else
10+
pwd -P
11+
fi
12+
cd $oldpath > /dev/null 2>&1
13+
}
14+
15+
cd "$(realpath "$0")"
16+
echo "entering `pwd`"
17+
18+
if [ "`uname`" != "Darwin" ] && ( [ "`uname -m`" = "armv6l" ] || [ "`uname -m`" = "aarch64" ] ); then
19+
jplatform="${jplatform:=raspberry}"
20+
elif [ "`uname`" = "Darwin" ]; then
21+
jplatform="${jplatform:=darwin}"
22+
else
23+
jplatform="${jplatform:=linux}"
24+
fi
25+
if [ "`uname -m`" = "x86_64" ]; then
26+
j64x="${j64x:=j64avx}"
27+
elif [ "`uname -m`" = "aarch64" ]; then
28+
j64x="${j64x:=j64}"
29+
elif [ "`uname -m`" = "arm64" ] && [ -z "${jplatform##*darwin*}" ]; then
30+
j64x="${j64x:=j64arm}"
31+
else
32+
j64x="${j64x:=j32}"
33+
fi
34+
USE_LINENOISE="${USE_LINENOISE:=1}"
35+
36+
# gcc 5 vs 4 - killing off linux asm routines (overflow detection)
37+
# new fast code uses builtins not available in gcc 4
38+
# use -DC_NOMULTINTRINSIC to continue to use more standard c in version 4
39+
# too early to move main linux release package to gcc 5
40+
41+
if [ -z "${jplatform##*darwin*}" ]; then
42+
if [ -z "${j64x##*j64arm*}" ]; then
43+
macmin="-arch arm64 -mmacosx-version-min=11"
44+
else
45+
macmin="-arch x86_64 -mmacosx-version-min=10.6"
46+
fi
47+
fi
48+
49+
if [ "x$CC" = x'' ] ; then
50+
if [ -f "/usr/bin/cc" ]; then
51+
CC=cc
52+
else
53+
if [ -f "/usr/bin/clang" ]; then
54+
CC=clang
55+
else
56+
CC=gcc
57+
fi
58+
fi
59+
export CC
60+
fi
61+
# compiler=`$CC --version | head -n 1`
62+
compiler=$(readlink -f $(command -v $CC) 2> /dev/null || echo $CC)
63+
echo "CC=$CC"
64+
echo "compiler=$compiler"
65+
66+
if [ -z "${compiler##*gcc*}" ] || [ -z "${CC##*gcc*}" ]; then
67+
# gcc
68+
common="$OPENMP -fPIC -O2 -fvisibility=hidden -fno-strict-aliasing \
69+
-Werror -Wextra -Wno-unknown-warning-option \
70+
-Wno-cast-function-type \
71+
-Wno-clobbered \
72+
-Wno-empty-body \
73+
-Wno-format-overflow \
74+
-Wno-implicit-fallthrough \
75+
-Wno-maybe-uninitialized \
76+
-Wno-missing-field-initializers \
77+
-Wno-parentheses \
78+
-Wno-pointer-sign \
79+
-Wno-shift-negative-value \
80+
-Wno-sign-compare \
81+
-Wno-type-limits \
82+
-Wno-uninitialized \
83+
-Wno-unused-parameter \
84+
-Wno-unused-value "
85+
86+
else
87+
# clang
88+
common="$OPENMP -fPIC -O2 -fvisibility=hidden -fno-strict-aliasing \
89+
-Werror -Wextra -Wno-unknown-warning-option \
90+
-Wsign-compare \
91+
-Wtautological-constant-out-of-range-compare \
92+
-Wuninitialized \
93+
-Wno-char-subscripts \
94+
-Wno-consumed \
95+
-Wno-delete-non-abstract-non-virtual-dtor \
96+
-Wno-empty-body \
97+
-Wno-implicit-float-conversion \
98+
-Wno-implicit-int-float-conversion \
99+
-Wno-int-in-bool-context \
100+
-Wno-missing-braces \
101+
-Wno-parentheses \
102+
-Wno-pass-failed \
103+
-Wno-pointer-sign \
104+
-Wno-string-plus-int \
105+
-Wno-unknown-pragmas \
106+
-Wno-unsequenced \
107+
-Wno-unused-function \
108+
-Wno-unused-parameter \
109+
-Wno-unused-value \
110+
-Wno-unused-variable "
111+
112+
fi
113+
114+
TARGET=jconsole
115+
116+
if [ -z "${j64x##*32*}" ]; then
117+
USE_EMU_AVX=0
118+
else
119+
USE_EMU_AVX="${USE_EMU_AVX:=1}"
120+
fi
121+
if [ $USE_EMU_AVX -eq 1 ] ; then
122+
common="$common -DEMU_AVX=1"
123+
fi
124+
125+
USE_PYXES="${USE_PYXES:=1}"
126+
if [ $USE_PYXES -eq 1 ] ; then
127+
common="$common -DPYXES=1"
128+
else
129+
common="$common -DPYXES=0"
130+
fi
131+
132+
if [ "$USE_LINENOISE" -ne "1" ] ; then
133+
common="$common -DREADLINE"
134+
else
135+
common="$common -DREADLINE -DUSE_LINENOISE"
136+
OBJSLN="linenoise.o"
137+
fi
138+
139+
case $jplatform\_$j64x in
140+
141+
linux_j32)
142+
CFLAGS="$common -m32 -msse2 -mfpmath=sse "
143+
LDFLAGS=" -m32 -ldl $LDTHREAD"
144+
;;
145+
linux_j64)
146+
CFLAGS="$common"
147+
LDFLAGS=" -ldl $LDTHREAD"
148+
;;
149+
linux_j64avx)
150+
CFLAGS="$common"
151+
LDFLAGS=" -ldl $LDTHREAD"
152+
;;
153+
linux_j64avx2)
154+
CFLAGS="$common"
155+
LDFLAGS=" -ldl $LDTHREAD"
156+
;;
157+
raspberry_j32)
158+
CFLAGS="$common -marm -march=armv6 -mfloat-abi=hard -mfpu=vfp -DRASPI"
159+
LDFLAGS=" -ldl $LDTHREAD"
160+
;;
161+
raspberry_j64)
162+
CFLAGS="$common -march=armv8-a+crc -DRASPI"
163+
LDFLAGS=" -ldl $LDTHREAD"
164+
;;
165+
darwin_j32)
166+
CFLAGS="$common -m32 -msse2 -mfpmath=sse $macmin"
167+
LDFLAGS=" -ldl $LDTHREAD -m32 $macmin "
168+
;;
169+
#-mmacosx-version-min=10.5
170+
darwin_j64)
171+
CFLAGS="$common $macmin"
172+
LDFLAGS=" -ldl $LDTHREAD $macmin "
173+
;;
174+
darwin_j64avx)
175+
CFLAGS="$common $macmin"
176+
LDFLAGS=" -ldl $LDTHREAD $macmin "
177+
;;
178+
darwin_j64avx2)
179+
CFLAGS="$common $macmin"
180+
LDFLAGS=" -ldl $LDTHREAD $macmin "
181+
;;
182+
darwin_j64arm) # darwin arm
183+
CFLAGS="$common $macmin -march=armv8-a+crc "
184+
LDFLAGS=" -ldl $LDTHREAD $macmin "
185+
;;
186+
windows_j32)
187+
TARGET=jconsole.exe
188+
CFLAGS="$common -m32 "
189+
LDFLAGS=" -m32 -Wl,--stack=0x1000000,--subsystem,console -static-libgcc $LDTHREAD"
190+
;;
191+
windows_j64)
192+
TARGET=jconsole.exe
193+
CFLAGS="$common"
194+
LDFLAGS=" -Wl,--stack=0x1000000,--subsystem,console -static-libgcc $LDTHREAD"
195+
;;
196+
windows_j64avx)
197+
TARGET=jconsole.exe
198+
CFLAGS="$common"
199+
LDFLAGS=" -Wl,--stack=0x1000000,--subsystem,console -static-libgcc $LDTHREAD"
200+
;;
201+
windows_j64avx2)
202+
TARGET=jconsole.exe
203+
CFLAGS="$common"
204+
LDFLAGS=" -Wl,--stack=0x1000000,--subsystem,console -static-libgcc $LDTHREAD"
205+
;;
206+
*)
207+
echo no case for those parameters
208+
exit
209+
esac
210+
211+
echo "CFLAGS=$CFLAGS"
212+
213+
if [ ! -f ../jsrc/jversion.h ] ; then
214+
cp ../jsrc/jversion-x.h ../jsrc/jversion.h
215+
fi
216+
217+
mkdir -p ../bin/$jplatform/$j64x
218+
mkdir -p obj/$jplatform/$j64x/
219+
cp makefile-jconsole obj/$jplatform/$j64x/.
220+
export CFLAGS LDFLAGS TARGET OBJSLN jplatform j64x
221+
cd obj/$jplatform/$j64x/
222+
make -f makefile-jconsole
223+
cd -

0 commit comments

Comments
 (0)