changeset 632:ed19b429a152

- added explicit arm64 target, and clang tool options to Windows' configure.bat - configure.{bat,rc} now writing Makefile.config, for consistency/compatibility (e.g. configure.bat can now be used to set up env flags for a non-nmake toolchain) - simplified/decluttered Windows and Plan9 configure scripts (removal of unused/stale options, ...) - removed stale test/makepkg.sh helper
author Tassilo Philipp
date Sat, 19 Nov 2022 15:45:41 +0100
parents e5ad8cf0aa72
children 316c9d6f94a9
files ChangeLog README buildsys/mk/prolog.mk buildsys/nmake/prolog.nmake buildsys/nmake/tool_clang.nmake buildsys/nmake/tool_gcc.nmake buildsys/scripts/conf-nds.bat configure.bat configure.rc doc/manual/manual_build.tex mkfile test/hacking-arm-thumb-interwork/diff-gcc-defs/Makefile test/makepkg.sh
diffstat 13 files changed, 190 insertions(+), 228 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Nov 09 14:46:38 2022 +0100
+++ b/ChangeLog	Sat Nov 19 15:45:41 2022 +0100
@@ -44,6 +44,10 @@
 buildsys:
   o ./configure output for sun make builds: set correct C++ compiler flag var
   o ./configure for SunOS now uses isainfo(1) to deduce native instruction set
+  o added explicit arm64 target, and clang tool options to Windows' configure.bat
+  o configure.{bat,rc} now writing Makefile.config, for consistency/compatibility (e.g. configure.bat
+    can now be used to set up env flags for a non-nmake toolchain)
+  o simplified/decluttered Windows and Plan9 configure scripts (removal of unused/stale options, ...)
 doc:
   o callconv section additions about aggregate-by-value passing for all platforms
   o new Linux-Std-Base-specific PPC32/SysV section, as aggregate retval handling differs from
--- a/README	Wed Nov 09 14:46:38 2022 +0100
+++ b/README	Sat Nov 19 15:45:41 2022 +0100
@@ -20,10 +20,9 @@
 (foreign function interface) for scripting languages to connect with 
 the C/C++ world.
 
-The binary footprint of the package is approx. 10-20 kb, depending on
-the platform.
-Besides the test suite already mentioned, comprehensive documentation is
-available.
+The binary footprint of the package libraries before linking is approx. 10-60
+kb, depending on the platform.
+Comprehensive documentation is available.
 
 
 Building the libraries
@@ -31,7 +30,7 @@
 
 Prequisites: 
  - C compiler such as gcc, clang, sunpro or msvc.
- - Assembler such as gas (gnu/apple), fbe or masm.
+ - Assembler such as gas (gnu/apple), llvm as, fbe, nasm or masm.
  - Build system such as 'shell/make', cmake, nmake (windows) or mk (plan9).
 
 
@@ -78,8 +77,8 @@
 $ make run-tests
 
 
-Build 'out-of-source'
----------------------
+Build 'out-of-source' (not for nmake or mk based builds)
+--------------------------------------------------------
 
 $ cd <build_dir>
 $ <src_dir>/configure --prefix=<install_dir>
--- a/buildsys/mk/prolog.mk	Wed Nov 09 14:46:38 2022 +0100
+++ b/buildsys/mk/prolog.mk	Sat Nov 19 15:45:41 2022 +0100
@@ -1,7 +1,7 @@
 #//////////////////////////////////////////////////////////////////////////////
 #
-# Copyright (c) 2010 Daniel Adler <dadler@uni-goettingen.de>, 
-#                    Tassilo Philipp <tphilipp@potion-studios.com>
+# Copyright (c) 2010      Daniel Adler <dadler@uni-goettingen.de>, 
+#               2010,2022 Tassilo Philipp <tphilipp@potion-studios.com>
 #
 # Permission to use, copy, modify, and distribute this software for any
 # purpose with or without fee is hereby granted, provided that the above
@@ -24,12 +24,5 @@
 </$objtype/mkfile
 
 # Include config rules.
-<$TOP/ConfigVars
+<$TOP/Makefile.config
 
-BUILD_HOST   = $CONFIG_HOST
-BUILD_OS     = $CONFIG_OS
-BUILD_ARCH   = $CONFIG_ARCH
-BUILD_TOOL   = $CONFIG_TOOL
-BUILD_ASM    = $CONFIG_ASM
-BUILD_CONFIG = $CONFIG_CONFIG
-
--- a/buildsys/nmake/prolog.nmake	Wed Nov 09 14:46:38 2022 +0100
+++ b/buildsys/nmake/prolog.nmake	Sat Nov 19 15:45:41 2022 +0100
@@ -1,7 +1,7 @@
 #//////////////////////////////////////////////////////////////////////////////
 #
-# Copyright (c) 2007,2009 Daniel Adler <dadler@uni-goettingen.de>, 
-#                         Tassilo Philipp <tphilipp@potion-studios.com>
+# Copyright (c) 2007,2009      Daniel Adler <dadler@uni-goettingen.de>, 
+#               2007,2009,2022 Tassilo Philipp <tphilipp@potion-studios.com>
 #
 # Permission to use, copy, modify, and distribute this software for any
 # purpose with or without fee is hereby granted, provided that the above
@@ -33,8 +33,8 @@
 
 # Check if library has been 'configured' properly. If not, tell the user and abort.
 !IF !DEFINED(CONFIG_OS) || !DEFINED(CONFIG_ARCH)
-configure: $(TOP)\ConfigVars
-$(TOP)\ConfigVars:
+configure: $(TOP)\Makefile.config
+$(TOP)\Makefile.config:
 	echo "Library not configured properly! Run configure.bat from the library's root directory first!"
 !ELSE
 configure:
@@ -42,14 +42,10 @@
 
 
 # Include config rules.
-!IF EXISTS($(TOP)\ConfigVars)
-!  INCLUDE $(TOP)\ConfigVars
+!IF EXISTS($(TOP)\Makefile.config)
+!  INCLUDE $(TOP)\Makefile.config
 !ENDIF
 
-# Include site rules.
-!IF EXISTS($(TOP)\SiteVars)
-!  INCLUDE $(TOP)\SiteVars
-!ENDIF
 
 # set BUILD_* from CONFIG_* variables
 !IF !DEFINED(BUILD_HOST)
@@ -67,9 +63,6 @@
 !IF !DEFINED(BUILD_ASM)
 BUILD_ASM = $(CONFIG_ASM)
 !ENDIF
-!IF !DEFINED(BUILD_CONFIG)
-BUILD_CONFIG = $(CONFIG_CONFIG)
-!ENDIF
 
 !IF "$(BUILD_TOOL)" != ""
 !  INCLUDE tool_$(BUILD_TOOL).nmake
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/buildsys/nmake/tool_clang.nmake	Sat Nov 19 15:45:41 2022 +0100
@@ -0,0 +1,57 @@
+#//////////////////////////////////////////////////////////////////////////////
+#
+# Copyright (c) 2022 Tassilo Philipp <tphilipp@potion-studios.com>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+#//////////////////////////////////////////////////////////////////////////////
+
+#///////////////////////////////////////////////////
+#
+#	clang nmake rules
+#	tool_clang.nmake
+#
+#///////////////////////////////////////////////////
+
+
+CC  =clang
+CXX =clang++
+AR  =ar
+AS  =as
+LD  =clang++#ld
+OCP =objcopy
+
+
+.SUFFIXES:
+.SUFFIXES: .o .so .a .pdf .c .cpp .S .tex .cc
+
+
+.S.o:
+	echo .S.o: Assembling $< ...
+	$(CC) $(ASFLAGS) $(CFLAGS) -o $@ -c $<
+
+.c.o:
+	echo .c.o: Compiling $< ...
+	$(CC) $(CFLAGS) -o $@ -c $<
+
+.cpp.o:
+	echo .cpp.o: Compiling $< ...
+	$(CXX) $(CXXFLAGS) -o $@ -c $<
+
+.cc.o:
+	echo .cc.o: Compiling $< ...
+	$(CXX) $(CXXFLAGS) -o $@ -c $<
+
+.tex.pdf:
+	pdflatex $<
+
--- a/buildsys/nmake/tool_gcc.nmake	Wed Nov 09 14:46:38 2022 +0100
+++ b/buildsys/nmake/tool_gcc.nmake	Sat Nov 19 15:45:41 2022 +0100
@@ -1,6 +1,6 @@
 #//////////////////////////////////////////////////////////////////////////////
 #
-# Copyright (c) 2007,2009 Daniel Adler <dadler@uni-goettingen.de>, 
+# Copyright (c) 2007-2022 Daniel Adler <dadler@uni-goettingen.de>,
 #                         Tassilo Philipp <tphilipp@potion-studios.com>
 #
 # Permission to use, copy, modify, and distribute this software for any
@@ -25,6 +25,16 @@
 #///////////////////////////////////////////////////
 
 
+CC  =gcc
+CXX =g++
+AR  =ar
+AS  =as
+LD  =g++#ld
+OCP =objcopy
+
+
+!IF "$(BUILD_OS)" == "nds"
+
 CC  =arm-eabi-gcc
 CXX =arm-eabi-g++
 AR  =arm-eabi-ar
@@ -34,27 +44,26 @@
 
 !IF "$(BUILD_ARCH)" == "arm32_thumb"
 
-ASFLAGS  = -g -mthumb -mthumb-interwork
-CFLAGS   = -g -Wall -O2 -I$(TOP)\dyncall -I$(TOP)\dyncallback -fomit-frame-pointer -ffast-math -fno-strict-aliasing -mthumb -mthumb-interwork
+ASFLAGS  = -mthumb -mthumb-interwork
+CFLAGS   = -Wall -O2 -I$(TOP)\dyncall -I$(TOP)\dyncallback -fomit-frame-pointer -ffast-math -fno-strict-aliasing -mthumb -mthumb-interwork
 CXXFLAGS = $(CFLAGS) -fno-rtti -fno-exceptions
-LDFLAGS  = -g -mno-fpu -mthumb -mthumb-interwork
+LDFLAGS  = -mno-fpu -mthumb -mthumb-interwork
 ARFLAGS  =
 
 !ELSE IF "$(BUILD_ARCH)" == "arm32_arm"
 
-ASFLAGS  = -g
-CFLAGS   = -g -Wall -O2 -I$(TOP)\dyncall -I$(TOP)\dyncallback -fomit-frame-pointer -ffast-math -fno-strict-aliasing
+ASFLAGS  = 
+CFLAGS   = -Wall -O2 -I$(TOP)\dyncall -I$(TOP)\dyncallback -fomit-frame-pointer -ffast-math -fno-strict-aliasing
 CXXFLAGS = $(CFLAGS) -fno-rtti -fno-exceptions
-LDFLAGS  = -g -mno-fpu
+LDFLAGS  = -mno-fpu
 ARFLAGS  =
 
 !ENDIF
 
-
-!IF "$(BUILD_OS)" == "nds"
 CFLAGS   = $(CFLAGS) -DARM9 -mcpu=arm9tdmi -mtune=arm9tdmi -D__nds__ -I"$(DEVKITPRO_PATH)/libnds/include"
 CXXFLAGS = $(CXXFLAGS) -D__nds__ -I"$(DEVKITPRO_PATH)/libnds/include"
 LDFLAGS  = $(LDFLAGS) -specs=ds_arm9.specs
+
 !ENDIF
 
 
@@ -80,3 +89,4 @@
 
 .tex.pdf:
 	pdflatex $<
+
--- a/buildsys/scripts/conf-nds.bat	Wed Nov 09 14:46:38 2022 +0100
+++ b/buildsys/scripts/conf-nds.bat	Sat Nov 19 15:45:41 2022 +0100
@@ -1,7 +1,7 @@
 @ECHO OFF
 REM ///////////////////////////////////////////////////////////////////////////
 REM
-REM Copyright (c) 2007-2009 Daniel Adler <dadler@uni-goettingen.de>, 
+REM Copyright (c) 2007-2022 Daniel Adler <dadler@uni-goettingen.de>,
 REM                         Tassilo Philipp <tphilipp@potion-studios.com>
 REM
 REM Permission to use, copy, modify, and distribute this software for any
@@ -25,9 +25,9 @@
 
 REM Extract devkitPro path.
 IF [%DEVKITPRO:~0,1%]==[/] (
-	ECHO DEVKITPRO_PATH=%DEVKITPRO:~1,1%:%DEVKITPRO:~2%#>>ConfigVars
+	ECHO DEVKITPRO_PATH=%DEVKITPRO:~1,1%:%DEVKITPRO:~2%#>>Makefile.config
 ) ELSE IF [%DEVKITPRO:~1,1%]==[:] (
-	ECHO DEVKITPRO_PATH=%DEVKITPRO%#>>ConfigVars
+	ECHO DEVKITPRO_PATH=%DEVKITPRO%#>>Makefile.config
 ) ELSE (
 	GOTO END_ABORT
 )
@@ -36,6 +36,6 @@
 
 :END_ABORT
 ECHO ERROR: Environment variable DEVKITPRO must be set to absolute devkitPro path.
-DEL ConfigVars
+DEL Makefile.config
 
 :END
--- a/configure.bat	Wed Nov 09 14:46:38 2022 +0100
+++ b/configure.bat	Sat Nov 19 15:45:41 2022 +0100
@@ -1,7 +1,7 @@
 @ECHO OFF
 REM ///////////////////////////////////////////////////////////////////////////
 REM
-REM Copyright (c) 2007-2009 Daniel Adler <dadler@uni-goettingen.de>, 
+REM Copyright (c) 2007-2022 Daniel Adler <dadler@uni-goettingen.de>,
 REM                         Tassilo Philipp <tphilipp@potion-studios.com>
 REM
 REM Permission to use, copy, modify, and distribute this software for any
@@ -27,11 +27,12 @@
 SET CONFIG_OS=windows
 SET CONFIG_TOOL=msvc
 SET CONFIG_ASM=ml
-SET CONFIG_CONFIG=release
 IF [%PROCESSOR_ARCHITECTURE%] == [AMD64] (
 	SET CONFIG_ARCH=x64
 ) ELSE IF [%PROCESSOR_ARCHITEW6432%] == [AMD64] (
 	SET CONFIG_ARCH=x64
+) ELSE IF [%PROCESSOR_ARCHITECTURE%] == [ARM64] (
+	SET CONFIG_ARCH=arm64
 ) ELSE (
 	SET CONFIG_ARCH=x86
 )
@@ -52,36 +53,27 @@
 	ECHO.Options:
 	ECHO.  /?                print this page
 	ECHO.
-	ECHO.  /prefix PATH      set installation prefix ^(GNU make only^)
-	ECHO.  /prefix-bd PATH   set build directory prefix ^(GNU make only^)
-	ECHO.                    ^(only for use with gmake^)
-	ECHO.
 	ECHO.  /target-x86       build for x86 architecture
 	ECHO.  /target-x64       build for x64 architecture
-	ECHO.  /target-psp       build for PlayStation Portable ^(homebrew SDK^)
-	ECHO.  /target-nds-arm   build for Nintendo DS ^(devkitPro, ARM mode^)
-	ECHO.  /target-nds-thumb build for Nintendo DS ^(devkitPro, THUMB mode^)
+	ECHO.  /target-arm64     build for arm64 architecture
+	ECHO.  /target-psp       cross-build for PlayStation Portable ^(homebrew SDK^)
+	ECHO.  /target-nds-arm   cross-build for Nintendo DS ^(devkitPro, ARM mode^)
+	ECHO.  /target-nds-thumb cross-build for Nintendo DS ^(devkitPro, THUMB mode^)
 	ECHO.
 	ECHO.  /tool-msvc        use Microsoft Visual C++ compiler ^(default^)
 	ECHO.  /tool-gcc         use GNU Compiler Collection
+	ECHO.  /tool-clang       use LLVM clang compiler
 	ECHO.
 	ECHO.  /asm-ml           use Microsoft Macro Assembler ^(default^)
-	ECHO.  /asm-as           use the GNU Assembler
+	ECHO.  /asm-as           use the GNU or LLVM Assembler
 	ECHO.  /asm-nasm         use NASM Assembler
-	ECHO.
-	ECHO.  /config-release   build release version ^(default^)
-	ECHO.  /config-debug     build debug version
 	GOTO:EOF
-) ELSE IF [%1]==[/prefix] (
-	SET CONFIG_PREFIX=%2
-	SHIFT
-) ELSE IF [%1]==[/prefix-bd] (
-	SET CONFIG_BUILDPREFIX=%2
-	SHIFT
 ) ELSE IF [%1]==[/target-x86] (
 	SET CONFIG_ARCH=x86
 ) ELSE IF [%1]==[/target-x64] (
 	SET CONFIG_ARCH=x64
+) ELSE IF [%1]==[/target-arm64] (
+	SET CONFIG_ARCH=arm64
 ) ELSE IF [%1]==[/target-psp] (
 	SET CONFIG_ARCH=mips32
 	SET CONFIG_OS=psp
@@ -97,16 +89,15 @@
 ) ELSE IF [%1]==[/tool-msvc] (
 	SET CONFIG_TOOL=msvc
 	SET CONFIG_ASM=ml
+) ELSE IF [%1]==[/tool-clang] (
+	SET CONFIG_TOOL=clang
+	SET CONFIG_ASM=as
 ) ELSE IF [%1]==[/asm-as] (
 	SET CONFIG_ASM=as
 ) ELSE IF [%1]==[/asm-nasm] (
 	SET CONFIG_ASM=nasm
 ) ELSE IF [%1]==[/asm-ml] (
 	SET CONFIG_ASM=ml
-) ELSE IF [%1]==[/config-release] (
-	SET CONFIG_CONFIG=release
-) ELSE IF [%1]==[/config-debug] (
-	SET CONFIG_CONFIG=debug
 ) ELSE (
 	ECHO Unknown parameter '%1'.
 	GOTO DONE
@@ -116,34 +107,21 @@
 GOTO MAIN_LOOP
 :DONE
 
-IF [%CONFIG_PREFIX%]==[] (
-	SET CONFIG_PREFIX=%CD%\install_%CONFIG_OS%_%CONFIG_ARCH%_%CONFIG_TOOL%_%CONFIG_CONFIG%
-)
-IF [%CONFIG_BUILDPREFIX%]==[] (
-	SET CONFIG_BUILDPREFIX=%CD%\build_out\%CONFIG_OS%_%CONFIG_ARCH%_%CONFIG_TOOL%_%CONFIG_CONFIG%
-)
+ECHO # auto-generated by configure.bat >Makefile.config
+ECHO CONFIG_PACKAGE=%PACKAGE%#>>Makefile.config
+ECHO CONFIG_HOST=%CONFIG_HOST%#>>Makefile.config
+ECHO CONFIG_OS=%CONFIG_OS%#>>Makefile.config
+ECHO CONFIG_ARCH=%CONFIG_ARCH%#>>Makefile.config
+ECHO CONFIG_TOOL=%CONFIG_TOOL%#>>Makefile.config
+ECHO CONFIG_ASM=%CONFIG_ASM%#>>Makefile.config
 
-ECHO # auto-generated by configure.bat >ConfigVars
-ECHO CONFIG_PACKAGE=%PACKAGE%#>>ConfigVars
-ECHO CONFIG_HOST=%CONFIG_HOST%#>>ConfigVars
-ECHO CONFIG_OS=%CONFIG_OS%#>>ConfigVars
-ECHO CONFIG_ARCH=%CONFIG_ARCH%#>>ConfigVars
-ECHO CONFIG_TOOL=%CONFIG_TOOL%#>>ConfigVars
-ECHO CONFIG_ASM=%CONFIG_ASM%#>>ConfigVars
-ECHO CONFIG_CONFIG=%CONFIG_CONFIG%#>>ConfigVars
-ECHO CONFIG_PREFIX=%CONFIG_PREFIX%#>>ConfigVars
-ECHO CONFIG_BUILDPREFIX=%CONFIG_BUILDPREFIX%#>>ConfigVars
-
-ECHO Writing following configuration to ConfigVars:
+ECHO Writing following configuration to Makefile.config:
 ECHO.
 ECHO Host OS:             %CONFIG_HOST%
 ECHO Target OS:           %CONFIG_OS%
 ECHO Target Architecture: %CONFIG_ARCH%
 ECHO Compiler:            %CONFIG_TOOL%
 ECHO Assembler:           %CONFIG_ASM%
-ECHO Build configuration: %CONFIG_CONFIG%
-ECHO Install prefix:      %CONFIG_PREFIX%
-ECHO Build prefix:        %CONFIG_BUILDPREFIX%
 
 
 REM We have to transform some pathes for the nds/devkitPro build.
@@ -155,3 +133,4 @@
 		buildsys\scripts\conf-nds.bat
 	)
 )
+
--- a/configure.rc	Wed Nov 09 14:46:38 2022 +0100
+++ b/configure.rc	Sat Nov 19 15:45:41 2022 +0100
@@ -1,7 +1,7 @@
 #!/bin/rc
 #//////////////////////////////////////////////////////////////////////////////
 #
-# Copyright (c) 2007-2010 Daniel Adler <dadler@uni-goettingen.de>, 
+# Copyright (c) 2007-2022 Daniel Adler <dadler@uni-goettingen.de>, 
 #                         Tassilo Philipp <tphilipp@potion-studios.com>
 #
 # Permission to use, copy, modify, and distribute this software for any
@@ -21,26 +21,21 @@
 # --- configure settings ------------------------------------------------------
 
 PACKAGE=dyncall
-CONFIG_PREFIX=/usr/local #@@@
+
 
-# --- output error message ----------------------------------------------------
+# --- message helpers ----------------------------------------------------
 fn error {
   echo error: $*
   exit 1
 }
-
-# --- output warning message --------------------------------------------------
-
 fn warning {
   echo warning: $*
 }
-
-# --- output info message -----------------------------------------------------
-
 fn info {
   echo $*
 }
 
+
 # --- print usage -------------------------------------------------------------
 
 fn usage {
@@ -61,14 +56,12 @@
   #echo '  --tool-pcc         use Portable C Compiler'
   #echo 
   #echo '  --asm-xa           use Plan9 Assemblers (0a, 1a, 2a, etc.)'
-  #echo
-  #echo '  --config-release   build release version (default)'
-  #echo '  --config-debug     build debug version'
   echo
   exit 0
 }
 
-# --- guess operating system -------------------------------------------------
+
+# --- guess os, arch, ... -------------------------------------------------
 
 CONFIG_OS=()
 fn guess_os {
@@ -76,8 +69,6 @@
   info 'guess os '$CONFIG_OS
 }
 
-# --- guess architecture -----------------------------------------------------
-
 CONFIG_ARCH=()
 fn guess_arch {
   CONFIG_ARCH='x86'
@@ -98,8 +89,6 @@
   info 'guess arch '$CONFIG_ARCH
 }
 
-# --- guess tool chain -------------------------------------------------------
-
 CONFIG_TOOL=()
 fn guess_tool {
   #CONFIG_TOOL=`{grep CC /$objtype/mkfile | sed s/CC.//}
@@ -107,51 +96,12 @@
   info 'guess tool '$CONFIG_TOOL
 }
 
-# --- guess assembler --------------------------------------------------------
-
 CONFIG_ASM=()
 fn guess_asm {
   CONFIG_ASM=`{grep AS /$objtype/mkfile | sed s/AS.//}
   info 'guess assembler '$CONFIG_ASM
 }
 
-# --- process arguments ------------------------------------------------------
-
-fn args {
-  while(! ~ $#* 0 && ~ $1 -*) {
-    OPT=$1
-    shift
-
-    switch($OPT) {
-      case --help -h
-        usage
-      #case --target-x86
-        #CONFIG_ARCH='x86'
-      #case --target-x64
-        #CONFIG_ARCH='x64'
-      #case --target-ppc32
-        #CONFIG_ARCH='ppc32'
-      #case --target-arm-arm
-        #CONFIG_ARCH='arm32_arm'
-      #case --target-arm-thumb
-        #CONFIG_ARCH='arm32_thumb'
-      #case --tool-pcc
-        #CONFIG_TOOL=pcc
-        #CONFIG_ASM=2a
-      #case --tool-xa
-        #CONFIG_ASM=2a
-      #case --config-release
-        #CONFIG_CONFIG=release
-      #case --config-debug
-        #CONFIG_CONFIG=debug
-      case *
-        warning 'unknown option '$OPT
-    }
-  }
-}
-
-# --- guess variables --------------------------------------------------------
-
 fn guess {
   if(~ $#CONFIG_OS 0) {
     guess_os
@@ -180,55 +130,58 @@
       error 'no assembler tool'
     }
   }
-
-  if(~ $#CONFIG_CONFIG 0) {
-    CONFIG_CONFIG=release
-  }
-}
-  
-# --- set default variables --------------------------------------------------
-
-fn set_defaults {
-  CONFIG_HOST=$CONFIG_OS
 }
 
-# --- derive variables -------------------------------------------------------
+
+# --- process arguments ------------------------------------------------------
+
+fn args {
+  while(! ~ $#* 0 && ~ $1 -*) {
+    OPT=$1
+    shift
 
-fn derive_vars {
-  BUILD_HOST=$CONFIG_HOST
-  if(! ~ $CONFIG_HOST $CONFIG_OS) {
-    BUILD_HOST=$CONFIG_HOST'_'$CONFIG_OS
+    switch($OPT) {
+      case --help -h
+        usage
+      #case --target-x86
+        #CONFIG_ARCH='x86'
+      #case --target-x64
+        #CONFIG_ARCH='x64'
+      #case --target-ppc32
+        #CONFIG_ARCH='ppc32'
+      #case --target-arm-arm
+        #CONFIG_ARCH='arm32_arm'
+      #case --target-arm-thumb
+        #CONFIG_ARCH='arm32_thumb'
+      #case --tool-pcc
+        #CONFIG_TOOL=pcc
+        #CONFIG_ASM=2a
+      #case --tool-xa
+        #CONFIG_ASM=2a
+      case *
+        warning 'unknown option '$OPT
+    }
   }
 }
 
-# --- write ConfigVars files ------------------------------------------------
+
 
-fn output {
-  echo '#auto-generated by '$PACKAGE'/configure' >$1
-  echo 'CONFIG_PACKAGE='$PACKAGE >>$1
-  echo 'CONFIG_HOST='$CONFIG_HOST >>$1
-  echo 'CONFIG_OS='$CONFIG_OS >>$1
-  echo 'CONFIG_ARCH='$CONFIG_ARCH >>$1
-  echo 'CONFIG_TOOL='$CONFIG_TOOL >>$1
-  echo 'CONFIG_ASM='$CONFIG_ASM >>$1
-  echo 'CONFIG_CONFIG='$CONFIG_CONFIG >>$1
-  echo 'CONFIG_PREFIX='$CONFIG_PREFIX >>$1
-  if(! ~ $#CONFIG_BUILDPREFIX 0) {
-    echo 'CONFIG_BUILDPREFIX='$CONFIG_BUILDPREFIX >>$1
-  }
-  echo '' >>$1
+args $*
+info '* configure package '$PACKAGE
+guess
+
+CONFIG_HOST=$CONFIG_OS
+BUILD_HOST=$CONFIG_HOST
+if(! ~ $CONFIG_HOST $CONFIG_OS) {
+  BUILD_HOST=$CONFIG_HOST'_'$CONFIG_OS
 }
 
-# --- main -------------------------------------------------------------------
+echo '#auto-generated by '$PACKAGE'/configure' >$1
+echo 'CONFIG_PACKAGE='$PACKAGE >>$1
+echo 'CONFIG_HOST='$CONFIG_HOST >>$1
+echo 'CONFIG_OS='$CONFIG_OS >>$1
+echo 'CONFIG_ARCH='$CONFIG_ARCH >>$1
+echo 'CONFIG_TOOL='$CONFIG_TOOL >>$1
+echo 'CONFIG_ASM='$CONFIG_ASM >>$1
+echo '' >>$1
 
-fn main {
-  args $*
-  info '* configure package '$PACKAGE
-  guess
-  set_defaults
-  derive_vars
-  output ConfigVars 
-}
-
-main $*
-
--- a/doc/manual/manual_build.tex	Wed Nov 09 14:46:38 2022 +0100
+++ b/doc/manual/manual_build.tex	Sat Nov 19 15:45:41 2022 +0100
@@ -95,21 +95,19 @@
 Available options:
 
 \begin{tabular*}{0.75\textwidth}{ll}
-{\tt /?}                       & display help                                  \\
-{\tt /prefix \textit{path}}    & set installation prefix (GNU make only)       \\
-{\tt /prefix-bd \textit{path}} & set build directory prefix (GNU make only)    \\
-{\tt /target-x86}              & build for x86 architecture (default)          \\
-{\tt /target-x64}              & build for x64 architecture                    \\
-{\tt /target-psp}              & build for PlayStation Portable (homebrew SDK) \\
-{\tt /target-nds-arm}          & build for Nintendo DS (devkitPro, ARM mode)   \\
-{\tt /target-nds-thumb}        & build for Nintendo DS (devkitPro, THUMB mode) \\
-{\tt /tool-msvc}               & use Microsoft Visual C++ compiler (default)   \\
-{\tt /tool-gcc}                & use GNU Compiler Collection                   \\
-{\tt /asm-ml}                  & use Microsoft Macro Assembler (default)       \\
-{\tt /asm-as}                  & use the GNU Assembler                         \\
-{\tt /asm-nasm}                & use NASM Assembler                            \\
-{\tt /config-release}          & build release version (default)               \\
-{\tt /config-debug}            & build debug version                           \\
+{\tt /?}                       & display help                                        \\
+{\tt /target-x86}              & build for x86 architecture (default)                \\
+{\tt /target-x64}              & build for x64 architecture                          \\
+{\tt /target-arm64}            & build for x64 architecture                          \\
+{\tt /target-psp}              & cross-build for PlayStation Portable (homebrew SDK) \\
+{\tt /target-nds-arm}          & cross-build for Nintendo DS (devkitPro, ARM mode)   \\
+{\tt /target-nds-thumb}        & cross-build for Nintendo DS (devkitPro, THUMB mode) \\
+{\tt /tool-msvc}               & use Microsoft Visual C++ compiler (default)         \\
+{\tt /tool-gcc}                & use GNU Compiler Collection                         \\
+{\tt /tool-clang}              & use GNU Compiler Collection                         \\
+{\tt /asm-ml}                  & use Microsoft Macro Assembler (default)             \\
+{\tt /asm-as}                  & use the GNU or LLVM Assembler                       \\
+{\tt /asm-nasm}                & use NASM Assembler                                  \\
 \end{tabular*}
 
 
--- a/mkfile	Wed Nov 09 14:46:38 2022 +0100
+++ b/mkfile	Sat Nov 19 15:45:41 2022 +0100
@@ -1,7 +1,7 @@
 #//////////////////////////////////////////////////////////////////////////////
 #
-# Copyright (c) 2010 Daniel Adler <dadler@uni-goettingen.de>, 
-#                    Tassilo Philipp <tphilipp@potion-studios.com>
+# Copyright (c) 2010      Daniel Adler <dadler@uni-goettingen.de>, 
+#               2010,2022 Tassilo Philipp <tphilipp@potion-studios.com>
 #
 # Permission to use, copy, modify, and distribute this software for any
 # purpose with or without fee is hereby granted, provided that the above
@@ -24,7 +24,7 @@
 
 # directories:
 DIRS  = dyncall dyncallback
-AUTOS = ConfigVars
+AUTOS = Makefile.config
 
 #.PHONY: tests doc
 tests:V:
--- a/test/hacking-arm-thumb-interwork/diff-gcc-defs/Makefile	Wed Nov 09 14:46:38 2022 +0100
+++ b/test/hacking-arm-thumb-interwork/diff-gcc-defs/Makefile	Sat Nov 19 15:45:41 2022 +0100
@@ -3,7 +3,7 @@
 
 TOP = ../../..
 
-include $(TOP)/ConfigVars
+include $(TOP)/Makefile.config
 
 ifeq ("${CONFIG_OS}","iphoneos")
 DIFFSCRIPT=diff-iphoneos.sh 
--- a/test/makepkg.sh	Wed Nov 09 14:46:38 2022 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-#!/bin/sh
-# script to package some tests for quick deployment (useful for embedded stuff)
-
-TOP=..
-. $TOP/ConfigVars
-
-TESTS="callf ellipsis malloc_wx plain plain_c++ suite suite2 suite3 suite_floats callback_plain callback_plain_c++ callback_suite"
-# addition test:
-#
-# callback_plain callback_suite callf
-# ellipsis
-# malloc_wx thunk
-# nm
-# plain suite suite2 suite3
-# suite2_x86win32fast suite2_x86win32std suite_x86win32fast suite_x86win32std
-
-TARGET="${CONFIG_OS}_${CONFIG_ARCH}_${CONFIG_TOOL}_${CONFIG_CONFIG}"
-BUILD_DIR=build_out
-
-mkdir -p pack_out/testpkg
-for I in $TESTS ; do
-cp $I/$BUILD_DIR/$TARGET/$I pack_out/testpkg
-done
-tar -cvzf test-pack.tar.gz -C pack_out testpkg