codegen: introduce cg-spill.inc
[ajla.git] / rebuild
blobbc7473a7ac5bcb75e5071c2a0068f90097644737
1 #!/bin/sh
3 # Copyright (C) 2024 Mikulas Patocka
5 # This file is part of Ajla.
7 # Ajla is free software: you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation, either version 3 of the License, or (at your option) any later
10 # version.
12 # Ajla is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along with
17 # Ajla. If not, see <https://www.gnu.org/licenses/>.
19 ./clean
20 set -e
21 #cp /usr/share/automake-1.1*/COPYING /usr/share/automake-1.1*/INSTALL /usr/share/automake-1.1*/depcomp /usr/share/automake-1.1*/install-sh /usr/share/automake-1.1*/missing .
23 cat <<EOF >version.h
25 * No-copyright
26 * A table of numbers, generated by a script, is supposedly not copyrightable.
29 EOF
30 sed -n 's/AC_INIT(ajla, \(.*\))/\#define AJLA_VERSION "\1"/p' <configure.ac >>version.h
32 FILES_INSTALL="`echo builtin.pcd terminfo stdlib/*.ajla stdlib/*/*.ajla stdlib/*/*/*.ajla charsets/*.c8`"
33 FILES_DIST="`echo newlib/*.ajla newlib/*/*.ajla newlib/*/*/*.ajla scripts/*.* scripts/*/*.* programs/test/*.ajla programs/acmd/*.ajla texts/tutorial.html texts/*.dia texts/*.svg`"
34 cat Makefile.t | sed "s=FILES_INSTALL=$FILES_INSTALL=g" | sed "s=FILES_DIST=$FILES_DIST=g" >Makefile.am
36 aclocal -I m4
37 autoheader
38 automake -ac
39 autoconf
40 ./fixup-configure
41 if [ -z "${CFLAGS+set}" ]; then
42 CFLAGS="-O2 -g -Wall -Wextra -Wmissing-prototypes -Wno-strict-aliasing -fdiagnostics-color=always"
43 # "-fdiagnostics-color=always"
44 # CFLAGS="$CFLAGS -std=c89"
45 if [ -n "$CF" ]; then
46 CFLAGS="$CFLAGS $CF"
48 if [ "`uname -s`" = NetBSD ]; then
49 CFLAGS="$CFLAGS -I/usr/pkg/include -L/usr/pkg/lib"
51 export CFLAGS
53 ARGS=""
54 ./configure "$ARGS" "$@"
55 if which gmake >/dev/null 2>/dev/null; then
56 MAK=gmake
57 else
58 MAK=make
60 if [ -z "$MAKEFLAGS" ]; then
61 N=`ls -1d /sys/devices/system/cpu/cpu[0-9]* 2>/dev/null|wc -l|sed 's/ //g'`
62 if test "$N" = 0 -o "$N" = ""; then
63 N="`grep -c ^processor /proc/cpuinfo 2>/dev/null || true`"
65 if test "$N" = 0 -o "$N" = ""; then
66 N="`sysctl hw.activecpu 2>/dev/null|sed 's/[^0-9]*//'`"
68 if test "$N" = 0 -o "$N" = ""; then
69 N="`sysctl hw.ncpu 2>/dev/null|sed 's/[^0-9]*//'`"
71 if test "$N" = 0 -o "$N" = ""; then
72 N="`sysinfo 2>/dev/null|grep ^CPU|wc -l|sed 's/[^0-9]*//'`"
74 if test "$N" = 0 -o "$N" = ""; then
75 if test "`uname -s`" = HP-UX; then
76 N=4
79 if test "$N" = 0 -o "$N" = ""; then
80 N=1
82 if test "$N" != 1; then
83 MAKEFLAGS="-j $N"
84 export MAKEFLAGS
87 "$MAK"