diff options
author | Nowar Gu <nowar100@gmail.com> | 2011-07-05 10:31:33 +0800 |
---|---|---|
committer | Nowar Gu <nowar100@gmail.com> | 2011-07-05 10:31:33 +0800 |
commit | 902ed06ccc0cb9cb14aaec19fc80c41b06175f64 (patch) | |
tree | 3f680a762e379e208c6ce07f67f57bab4247142b | |
parent | 8db8aab5dcd71cc7c7641a05758b9b84377095dc (diff) | |
download | gdk-902ed06ccc0cb9cb14aaec19fc80c41b06175f64.tar.gz |
Scaffolding done.
You can go to `samples/hello-llvm/' and run
`../../gdk-build NDK_ROOT=<WHERE_NDK>' to see what happened.
-rw-r--r-- | build/awk/check-awk.awk | 40 | ||||
-rw-r--r-- | build/awk/convert-deps-to-cygwin.awk | 57 | ||||
-rw-r--r-- | build/awk/extract-debuggable.awk | 136 | ||||
-rw-r--r-- | build/awk/extract-launchable.awk | 191 | ||||
-rw-r--r-- | build/awk/extract-package-name.awk | 137 | ||||
-rw-r--r-- | build/awk/extract-pid.awk | 52 | ||||
-rw-r--r-- | build/awk/extract-platform.awk | 43 | ||||
-rw-r--r-- | build/awk/gen-windows-host-path.awk | 149 | ||||
-rw-r--r-- | build/awk/xml.awk | 327 | ||||
-rw-r--r-- | build/core/build-bitcode.mk | 9 | ||||
-rw-r--r-- | build/core/build-local.mk | 41 | ||||
-rw-r--r-- | build/core/build-modules.mk | 4 | ||||
-rw-r--r-- | build/core/init.mk | 14 | ||||
-rw-r--r-- | build/gmsl/README | 27 | ||||
-rw-r--r-- | build/gmsl/__gmsl | 854 | ||||
-rw-r--r-- | build/gmsl/gmsl | 89 | ||||
-rw-r--r-- | build/gmsl/gmsl-tests | 647 | ||||
-rw-r--r-- | build/gmsl/index.html | 687 | ||||
-rwxr-xr-x | build/tools/build-prebuilt.sh | 2 | ||||
-rw-r--r-- | samples/hello-llvm/jni/Android-portable.mk | 11 | ||||
-rw-r--r-- | samples/hello-llvm/jni/Android.mk | 9 | ||||
-rw-r--r-- | samples/hello-llvm/jni/Application.mk | 3 | ||||
-rw-r--r-- | samples/hello-llvm/jni/test2.c | 1 | ||||
-rw-r--r-- | toolchains/llvm/config.mk | 1 | ||||
-rw-r--r-- | toolchains/llvm/setup.mk | 36 |
25 files changed, 84 insertions, 3483 deletions
diff --git a/build/awk/check-awk.awk b/build/awk/check-awk.awk deleted file mode 100644 index a3a0bc8..0000000 --- a/build/awk/check-awk.awk +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (C) 2010 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# This script is used to check that a given awk executable -# implements the match() and substr() functions appropriately. -# -# These were introduced in nawk/gawk, but the original awk -# does not have them. -# -BEGIN { - RSTART=0 - RLENGTH=0 - s1="A real world example" - if (! match(s1,"world")) { - print "Fail match" - } else if (RSTART != 8) { - print "Fail RSTART ="RSTART - } else if (RLENGTH != 5) { - print "Fail RLENGTH ="RLENGTH - } else { - s2=substr(s1,RSTART,RLENGTH) - if (s2 != "world") { - print "Fail substr="s2 - } else { - print "Pass" - } - } -} diff --git a/build/awk/convert-deps-to-cygwin.awk b/build/awk/convert-deps-to-cygwin.awk deleted file mode 100644 index 5dc3646..0000000 --- a/build/awk/convert-deps-to-cygwin.awk +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright (C) 2010 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# This script is used to convert a dependency file generated by a cygwin-less -# GCC compiler program into something that can be parsed into a cygwin-based -# GNU Make program. -# -# More specifically, it's going to translate stuff like: -# -# D:/Stuff/source.o: \ -# D:/Stuff/source.h \ -# C:/NDK/sysroot/include/string.h \ -# C:/NDK/sysroot/include/malloc.h -# -# into -# -# /cygdrive/d/Stuff/source.o: \ -# /cygdrive/d/Stuff/source.h \ -# /cygdrive/c/NDK/sysroot/include/string.h \ -# /cygdrive/c/NDK/sysroot/include/malloc.h -# - -BEGIN { - # TODO: We could determine this dynamically before calling this script - CYGDRIVE_PREFIX = "/cygdrive/" -} - -{ - LINE="" - SEP="" - for (nn = 1; nn <= NF; nn++) { - if ($nn ~ /^[A-Za-z]:/) { - LINE = LINE SEP CYGDRIVE_PREFIX tolower(substr($nn,1,1)) "/" substr($nn,4) - } else { - LINE = LINE SEP $nn - } - SEP=" " - } - # Any leading space on the original line should be preserved - MARGIN="" - if (match($0,"^[[:space:]]+")) { - MARGIN=substr($0,RSTART,RLENGTH) - } - printf("%s%s\n", MARGIN, LINE) -} diff --git a/build/awk/extract-debuggable.awk b/build/awk/extract-debuggable.awk deleted file mode 100644 index 7aa9ec8..0000000 --- a/build/awk/extract-debuggable.awk +++ /dev/null @@ -1,136 +0,0 @@ -# Copyright (C) 2010 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# A nawk/gawk script used to extract the debuggable flag from an -# application's manifest (i.e. AndroidManifest.xml). Usage: -# -# awk -f <this-script> AndroidManifest.xml -# - -BEGIN { - DEBUGGABLE = ""; - while ( xml_event() ) { - # simply extract the 'android:debuggable' attribute value from - # the first <manifest><application> element we find. - if ( XML_TYPE == "BEGIN" && XML_TAG == "APPLICATION" && - XML_RPATH == "APPLICATION/MANIFEST/" ) { - DEBUGGABLE = XML_ATTR["android:debuggable"]; - break; - } - } - # ensure the value is either "true" or "false" - if ( DEBUGGABLE != "true" ) - DEBUGGABLE = "false"; - - print DEBUGGABLE; -} - -# -# the following is copied directly from xml.awk - see this file for -# usage and implementation details. -# -function xml_event () { - RS=">"; - XML_TAG=XML_TYPE=""; - split("", XML_ATTR); - while ( 1 ) { - if (_xml_closing) { # delayed direct tag closure - XML_TAG = _xml_closing; - XML_TYPE = "END"; - _xml_closing = ""; - _xml_exit(XML_TAG); - return 1; - } - if (getline <= 0) return 0; # read new input line - _xml_p = index($0, "<"); # get start marker - if (_xml_p == 0) return 0; # end of file (or malformed input) - $0 = substr($0, _xml_p) # remove anything before '<' - # ignore CData / Comments / Processing instructions / Declarations - if (_xml_in_section("<!\\[[Cc][Dd][Aa][Tt][Aa]\\[", "]]") || - _xml_in_section("<!--", "--") || - _xml_in_section("<\\?", "\\?") || - _xml_in_section("<!", "")) { - continue; - } - if (substr($0, 1, 2) == "</") { # is it a closing tag ? - XML_TYPE = "END"; - $0 = substr($0, 3); - } else { # nope, it's an opening one - XML_TYPE = "BEGIN"; - $0 = substr($0, 2); - } - XML_TAG = $0 - sub("[ \n\t/].*$", "", XML_TAG); # extract tag name - XML_TAG = toupper(XML_TAG); # uppercase it - if ( XML_TAG !~ /^[A-Z][-+_.:0-9A-Z]*$/ ) # validate it - _xml_panic("Invalid tag name: " XML_TAG); - if (XML_TYPE == "BEGIN") { # update reverse path - _xml_enter(XML_TAG); - } else { - _xml_exit(XML_TAG); - } - sub("[^ \n\t]*[ \n\t]*", "", $0); # get rid of tag and spaces - while ($0) { # process attributes - if ($0 == "/") { # deal with direct closing tag, e.g. </foo> - _xml_closing = XML_TAG; # record delayed tag closure. - break - } - _xml_attrib = $0; - sub(/=.*$/,"",_xml_attrib); # extract attribute name - sub(/^[^=]*/,"",$0); # remove it from record - _xml_attrib = tolower(_xml_attrib); - if ( _xml_attrib !~ /^[a-z][-+_0-9a-z:]*$/ ) # validate it - _xml_panic("Invalid attribute name: " _xml_attrib); - if (substr($0,1,2) == "=\"") { # value is ="something" - _xml_value = substr($0,3); - sub(/".*$/,"",_xml_value); - sub(/^="[^"]*"/,"",$0); - } else if (substr($0,1,2) == "='") { # value is ='something' - _xml_value = substr($0,3); - sub(/'.*$/,"",_xml_value); - sub(/^='[^']*'/,"",$0); - } else { - _xml_panic("Invalid attribute value syntax for " _xml_attrib ": " $0); - } - XML_ATTR[_xml_attrib] = _xml_value; # store attribute name/value - sub(/^[ \t\n]*/,"",$0); # get rid of remaining leading spaces - } - return 1; # now return, XML_TYPE/TAG/ATTR/RPATH are set - } -} - -function _xml_panic (msg) { - print msg > "/dev/stderr" - exit(1) -} - -function _xml_in_section (sec_begin, sec_end) { - if (!match( $0, "^" sec_begin )) return 0; - while (!match($0, sec_end "$")) { - if (getline <= 0) _xml_panic("Unexpected EOF: " ERRNO); - } - return 1; -} - -function _xml_enter (tag) { - XML_RPATH = tag "/" XML_RPATH; -} - -function _xml_exit (tag) { - _xml_p = index(XML_RPATH, "/"); - _xml_expected = substr(XML_RPATH, 1, _xml_p-1); - if (_xml_expected != XML_TAG) - _xml_panic("Unexpected close tag: " XML_TAG ", expecting " _xml_expected); - XML_RPATH = substr(XML_RPATH, _xml_p+1); -} diff --git a/build/awk/extract-launchable.awk b/build/awk/extract-launchable.awk deleted file mode 100644 index 55bf97b..0000000 --- a/build/awk/extract-launchable.awk +++ /dev/null @@ -1,191 +0,0 @@ -# Copyright (C) 2010 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# A nawk/gawk script used to extract the list of launchable activities -# from an application's manifest (i.e. AndroidManifest.xml). Usage: -# -# awk -f <this-script> AndroidManifest.xml -# - -# -# Explanation: -# -# A given application can have several activities, and each activity -# can have several intent filters. We want to only list, in the final -# output, the activities which have a intent-filter that contains the -# following elements: -# -# <action android:name="android.intent.action.MAIN" /> -# <category android:name="android.intent.category.LAUNCHER" /> -# -# To do this, we need hooks called when entering and exiting <activity> -# and <intent-filter> elements. -# - -BEGIN { - while ( xml_event() ) { - # concat xml event type and tag for simpler comparisons - event = XML_TYPE "-" XML_TAG; - # When entering a new <activity>, extract its name and set - # the 'launchable' flag to false. - if ( event == "BEGIN-ACTIVITY" && - XML_RPATH == "ACTIVITY/APPLICATION/MANIFEST/" ) { - name = XML_ATTR["android:name"]; - launchable = 0; - } - # When exiting an <activity>, check that it has a name and - # is launchable. If so, print its name to the output - else if ( event == "END-ACTIVITY" && - XML_RPATH == "APPLICATION/MANIFEST/" ) { - if ( name && launchable ) { - # If the name doesn't contain any dot, we consider - # that it is just missing the initial one. - if (index(name, ".") == 0) { - name = "." name - } - print name; - } - } - # When entering an <intent-filter> inside an <activity>, clear - # the 'action' and 'category' variables. They are updated when - # we enter the corresponding elements within the intent-filter. - else if ( event == "BEGIN-INTENT-FILTER" && - XML_RPATH == "INTENT-FILTER/ACTIVITY/APPLICATION/MANIFEST/" ) { - action = "" - category = "" - } - # When exiting an <intent-filter>, set the 'launchable' flag to true - # for the current activity if both 'action' and 'category' have the - # correct name. - else if ( event == "END-INTENT-FILTER" && - XML_RPATH == "ACTIVITY/APPLICATION/MANIFEST/" ) { - if ( action == "android.intent.action.MAIN" && - category == "android.intent.category.LAUNCHER" ) { - launchable = 1; - } - } - # When entering an <action> element inside an <intent-filter>, record - # its name. - else if ( event == "BEGIN-ACTION" && - XML_RPATH == "ACTION/INTENT-FILTER/ACTIVITY/APPLICATION/MANIFEST/" ) { - action = XML_ATTR["android:name"]; - } - # When entering a <category> element inside an <intent-filter>, record - # its name. - else if ( event == "BEGIN-CATEGORY" && - XML_RPATH == "CATEGORY/INTENT-FILTER/ACTIVITY/APPLICATION/MANIFEST/" ) { - category = XML_ATTR["android:name"]; - } - } -} - - -# -# the following is copied directly from xml.awk - see this file for -# usage and implementation details. -# -function xml_event () { - RS=">"; - XML_TAG=XML_TYPE=""; - split("", XML_ATTR); - while ( 1 ) { - if (_xml_closing) { # delayed direct tag closure - XML_TAG = _xml_closing; - XML_TYPE = "END"; - _xml_closing = ""; - _xml_exit(XML_TAG); - return 1; - } - if (getline <= 0) return 0; # read new input line - _xml_p = index($0, "<"); # get start marker - if (_xml_p == 0) return 0; # end of file (or malformed input) - $0 = substr($0, _xml_p) # remove anything before '<' - # ignore CData / Comments / Processing instructions / Declarations - if (_xml_in_section("<!\\[[Cc][Dd][Aa][Tt][Aa]\\[", "]]") || - _xml_in_section("<!--", "--") || - _xml_in_section("<\\?", "\\?") || - _xml_in_section("<!", "")) { - continue; - } - if (substr($0, 1, 2) == "</") { # is it a closing tag ? - XML_TYPE = "END"; - $0 = substr($0, 3); - } else { # nope, it's an opening one - XML_TYPE = "BEGIN"; - $0 = substr($0, 2); - } - XML_TAG = $0 - sub("[ \n\t/].*$", "", XML_TAG); # extract tag name - XML_TAG = toupper(XML_TAG); # uppercase it - if ( XML_TAG !~ /^[A-Z][-+_.:0-9A-Z]*$/ ) # validate it - _xml_panic("Invalid tag name: " XML_TAG); - if (XML_TYPE == "BEGIN") { # update reverse path - _xml_enter(XML_TAG); - } else { - _xml_exit(XML_TAG); - } - sub("[^ \n\t]*[ \n\t]*", "", $0); # get rid of tag and spaces - while ($0) { # process attributes - if ($0 == "/") { # deal with direct closing tag, e.g. </foo> - _xml_closing = XML_TAG; # record delayed tag closure. - break - } - _xml_attrib = $0; - sub(/=.*$/,"",_xml_attrib); # extract attribute name - sub(/^[^=]*/,"",$0); # remove it from record - _xml_attrib = tolower(_xml_attrib); - if ( _xml_attrib !~ /^[a-z][-+_0-9a-z:]*$/ ) # validate it - _xml_panic("Invalid attribute name: " _xml_attrib); - if (substr($0,1,2) == "=\"") { # value is ="something" - _xml_value = substr($0,3); - sub(/".*$/,"",_xml_value); - sub(/^="[^"]*"/,"",$0); - } else if (substr($0,1,2) == "='") { # value is ='something' - _xml_value = substr($0,3); - sub(/'.*$/,"",_xml_value); - sub(/^='[^']*'/,"",$0); - } else { - _xml_panic("Invalid attribute value syntax for " _xml_attrib ": " $0); - } - XML_ATTR[_xml_attrib] = _xml_value; # store attribute name/value - sub(/^[ \t\n]*/,"",$0); # get rid of remaining leading spaces - } - return 1; # now return, XML_TYPE/TAG/ATTR/RPATH are set - } -} - -function _xml_panic (msg) { - print msg > "/dev/stderr" - exit(1) -} - -function _xml_in_section (sec_begin, sec_end) { - if (!match( $0, "^" sec_begin )) return 0; - while (!match($0, sec_end "$")) { - if (getline <= 0) _xml_panic("Unexpected EOF: " ERRNO); - } - return 1; -} - -function _xml_enter (tag) { - XML_RPATH = tag "/" XML_RPATH; -} - -function _xml_exit (tag) { - _xml_p = index(XML_RPATH, "/"); - _xml_expected = substr(XML_RPATH, 1, _xml_p-1); - if (_xml_expected != XML_TAG) - _xml_panic("Unexpected close tag: " XML_TAG ", expecting " _xml_expected); - XML_RPATH = substr(XML_RPATH, _xml_p+1); -} diff --git a/build/awk/extract-package-name.awk b/build/awk/extract-package-name.awk deleted file mode 100644 index eefb070..0000000 --- a/build/awk/extract-package-name.awk +++ /dev/null @@ -1,137 +0,0 @@ -# Copyright (C) 2010 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# A nawk/gawk script used to extract the package name from an application's -# manifest (i.e. AndroidManifest.xml). Usage is: -# -# awk -f <this-script> AndroidManifest.xml -# -# The name itself is the value of the 'package' attribute in the -# 'manifest' element. -# - -BEGIN { - PACKAGE=""; - while (xml_event()) { - # Simply extract the value of the 'name' attribute from - # the top-level <manifest> element. - if ( XML_TYPE == "BEGIN" && XML_RPATH == "MANIFEST/" ) { - PACKAGE = XML_ATTR["package"]; - break; - } - } - if (!PACKAGE) - PACKAGE = "<none>"; - - print PACKAGE; -} - -# -# the following is copied directly from xml.awk - see this file for -# usage and implementation details. -# -function xml_event () { - RS=">"; - XML_TAG=XML_TYPE=""; - split("", XML_ATTR); - while ( 1 ) { - if (_xml_closing) { # delayed direct tag closure - XML_TAG = _xml_closing; - XML_TYPE = "END"; - _xml_closing = ""; - _xml_exit(XML_TAG); - return 1; - } - if (getline <= 0) return 0; # read new input line - _xml_p = index($0, "<"); # get start marker - if (_xml_p == 0) return 0; # end of file (or malformed input) - $0 = substr($0, _xml_p) # remove anything before '<' - # ignore CData / Comments / Processing instructions / Declarations - if (_xml_in_section("<!\\[[Cc][Dd][Aa][Tt][Aa]\\[", "]]") || - _xml_in_section("<!--", "--") || - _xml_in_section("<\\?", "\\?") || - _xml_in_section("<!", "")) { - continue; - } - if (substr($0, 1, 2) == "</") { # is it a closing tag ? - XML_TYPE = "END"; - $0 = substr($0, 3); - } else { # nope, it's an opening one - XML_TYPE = "BEGIN"; - $0 = substr($0, 2); - } - XML_TAG = $0 - sub("[ \n\t/].*$", "", XML_TAG); # extract tag name - XML_TAG = toupper(XML_TAG); # uppercase it - if ( XML_TAG !~ /^[A-Z][-+_.:0-9A-Z]*$/ ) # validate it - _xml_panic("Invalid tag name: " XML_TAG); - if (XML_TYPE == "BEGIN") { # update reverse path - _xml_enter(XML_TAG); - } else { - _xml_exit(XML_TAG); - } - sub("[^ \n\t]*[ \n\t]*", "", $0); # get rid of tag and spaces - while ($0) { # process attributes - if ($0 == "/") { # deal with direct closing tag, e.g. </foo> - _xml_closing = XML_TAG; # record delayed tag closure. - break - } - _xml_attrib = $0; - sub(/=.*$/,"",_xml_attrib); # extract attribute name - sub(/^[^=]*/,"",$0); # remove it from record - _xml_attrib = tolower(_xml_attrib); - if ( _xml_attrib !~ /^[a-z][-+_0-9a-z:]*$/ ) # validate it - _xml_panic("Invalid attribute name: " _xml_attrib); - if (substr($0,1,2) == "=\"") { # value is ="something" - _xml_value = substr($0,3); - sub(/".*$/,"",_xml_value); - sub(/^="[^"]*"/,"",$0); - } else if (substr($0,1,2) == "='") { # value is ='something' - _xml_value = substr($0,3); - sub(/'.*$/,"",_xml_value); - sub(/^='[^']*'/,"",$0); - } else { - _xml_panic("Invalid attribute value syntax for " _xml_attrib ": " $0); - } - XML_ATTR[_xml_attrib] = _xml_value; # store attribute name/value - sub(/^[ \t\n]*/,"",$0); # get rid of remaining leading spaces - } - return 1; # now return, XML_TYPE/TAG/ATTR/RPATH are set - } -} - -function _xml_panic (msg) { - print msg > "/dev/stderr" - exit(1) -} - -function _xml_in_section (sec_begin, sec_end) { - if (!match( $0, "^" sec_begin )) return 0; - while (!match($0, sec_end "$")) { - if (getline <= 0) _xml_panic("Unexpected EOF: " ERRNO); - } - return 1; -} - -function _xml_enter (tag) { - XML_RPATH = tag "/" XML_RPATH; -} - -function _xml_exit (tag) { - _xml_p = index(XML_RPATH, "/"); - _xml_expected = substr(XML_RPATH, 1, _xml_p-1); - if (_xml_expected != XML_TAG) - _xml_panic("Unexpected close tag: " XML_TAG ", expecting " _xml_expected); - XML_RPATH = substr(XML_RPATH, _xml_p+1); -} diff --git a/build/awk/extract-pid.awk b/build/awk/extract-pid.awk deleted file mode 100644 index 9a5677c..0000000 --- a/build/awk/extract-pid.awk +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright (C) 2010 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# Extract the pid of a given package name. This assumes that the -# input is the product of 'adb shell ps' and that the PACKAGE variable -# has been initialized to the package's name. In other words, this should -# be used as: -# -# adb shell ps | awk -f <this-script> -v PACKAGE=<name> -# -# The printed value will be 0 if the package is not found. -# -# NOTE: For some reason, simply using $9 == PACKAGE does not work -# with this script, so use pattern matching instead. -# - -BEGIN { - PID=0 - FS=" " - # Need to escape the dots in the package name - # - # The first argument is the regular expression '\.' - # corresponding to a single dot character. The second - # argument is the replacement string, which will be '\.' - # for every input dot. Finally, we need to escape each - # backslash in the Awk strings. - # - gsub("\\.","\\.",PACKAGE) -} - -# We use the fact that the 9th column of the 'ps' output -# contains the package name, while the 2nd one contains the pid -# -$9 ~ PACKAGE { - PID=$2 -} - -END { - print PID -} diff --git a/build/awk/extract-platform.awk b/build/awk/extract-platform.awk deleted file mode 100644 index c138e1e..0000000 --- a/build/awk/extract-platform.awk +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (C) 2009 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# A nawk/gawk script used to extract the application's platform name from -# its default.properties file. It is called from build/core/add-application.mk -# - -# we look for a line that looks like one of: -# target=android-<api> -# target=<vendor>:<name>:<api> -# -# <api> is a number, but can also be "Donut" for the first form, -# as a special case. -# -BEGIN { - android_regex="android-[0-9A-Za-z_-]+" - vendor_regex=":[0-9]+\\s*$" - API=unknown -} - -/^target\s*=\s*.*/ { - if (match($0,android_regex)) { - API=substr($0,RSTART,RLENGTH) - } - else if (match($0,vendor_regex)) { - API="android-" substr($0,RSTART+1,RLENGTH) - } -} - -END { - printf("%s", API) -} diff --git a/build/awk/gen-windows-host-path.awk b/build/awk/gen-windows-host-path.awk deleted file mode 100644 index b72f4b7..0000000 --- a/build/awk/gen-windows-host-path.awk +++ /dev/null @@ -1,149 +0,0 @@ -# Copyright (C) 2010 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# This script is used to generate a Makefile fragment that will be evaluated -# at runtime by the NDK build system during its initialization pass. -# -# The purpose of this generated fragment is to define a function, named -# 'cygwin-to-host-path' that will transform a Cygwin-specific path into the -# corresponding Windows specific one, i.e. calling -# -# $(call cygwin-to-host-path,/cygdrive/c/Stuff/) --> c:/Stuff -# -# A naive implementation of this function would be the following: -# -# cygwin-to-host-path = $(shell cygpath -m $1) -# -# Unfortunately, calling 'cygpath -m' from GNU Make is horridly slow and people -# have complained that this was adding several minutes to their builds, even in -# the case where there is nothing to do. -# -# The script expects its input to be the output of the Cygwin "mount" command -# as in: -# -# C:/cygwin/bin on /usr/bin type ntfs (binary,auto) -# C:/cygwin/lib on /usr/lib type ntfs (binary,auto) -# C:/cygwin on / type ntfs (binary,auto) -# C: on /cygdrive/c type ntfs (binary,posix=0,user,noumount,auto) -# D: on /cygdrive/d type udf (binary,posix=0,user,noumount,auto) -# -# The script's output will be passed to the GNU Make 'eval' function -# and will look like: -# -# $(patsubst /%,C:/cygwin/, -# $(patsubst /usr/bin/%,C:/cygwin/bin/, -# $(patsubst /usr/lib/%,C:/cygwin/lib/, -# $(patsubst /cygdrive/C/%,C:/, -# $(patsubst /cygdrive/D/%,D:/, -# $(patsubst /cygdrive/c/%,C:/, -# $(patsubst /cygdrive/d/%,D:/,$1))))) -# -BEGIN { - # setup our count - count = 0 -} - -$2 == "on" { - # record a new (host-path,cygwin-path) pair - count ++ - host[count] = $1 - cygwin[count] = $3 -} - -END { - # Drive letters are special cases because we must match both - # the upper and lower case versions to the same drive, i.e. - # if "mount" lists that /cygdrive/c maps to C:, we need to - # map both /cygdrive/c and /cygdrive/C to C: in our final rules. - # - count1 = count - for (nn = 1; nn <= count1; nn++) { - if (!match(host[nn],"^[A-Za-z]:$")) { - # not a driver letter mapping, skip this pair - continue - } - letter = substr(host[nn],1,1) - lo = tolower(letter) - up = toupper(letter) - - # If the cygwin path ends in /<lo>, then substitute it with /<up> - # to create a new pair. - if (match(cygwin[nn],"/"lo"$")) { - count++ - host[count] = host[nn] - cygwin[count] = substr(cygwin[nn],1,length(cygwin[nn])-1) up - continue - } - - # If the cygwin path ends in /<up>, then substitute it with /<lo> - # to create a new pair. - if (match(cygwin[nn],"/"up"$")) { - count++ - host[count] = host[nn] - cygwin[count] = substr(cygwin[nn],1,length(cygwin[nn])-1) lo - continue - } - } - - # We have recorded all (host,cygwin) path pairs, - # now try to sort them so that the ones with the longest cygwin path - # appear first - for (ii = 2; ii <= count; ii++) { - for (jj = ii-1; jj > 0; jj--) { - if (length(cygwin[jj]) > length(cygwin[jj+1])) { - break; - } - if (length(cygwin[jj]) == length(cygwin[jj+1]) && - cygwin[jj] > cygwin[jj+1]) { - break - } - tmp = cygwin[jj] - cygwin[jj] = cygwin[jj+1] - cygwin[jj+1] = tmp - tmp = host[jj] - host[jj] = host[jj+1] - host[jj+1] = tmp - } - } - - # build/core/init.mk defines VERBOSE to 1 when it needs to dump the - # list of substitutions in a human-friendly format, generally when - # NDK_LOG is defined in the environment - # - # Otherwise, just generate the corresponding Make function definition - # - if (VERBOSE == 1) { - for (nn = 1; nn <= count; nn++) { - printf( "$(info %s => %s)", cygwin[nn], host[nn]); - } - } else { - RESULT = "$1" - for (nn = 1; nn <= count; nn++) { - add_drive_rule(host[nn], cygwin[nn]) - } - print RESULT - } -} - -function add_drive_rule (hostpath,cygpath) -{ - if (cygpath == "/") { - # Special case for / - RESULT = "$(patsubst /%," hostpath "/%,\n" RESULT ")" - return - } - # default rule otherwise - RESULT = "$(patsubst " cygpath "/%," hostpath "/%,\n" RESULT ")" -} diff --git a/build/awk/xml.awk b/build/awk/xml.awk deleted file mode 100644 index 2cb28f5..0000000 --- a/build/awk/xml.awk +++ /dev/null @@ -1,327 +0,0 @@ -# Copyright (C) 2010 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# Tiny XML parser implementation in awk. -# -# This file is not meant to be used directly, instead copy the -# functions it defines here into your own script then specialize -# it appropriately. -# - -# See further below for usage instructions and implementation details. -# - -# ---------------------------- cut here --------------------------- - -function xml_event () { - RS=">"; - XML_TAG=XML_TYPE=""; - split("", XML_ATTR); - while ( 1 ) { - if (_xml_closing) { # delayed direct tag closure - XML_TAG = _xml_closing; - XML_TYPE = "END"; - _xml_closing = ""; - _xml_exit(XML_TAG); - return 1; - } - if (getline <= 0) return 0; # read new input line - _xml_p = index($0, "<"); # get start marker - if (_xml_p == 0) return 0; # end of file (or malformed input) - $0 = substr($0, _xml_p) # remove anything before '<' - # ignore CData / Comments / Processing instructions / Declarations - if (_xml_in_section("<!\\[[Cc][Dd][Aa][Tt][Aa]\\[", "]]") || - _xml_in_section("<!--", "--") || - _xml_in_section("<\\?", "\\?") || - _xml_in_section("<!", "")) { - continue; - } - if (substr($0, 1, 2) == "</") { # is it a closing tag ? - XML_TYPE = "END"; - $0 = substr($0, 3); - } else { # nope, it's an opening one - XML_TYPE = "BEGIN"; - $0 = substr($0, 2); - } - XML_TAG = $0 - sub("[ \n\t/].*$", "", XML_TAG); # extract tag name - XML_TAG = toupper(XML_TAG); # uppercase it - if ( XML_TAG !~ /^[A-Z][-+_.:0-9A-Z]*$/ ) # validate it - _xml_panic("Invalid tag name: " XML_TAG); - if (XML_TYPE == "BEGIN") { # update reverse path - _xml_enter(XML_TAG); - } else { - _xml_exit(XML_TAG); - } - sub("[^ \n\t]*[ \n\t]*", "", $0); # get rid of tag and spaces - while ($0) { # process attributes - if ($0 == "/") { # deal with direct closing tag, e.g. </foo> - _xml_closing = XML_TAG; # record delayed tag closure. - break - } - _xml_attrib = $0; - sub(/=.*$/,"",_xml_attrib); # extract attribute name - sub(/^[^=]*/,"",$0); # remove it from record - _xml_attrib = tolower(_xml_attrib); - if ( _xml_attrib !~ /^[a-z][-+_0-9a-z:]*$/ ) # validate it - _xml_panic("Invalid attribute name: " _xml_attrib); - if (substr($0,1,2) == "=\"") { # value is ="something" - _xml_value = substr($0,3); - sub(/".*$/,"",_xml_value); - sub(/^="[^"]*"/,"",$0); - } else if (substr($0,1,2) == "='") { # value is ='something' - _xml_value = substr($0,3); - sub(/'.*$/,"",_xml_value); - sub(/^='[^']*'/,"",$0); - } else { - _xml_panic("Invalid attribute value syntax for " _xml_attrib ": " $0); - } - XML_ATTR[_xml_attrib] = _xml_value; # store attribute name/value - sub(/^[ \t\n]*/,"",$0); # get rid of remaining leading spaces - } - return 1; # now return, XML_TYPE/TAG/ATTR/RPATH are set - } -} - -function _xml_panic (msg) { - print msg > "/dev/stderr" - exit(1) -} - -function _xml_in_section (sec_begin, sec_end) { - if (!match( $0, "^" sec_begin )) return 0; - while (!match($0, sec_end "$")) { - if (getline <= 0) _xml_panic("Unexpected EOF: " ERRNO); - } - return 1; -} - -function _xml_enter (tag) { - XML_RPATH = tag "/" XML_RPATH; -} - -function _xml_exit (tag) { - _xml_p = index(XML_RPATH, "/"); - _xml_expected = substr(XML_RPATH, 1, _xml_p-1); - if (_xml_expected != XML_TAG) - _xml_panic("Unexpected close tag: " XML_TAG ", expecting " _xml_expected); - XML_RPATH = substr(XML_RPATH, _xml_p+1); -} - -# ---------------------------- cut here --------------------------- - -# USAGE: -# -# The functions provided here are used to extract the tags and attributes of a -# given XML file. They do not support extraction of data, CDATA, comments, -# processing instructions and declarations at all. -# -# You should use this from the BEGIN {} action of your awk script (it will -# not work from an END {} action). -# -# Call xml_event() in a while loop. This functions returns 1 for each XML -# 'event' encountered, or 0 when the end of input is reached. Note that in -# case of malformed output, an error will be printed and the script will -# force an exit(1) -# -# After each succesful xml_event() call, the following variables will be set: -# -# XML_TYPE: type of event: "BEGIN" -> mean an opening tag, "END" a -# closing one. -# -# XML_TAG: name of the tag, always in UPPERCASE! -# -# XML_ATTR: a map of attributes for the type. Only set for "BEGIN" types. -# all attribute names are in lowercase. -# -# beware: values are *not* unescaped ! -# -# XML_RPATH: the _reversed_ element path, using "/" as a separator. -# if you are within the <manifest><application> tag, then -# it will be set to "APPLICATION/MANIFEST/" -# (note the trailing slash). -# - -# This is a simple example that dumps the output of the parsing. -# -BEGIN { - while ( xml_event() ) { - printf "XML_TYPE=%s XML_TAG=%s XML_RPATH=%s", XML_TYPE, XML_TAG, XML_RPATH; - if (XML_TYPE == "BEGIN") { - for (attr in XML_ATTR) { - printf " %s='%s'", attr, XML_ATTR[attr]; - } - } - printf "\n"; - } -} - -# IMPLEMENTATION DETAILS: -# -# 1. '>' as the record separator: -# -# RS is set to '>' to use this character as the record separator, instead of -# the default '\n'. This means that something like the following: -# -# <foo><bar attrib="value">stuff</bar></foo> -# -# will be translated into the following successive 'records': -# -# <foo -# <bar attrib="value" -# stuff</bar -# </foo -# -# Note that the '>' is never part of the records and thus will not be matched. -# If the record does not contain a single '<', the input is either -# malformed XML, or we reached the end of file with data after the last -# '>'. -# -# Newlines in the original input are kept in the records as-is. -# -# 2. Getting rid of unwanted stuff: -# -# We don't need any of the data within elements, so we get rid of them by -# simply ignoring anything before the '<' in the current record. This is -# done with code like this: -# -# p = index($0, "<"); # get index of '<' -# if (p == 0) -> return 0; # malformed input or end of file -# $0 = substr($0, p+1); # remove anything before the '<' in record -# -# We also want to ignore certain sections like CDATA, comments, declarations, -# etc.. These begin with a certain pattern and end with another one, e.g. -# "<!--" and "-->" for comments. This is handled by the _xml_in_section() -# function that accepts two patterns as input: -# -# sec_begin: is the pattern for the start of the record. -# sec_end: is the pattern for the end of the record (minus trailing '>'). -# -# The function deals with the fact that these section can embed a valid '>' -# and will then span multiple records, i.e. something like: -# -# <!-- A comment with an embedded > right here ! --> -# -# will be decomposed into two records: -# -# "<!-- A comment with an embedded " -# " right here ! --" -# -# The function deals with this case, and exits when such a section is not -# properly terminated in the input. -# -# _xml_in_section() returns 1 if an ignorable section was found, or 0 otherwise. -# -# 3. Extracting the tag name: -# -# </foo> is a closing tag, and <foo> an opening tag, this is handled -# by the following code: -# -# if (substr($0, 1, 2) == "</") { -# XML_TYPE = "END"; -# $0 = substr($0, 3); -# } else { -# XML_TYPE = "BEGIN"; -# $0 = substr($0, 2); -# } -# -# which defines XML_TYPE, and removes the leading "</" or "<" from the record. -# The tag is later extracted and converted to uppercase with: -# -# XML_TAG = $0 # copy record -# sub("[ \n\t/].*$", "", XML_TAG); # remove anything after tag name -# XML_TAG = toupper(XML_TAG); # conver to uppercase -# # validate tag -# if ( XML_TAG !~ /^[A-Z][-+_.:0-9A-Z]*$/ ) -> panic -# -# Then the record is purged from the tag name and the spaces after it: -# -# # get rid of tag and spaces after it in $0 -# sub("[^ \n\t]*[ \n\t]*", "", $0); -# -# 4. Maintaining XML_RPATH: -# -# The _xml_enter() and _xml_exit() functions are called to maintain the -# XML_RPATH variable when entering and exiting specific tags. _xml_exit() -# will also validate the input, checking proper tag enclosure (or exit(1) -# in case of error). -# -# if (XML_TYPE == "BEGIN") { -# _xml_enter(XML_TAG); -# } else { -# _xml_exit(XML_TAG); -# } -# -# 5. Extracting attributes: -# -# A loop is implemented to parse attributes, the idea is to get the attribute -# name, which is always followed by a '=' character: -# -# _xml_attrib = $0; # copy record. -# sub(/=.*$/,"",_xml_attrib); # get rid of '=' and anything after. -# sub(/^[^=]*/,"",$0); # remove attribute name from $0 -# _xml_attrib = tolower(_xml_attrib); -# if ( _xml_attrib !~ /^[a-z][-+_0-9a-z:]*$/ ) -# _xml_panic("Invalid attribute name: " _xml_attrib); -# -# Now get the value, which is enclosed by either (") or (') -# -# if (substr($0,1,2) == "=\"") { # if $0 begins with =" -# _xml_value = substr($0,3); # extract value -# sub(/".*$/,"",_xml_value); -# sub(/^="[^"]*"/,"",$0); # remove it from $0 -# } else if (substr($0,1,2) == "='") { # if $0 begins with =' -# _xml_value = substr($0,3); # extract value -# sub(/'.*$/,"",_xml_value); -# sub(/^='[^']*'/,"",$0); # remove it from $0 -# } else { -# -> panic (malformed input) -# } -# -# After that, we simply store the value into the XML_ATTR associative -# array, and cleanup $0 from leading spaces: -# -# XML_ATTR[_xml_attrib] = _xml_value; -# sub(/^[ \t\n]*/,"",$0); -# -# -# 6. Handling direct tag closure: -# -# When a tag is closed directly (as in <foo/>), A single '/' will be -# parsed in the attribute parsing loop. We need to record this for the -# next call to xml_event(), since the current one should return a"BEGIN" -# for the "FOO" tag instead. -# -# We do this by setting the special _xml_closing variable, as in: -# -# if ($0 == "/") { -# # record a delayed tag closure for the next call -# _xml_closing = XML_TAG; -# break -# } -# -# This variable is checked at the start of xml_event() like this: -# -# # delayed tag closure - see below -# if (_xml_closing) { -# XML_TAG = _xml_closing; -# XML_TYPE = "END"; -# _xml_closing = ""; -# _xml_exit(XML_TAG); -# return 1; -# } -# -# Note the call to _xml_exit() to update XML_RPATH here. -# diff --git a/build/core/build-bitcode.mk b/build/core/build-bitcode.mk index 8ed89b0..9cf6f53 100644 --- a/build/core/build-bitcode.mk +++ b/build/core/build-bitcode.mk @@ -1,4 +1,9 @@ .PHONY: $(LOCAL_MODULE) +ALL_BITCODE_MODULES += $(LOCAL_MODULE) -$(foreach src,$(filter %c,$(LOCAL_SRC_FILES)),$(call compile-c-to-bc,$(src))) - +# From now on, we only support these flags. +BITCODE_MODULE.$(LOCAL_MODULE).PATH := $(LOCAL_PATH) +BITCODE_MODULE.$(LOCAL_MODULE).SRC_FILES := $(LOCAL_SRC_FILES) +BITCODE_MODULE.$(LOCAL_MODULE).C_INCLUDES := $(LOCAL_C_INCLUDES) +BITCODE_MODULE.$(LOCAL_MODULE).CFLAGS := $(LOCAL_CFLAGS) +BITCODE_MODULE.$(LOCAL_MODULE).CPPFLAGS := $(LOCAL_CPPFLAGS) diff --git a/build/core/build-local.mk b/build/core/build-local.mk index 969beec..54e37a1 100644 --- a/build/core/build-local.mk +++ b/build/core/build-local.mk @@ -1,15 +1,40 @@ -GDK_PROJECT_PATH := $(shell pwd) -GDK_ROOT := $(GDK_PROJECT_PATH)/../.. - -include $(GDK_ROOT)/build/core/init.mk - -include $(GDK_PROJECT_PATH)/jni/Android-portable.mk - -include $(GDK_ROOT)/build/core/build-bitcode.mk +# TODO(Nowar): Let it more smart +GDK_PROJECT_ROOT := $(shell pwd) +GDK_ROOT := $(GDK_PROJECT_ROOT)/../.. ifeq ($(NDK_ROOT),) $(info Android GDK: Must figure out NDK_ROOT location.) $(error Aborting.) endif +include $(GDK_ROOT)/build/core/init.mk + +include $(GDK_TOOLCHAIN_ROOT)/setup.mk + +.PHONY: all \ + clean \ + bitcode_modules + +ALL_BITCODE_MODULES := + +# The first rule +all: bitcode_modules + +clean: + rm -rf $(LOCAL_PATH)/obj/llvm/ + rm -rf $(LOCAL_PATH)/res/raw/*.bc + +include $(GDK_PROJECT_ROOT)/jni/Android-portable.mk + +bitcode_modules: clean $(ALL_BITCODE_MODULES) + +# Now all modules are in ALL_BITCODE_MODULES +# Take them out for each and build it +include $(GDK_ROOT)/build/core/build-modules.mk + +# ############################################################################ +# +# Trasnfer the control to NDK +# +# ############################################################################ include $(NDK_ROOT)/build/core/build-local.mk diff --git a/build/core/build-modules.mk b/build/core/build-modules.mk new file mode 100644 index 0000000..f42a6ab --- /dev/null +++ b/build/core/build-modules.mk @@ -0,0 +1,4 @@ +# TODO(Nowar): Take out per each and build it. +$(foreach gdk_module, $(ALL_BITCODE_MODULES),\ + $(info Android GDK: Compile $(BITCODE_MODULE.$(gdk_module).SRC_FILES) of LOCAL_MODULE $(gdk_module))\ +) diff --git a/build/core/init.mk b/build/core/init.mk index e1771fa..2cd05a2 100644 --- a/build/core/init.mk +++ b/build/core/init.mk @@ -1,14 +1,8 @@ -# ############################################################################ -# -# Read all toolchain-specific configuration files. -# -# ############################################################################ +# We need borrow definitions.mk from NDK due to some predefines. +# Like: $(call my-dir) +include $(NDK_ROOT)/build/core/definitions.mk + GDK_PLATFORM_ROOT := $(GDK_ROOT)/platforms/android-portable/arch-llvm GDK_TOOLCHAIN_ROOT := $(GDK_ROOT)/toolchains/llvm BUILD_BITCODE := $(GDK_ROOT)/build/core/build-bitcode.mk - -parent-dir = $(patsubst %/,%,%(dir $1)) -my-dir = $(call parent-dir,$(lastword $(MAKEFILE_LIST))) - -include $(GDK_TOOLCHAIN_ROOT)/setup.mk diff --git a/build/gmsl/README b/build/gmsl/README deleted file mode 100644 index 152ada6..0000000 --- a/build/gmsl/README +++ /dev/null @@ -1,27 +0,0 @@ -GNU Make Standard Library -------------------------- - -1. Visit http://gmsl.sf.net for more details - -2. To use the GMSL in your Makefile make sure that you have the files - - gmsl - __gmsl - - Add - - include gmsl - - to your Makefile(s). - -3. To run the GMSL test suite have - - gmsl - __gmsl - gmsl-tests - - And then run - - make -f gmsl-tests - -
\ No newline at end of file diff --git a/build/gmsl/__gmsl b/build/gmsl/__gmsl deleted file mode 100644 index 596ff19..0000000 --- a/build/gmsl/__gmsl +++ /dev/null @@ -1,854 +0,0 @@ -# ---------------------------------------------------------------------------- -# -# GNU Make Standard Library (GMSL) -# -# A library of functions to be used with GNU Make's $(call) that -# provides functionality not available in standard GNU Make. -# -# Copyright (c) 2005-2007 John Graham-Cumming -# -# This file is part of GMSL -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# Neither the name of the John Graham-Cumming nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -# ---------------------------------------------------------------------------- - -# This is the GNU Make Standard Library version number as a list with -# three items: major, minor, revision - -gmsl_version := 1 0 11 - -# Used to output warnings and error from the library, it's possible to -# disable any warnings or errors by overriding these definitions -# manually or by setting GMSL_NO_WARNINGS or GMSL_NO_ERRORS - -__gmsl_name := GNU Make Standard Library -__gmsl_warning = $(warning $(__gmsl_name): $1) -__gmsl_error = $(error $(__gmsl_name): $1) - -ifdef GMSL_NO_WARNINGS -__gmsl_warning := -endif -ifdef GMSL_NO_ERRORS -__gmsl_error := -endif - -# If GMSL_TRACE is enabled then calls to the library functions are -# traced to stdout using warning messages with their arguments - -ifdef GMSL_TRACE -__gmsl_tr1 = $(warning $0('$1')) -__gmsl_tr2 = $(warning $0('$1','$2')) -__gmsl_tr3 = $(warning $0('$1','$2','$3')) -else -__gmsl_tr1 := -__gmsl_tr2 := -__gmsl_tr3 := -endif - -# Figure out whether we have $(eval) or not (GNU Make 3.80 and above) -# if we do not then output a warning message, if we do then some -# functions will be enabled. - -__gmsl_have_eval := $(false) -__gmsl_ignore := $(eval __gmsl_have_eval := $(true)) - -# If this is being run with Electric Cloud's emake then warn that -# their $(eval) support is incomplete. - -ifdef ECLOUD_BUILD_ID -$(warning You are using Electric Cloud's emake which has incomplete $$(eval) support) -__gmsl_have_eval := $(false) -endif - -# See if we have $(lastword) (GNU Make 3.81 and above) - -__gmsl_have_lastword := $(lastword $(false) $(true)) - -# See if we have native or and and (GNU Make 3.81 and above) - -__gmsl_have_or := $(if $(filter-out undefined, \ - $(origin or)),$(call or,$(true),$(false))) -__gmsl_have_and := $(if $(filter-out undefined, \ - $(origin and)),$(call and,$(true),$(true))) - -ifneq ($(__gmsl_have_eval),$(true)) -$(call __gmsl_warning,GNU Make $(MAKE_VERSION) does not support $$$$(eval): some functions disabled) -endif - -# ---------------------------------------------------------------------------- -# Function: gmsl_compatible -# Arguments: List containing the desired library version number (maj min rev) -# Returns: $(true) if this version of the library is compatible -# with the requested version number, otherwise $(false) -# ---------------------------------------------------------------------------- -gmsl_compatible = $(strip \ - $(if $(call gt,$(word 1,$1),$(word 1,$(gmsl_version))), \ - $(false), \ - $(if $(call lt,$(word 1,$1),$(word 1,$(gmsl_version))), \ - $(true), \ - $(if $(call gt,$(word 2,$1),$(word 2,$(gmsl_version))), \ - $(false), \ - $(if $(call lt,$(word 2,$1),$(word 2,$(gmsl_version))), \ - $(true), \ - $(call lte,$(word 3,$1),$(word 3,$(gmsl_version)))))))) - -# ########################################################################### -# LOGICAL OPERATORS -# ########################################################################### - -# not is defined in gmsl - -# ---------------------------------------------------------------------------- -# Function: and -# Arguments: Two boolean values -# Returns: Returns $(true) if both of the booleans are true -# ---------------------------------------------------------------------------- -ifneq ($(__gmsl_have_and),$(true)) -and = $(__gmsl_tr2)$(if $1,$(if $2,$(true),$(false)),$(false)) -endif - -# ---------------------------------------------------------------------------- -# Function: or -# Arguments: Two boolean values -# Returns: Returns $(true) if either of the booleans is true -# ---------------------------------------------------------------------------- -ifneq ($(__gmsl_have_or),$(true)) -or = $(__gmsl_tr2)$(if $1$2,$(true),$(false)) -endif - -# ---------------------------------------------------------------------------- -# Function: xor -# Arguments: Two boolean values -# Returns: Returns $(true) if exactly one of the booleans is true -# ---------------------------------------------------------------------------- -xor = $(__gmsl_tr2)$(if $1,$(if $2,$(false),$(true)),$(if $2,$(true),$(false))) - -# ---------------------------------------------------------------------------- -# Function: nand -# Arguments: Two boolean values -# Returns: Returns value of 'not and' -# ---------------------------------------------------------------------------- -nand = $(__gmsl_tr2)$(if $1,$(if $2,$(false),$(true)),$(true)) - -# ---------------------------------------------------------------------------- -# Function: nor -# Arguments: Two boolean values -# Returns: Returns value of 'not or' -# ---------------------------------------------------------------------------- -nor = $(__gmsl_tr2)$(if $1$2,$(false),$(true)) - -# ---------------------------------------------------------------------------- -# Function: xnor -# Arguments: Two boolean values -# Returns: Returns value of 'not xor' -# ---------------------------------------------------------------------------- -xnor =$(__gmsl_tr2)$(if $1,$(if $2,$(true),$(false)),$(if $2,$(false),$(true))) - -# ########################################################################### -# LIST MANIPULATION FUNCTIONS -# ########################################################################### - -# ---------------------------------------------------------------------------- -# Function: first (same as LISP's car, or head) -# Arguments: 1: A list -# Returns: Returns the first element of a list -# ---------------------------------------------------------------------------- -first = $(__gmsl_tr1)$(firstword $1) - -# ---------------------------------------------------------------------------- -# Function: last -# Arguments: 1: A list -# Returns: Returns the last element of a list -# ---------------------------------------------------------------------------- -ifeq ($(__gmsl_have_lastword),$(true)) -last = $(__gmsl_tr1)$(lastword $1) -else -last = $(__gmsl_tr1)$(if $1,$(word $(words $1),$1)) -endif - -# ---------------------------------------------------------------------------- -# Function: rest (same as LISP's cdr, or tail) -# Arguments: 1: A list -# Returns: Returns the list with the first element removed -# ---------------------------------------------------------------------------- -rest = $(__gmsl_tr1)$(wordlist 2,$(words $1),$1) - -# ---------------------------------------------------------------------------- -# Function: chop -# Arguments: 1: A list -# Returns: Returns the list with the last element removed -# ---------------------------------------------------------------------------- -chop = $(__gmsl_tr1)$(wordlist 2,$(words $1),x $1) - -# ---------------------------------------------------------------------------- -# Function: map -# Arguments: 1: Name of function to $(call) for each element of list -# 2: List to iterate over calling the function in 1 -# Returns: The list after calling the function on each element -# ---------------------------------------------------------------------------- -map = $(__gmsl_tr2)$(strip $(foreach a,$2,$(call $1,$a))) - -# ---------------------------------------------------------------------------- -# Function: pairmap -# Arguments: 1: Name of function to $(call) for each pair of elements -# 2: List to iterate over calling the function in 1 -# 3: Second list to iterate over calling the function in 1 -# Returns: The list after calling the function on each pair of elements -# ---------------------------------------------------------------------------- -pairmap = $(strip $(__gmsl_tr3)\ - $(if $2$3,$(call $1,$(call first,$2),$(call first,$3)) \ - $(call pairmap,$1,$(call rest,$2),$(call rest,$3)))) - -# ---------------------------------------------------------------------------- -# Function: leq -# Arguments: 1: A list to compare against... -# 2: ...this list -# Returns: Returns $(true) if the two lists are identical -# ---------------------------------------------------------------------------- -leq = $(__gmsl_tr2)$(strip $(if $(call seq,$(words $1),$(words $2)), \ - $(call __gmsl_list_equal,$1,$2),$(false))) - -__gmsl_list_equal = $(if $(strip $1), \ - $(if $(call seq,$(call first,$1),$(call first,$2)), \ - $(call __gmsl_list_equal, \ - $(call rest,$1), \ - $(call rest,$2)), \ - $(false)), \ - $(true)) - -# ---------------------------------------------------------------------------- -# Function: lne -# Arguments: 1: A list to compare against... -# 2: ...this list -# Returns: Returns $(true) if the two lists are different -# ---------------------------------------------------------------------------- -lne = $(__gmsl_tr2)$(call not,$(call leq,$1,$2)) - -# ---------------------------------------------------------------------------- -# Function: reverse -# Arguments: 1: A list to reverse -# Returns: The list with its elements in reverse order -# ---------------------------------------------------------------------------- -reverse =$(__gmsl_tr1)$(strip $(if $1,$(call reverse,$(call rest,$1)) \ - $(call first,$1))) - -# ---------------------------------------------------------------------------- -# Function: uniq -# Arguments: 1: A list from which to remove repeated elements -# Returns: The list with duplicate elements removed without reordering -# ---------------------------------------------------------------------------- -uniq = $(strip $(__gmsl_tr1)$(if $1,$(call uniq,$(call chop,$1)) \ - $(if $(filter $(call last,$1),$(call chop,$1)),,$(call last,$1)))) - -# ---------------------------------------------------------------------------- -# Function: length -# Arguments: 1: A list -# Returns: The number of elements in the list -# ---------------------------------------------------------------------------- -length = $(__gmsl_tr1)$(words $1) - -# ########################################################################### -# STRING MANIPULATION FUNCTIONS -# ########################################################################### - -# Helper function that translates any GNU Make 'true' value (i.e. a -# non-empty string) to our $(true) - -__gmsl_make_bool = $(if $(strip $1),$(true),$(false)) - -# ---------------------------------------------------------------------------- -# Function: seq -# Arguments: 1: A string to compare against... -# 2: ...this string -# Returns: Returns $(true) if the two strings are identical -# ---------------------------------------------------------------------------- -seq = $(__gmsl_tr2)$(if $(filter-out xx,x$(subst $1,,$2)$(subst $2,,$1)x),$(false),$(true)) - -# ---------------------------------------------------------------------------- -# Function: sne -# Arguments: 1: A string to compare against... -# 2: ...this string -# Returns: Returns $(true) if the two strings are not the same -# ---------------------------------------------------------------------------- -sne = $(__gmsl_tr2)$(call not,$(call seq,$1,$2)) - -# ---------------------------------------------------------------------------- -# Function: split -# Arguments: 1: The character to split on -# 2: A string to split -# Returns: Splits a string into a list separated by spaces at the split -# character in the first argument -# ---------------------------------------------------------------------------- -split = $(__gmsl_tr2)$(strip $(subst $1, ,$2)) - -# ---------------------------------------------------------------------------- -# Function: merge -# Arguments: 1: The character to put between fields -# 2: A list to merge into a string -# Returns: Merges a list into a single string, list elements are separated -# by the character in the first argument -# ---------------------------------------------------------------------------- -merge = $(__gmsl_tr2)$(strip $(if $2, \ - $(if $(call seq,1,$(words $2)), \ - $2,$(call first,$2)$1$(call merge,$1,$(call rest,$2))))) - -ifdef __gmsl_have_eval -# ---------------------------------------------------------------------------- -# Function: tr -# Arguments: 1: The list of characters to translate from -# 2: The list of characters to translate to -# 3: The text to translate -# Returns: Returns the text after translating characters -# ---------------------------------------------------------------------------- -tr = $(strip $(__gmsl_tr3)$(call assert_no_dollar,$0,$1$2$3) \ - $(eval __gmsl_t := $3) \ - $(foreach c, \ - $(join $(addsuffix :,$1),$2), \ - $(eval __gmsl_t := \ - $(subst $(word 1,$(subst :, ,$c)),$(word 2,$(subst :, ,$c)), \ - $(__gmsl_t))))$(__gmsl_t)) - -# Common character classes for use with the tr function. Each of -# these is actually a variable declaration and must be wrapped with -# $() or ${} to be used. - -[A-Z] := A B C D E F G H I J K L M N O P Q R S T U V W X Y Z # -[a-z] := a b c d e f g h i j k l m n o p q r s t u v w x y z # -[0-9] := 0 1 2 3 4 5 6 7 8 9 # -[A-F] := A B C D E F # - -# ---------------------------------------------------------------------------- -# Function: uc -# Arguments: 1: Text to upper case -# Returns: Returns the text in upper case -# ---------------------------------------------------------------------------- -uc = $(__gmsl_tr1)$(call assert_no_dollar,$0,$1)$(call tr,$([a-z]),$([A-Z]),$1) - -# ---------------------------------------------------------------------------- -# Function: lc -# Arguments: 1: Text to lower case -# Returns: Returns the text in lower case -# ---------------------------------------------------------------------------- -lc = $(__gmsl_tr1)$(call assert_no_dollar,$0,$1)$(call tr,$([A-Z]),$([a-z]),$1) - -# ---------------------------------------------------------------------------- -# Function: strlen -# Arguments: 1: A string -# Returns: Returns the length of the string -# ---------------------------------------------------------------------------- -__gmsl_characters := A B C D E F G H I J K L M N O P Q R S T U V W X Y Z -__gmsl_characters += a b c d e f g h i j k l m n o p q r s t u v w x y z -__gmsl_characters += 0 1 2 3 4 5 6 7 8 9 -__gmsl_characters += ` ~ ! @ \# $$ % ^ & * ( ) - _ = + -__gmsl_characters += { } [ ] \ : ; ' " < > , . / ? | - -# Aside: if you read the above you might think that the lower-case -# letter x is missing, and that that's an error. It is missing, but -# it's not an error. __gmsl_characters is used by the strlen -# function. strlen works by transforming every character and space -# into the letter x and then counting the x's. Since there's no need -# to transform x into x I omitted it. - -# This results in __gmsl_space containing just a space - -__gmsl_space := -__gmsl_space += - -strlen = $(__gmsl_tr1)$(call assert_no_dollar,$0,$1)$(strip $(eval __temp := $(subst $(__gmsl_space),x,$1))$(foreach a,$(__gmsl_characters),$(eval __temp := $$(subst $$a,x,$(__temp))))$(eval __temp := $(subst x,x ,$(__temp)))$(words $(__temp))) - -# This results in __gmsl_newline containing just a newline - -define __gmsl_newline - - -endef - -# This results in __gmsl_tab containing a tab - -__gmsl_tab := # - -# ---------------------------------------------------------------------------- -# Function: substr -# Arguments: 1: A string -# 2: Start position (first character is 1) -# 3: End position (inclusive) -# Returns: A substring. -# Note: The string in $1 must not contain a § -# ---------------------------------------------------------------------------- - -substr = $(__gmsl_tr3)$(call assert_no_dollar,$0,$1$2$3)$(strip $(eval __temp := $$(subst $$(__gmsl_space),§ ,$$1))$(foreach a,$(__gmsl_characters),$(eval __temp := $$(subst $$a,$$a$$(__gmsl_space),$(__temp))))$(eval __temp := $(wordlist $2,$3,$(__temp))))$(subst §,$(__gmsl_space),$(subst $(__gmsl_space),,$(__temp))) - -endif # __gmsl_have_eval - -# ########################################################################### -# SET MANIPULATION FUNCTIONS -# ########################################################################### - -# Sets are represented by sorted, deduplicated lists. To create a set -# from a list use set_create, or start with the empty_set and -# set_insert individual elements - -# This is the empty set -empty_set := - -# ---------------------------------------------------------------------------- -# Function: set_create -# Arguments: 1: A list of set elements -# Returns: Returns the newly created set -# ---------------------------------------------------------------------------- -set_create = $(__gmsl_tr1)$(sort $1) - -# ---------------------------------------------------------------------------- -# Function: set_insert -# Arguments: 1: A single element to add to a set -# 2: A set -# Returns: Returns the set with the element added -# ---------------------------------------------------------------------------- -set_insert = $(__gmsl_tr2)$(sort $1 $2) - -# ---------------------------------------------------------------------------- -# Function: set_remove -# Arguments: 1: A single element to remove from a set -# 2: A set -# Returns: Returns the set with the element removed -# ---------------------------------------------------------------------------- -set_remove = $(__gmsl_tr2)$(filter-out $1,$2) - -# ---------------------------------------------------------------------------- -# Function: set_is_member -# Arguments: 1: A single element -# 2: A set -# Returns: Returns $(true) if the element is in the set -# ---------------------------------------------------------------------------- -set_is_member = $(__gmsl_tr2)$(if $(filter $1,$2),$(true),$(false)) - -# ---------------------------------------------------------------------------- -# Function: set_union -# Arguments: 1: A set -# 2: Another set -# Returns: Returns the union of the two sets -# ---------------------------------------------------------------------------- -set_union = $(__gmsl_tr2)$(sort $1 $2) - -# ---------------------------------------------------------------------------- -# Function: set_intersection -# Arguments: 1: A set -# 2: Another set -# Returns: Returns the intersection of the two sets -# ---------------------------------------------------------------------------- -set_intersection = $(__gmsl_tr2)$(filter $1,$2) - -# ---------------------------------------------------------------------------- -# Function: set_is_subset -# Arguments: 1: A set -# 2: Another set -# Returns: Returns $(true) if the first set is a subset of the second -# ---------------------------------------------------------------------------- -set_is_subset = $(__gmsl_tr2)$(call set_equal,$(call set_intersection,$1,$2),$1) - -# ---------------------------------------------------------------------------- -# Function: set_equal -# Arguments: 1: A set -# 2: Another set -# Returns: Returns $(true) if the two sets are identical -# ---------------------------------------------------------------------------- -set_equal = $(__gmsl_tr2)$(call seq,$1,$2) - -# ########################################################################### -# ARITHMETIC LIBRARY -# ########################################################################### - -# Integers a represented by lists with the equivalent number of x's. -# For example the number 4 is x x x x. The maximum integer that the -# library can handle as _input_ is __gmsl_input_int which is defined -# here as 65536 - -__gmsl_sixteen := x x x x x x x x x x x x x x x x -__gmsl_input_int := $(foreach a,$(__gmsl_sixteen), \ - $(foreach b,$(__gmsl_sixteen), \ - $(foreach c,$(__gmsl_sixteen), \ - $(__gmsl_sixteen))))) - -# ---------------------------------------------------------------------------- -# Function: int_decode -# Arguments: 1: A number of x's representation -# Returns: Returns the integer for human consumption that is represented -# by the string of x's -# ---------------------------------------------------------------------------- -int_decode = $(__gmsl_tr1)$(words $1) - -# ---------------------------------------------------------------------------- -# Function: int_encode -# Arguments: 1: A number in human-readable integer form -# Returns: Returns the integer encoded as a string of x's -# ---------------------------------------------------------------------------- -int_encode = $(__gmsl_tr1)$(wordlist 1,$1,$(__gmsl_input_int)) - -# The arithmetic library functions come in two forms: one form of each -# function takes integers as arguments and the other form takes the -# encoded form (x's created by a call to int_encode). For example, -# there are two plus functions: -# -# plus Called with integer arguments and returns an integer -# int_plus Called with encoded arguments and returns an encoded result -# -# plus will be slower than int_plus because its arguments and result -# have to be translated between the x's format and integers. If doing -# a complex calculation use the int_* forms with a single encoding of -# inputs and single decoding of the output. For simple calculations -# the direct forms can be used. - -# Helper function used to wrap an int_* function into a function that -# takes a pair of integers, perhaps a function and returns an integer -# result -__gmsl_int_wrap = $(call int_decode,$(call $1,$(call int_encode,$2),$(call int_encode,$3))) -__gmsl_int_wrap1 = $(call int_decode,$(call $1,$(call int_encode,$2))) -__gmsl_int_wrap2 = $(call $1,$(call int_encode,$2),$(call int_encode,$3)) - -# ---------------------------------------------------------------------------- -# Function: int_plus -# Arguments: 1: A number in x's representation -# 2: Another number in x's represntation -# Returns: Returns the sum of the two numbers in x's representation -# ---------------------------------------------------------------------------- -int_plus = $(strip $(__gmsl_tr2)$1 $2) - -# ---------------------------------------------------------------------------- -# Function: plus (wrapped version of int_plus) -# Arguments: 1: An integer -# 2: Another integer -# Returns: Returns the sum of the two integers -# ---------------------------------------------------------------------------- -plus = $(__gmsl_tr2)$(call __gmsl_int_wrap,int_plus,$1,$2) - -# ---------------------------------------------------------------------------- -# Function: int_subtract -# Arguments: 1: A number in x's representation -# 2: Another number in x's represntation -# Returns: Returns the difference of the two numbers in x's representation, -# or outputs an error on a numeric underflow -# ---------------------------------------------------------------------------- -int_subtract = $(strip $(__gmsl_tr2)$(if $(call int_gte,$1,$2), \ - $(filter-out xx,$(join $1,$2)), \ - $(call __gmsl_warning,Subtraction underflow))) - -# ---------------------------------------------------------------------------- -# Function: subtract (wrapped version of int_subtract) -# Arguments: 1: An integer -# 2: Another integer -# Returns: Returns the difference of the two integers, -# or outputs an error on a numeric underflow -# ---------------------------------------------------------------------------- -subtract = $(__gmsl_tr2)$(call __gmsl_int_wrap,int_subtract,$1,$2) - -# ---------------------------------------------------------------------------- -# Function: int_multiply -# Arguments: 1: A number in x's representation -# 2: Another number in x's represntation -# Returns: Returns the product of the two numbers in x's representation -# ---------------------------------------------------------------------------- -int_multiply = $(strip $(__gmsl_tr2)$(foreach a,$1,$2)) - -# ---------------------------------------------------------------------------- -# Function: multiply (wrapped version of int_multiply) -# Arguments: 1: An integer -# 2: Another integer -# Returns: Returns the product of the two integers -# ---------------------------------------------------------------------------- -multiply = $(__gmsl_tr2)$(call __gmsl_int_wrap,int_multiply,$1,$2) - -# ---------------------------------------------------------------------------- -# Function: int_divide -# Arguments: 1: A number in x's representation -# 2: Another number in x's represntation -# Returns: Returns the result of integer division of argument 1 divided -# by argument 2 in x's representation -# ---------------------------------------------------------------------------- -int_divide = $(__gmsl_tr2)$(strip $(if $2, \ - $(if $(call int_gte,$1,$2), \ - x $(call int_divide,$(call int_subtract,$1,$2),$2),), \ - $(call __gmsl_error,Division by zero))) - -# ---------------------------------------------------------------------------- -# Function: divide (wrapped version of int_divide) -# Arguments: 1: An integer -# 2: Another integer -# Returns: Returns the integer division of the first argument by the second -# ---------------------------------------------------------------------------- -divide = $(__gmsl_tr2)$(call __gmsl_int_wrap,int_divide,$1,$2) - -# ---------------------------------------------------------------------------- -# Function: int_max, int_min -# Arguments: 1: A number in x's representation -# 2: Another number in x's represntation -# Returns: Returns the maximum or minimum of its arguments in x's -# representation -# ---------------------------------------------------------------------------- -int_max = $(__gmsl_tr2)$(subst xx,x,$(join $1,$2)) -int_min = $(__gmsl_tr2)$(subst xx,x,$(filter xx,$(join $1,$2))) - -# ---------------------------------------------------------------------------- -# Function: max, min -# Arguments: 1: An integer -# 2: Another integer -# Returns: Returns the maximum or minimum of its integer arguments -# ---------------------------------------------------------------------------- -max = $(__gmsl_tr2)$(call __gmsl_int_wrap,int_max,$1,$2) -min = $(__gmsl_tr2)$(call __gmsl_int_wrap,int_min,$1,$2) - -# ---------------------------------------------------------------------------- -# Function: int_gt, int_gte, int_lt, int_lte, int_eq, int_ne -# Arguments: Two x's representation numbers to be compared -# Returns: $(true) or $(false) -# -# int_gt First argument greater than second argument -# int_gte First argument greater than or equal to second argument -# int_lt First argument less than second argument -# int_lte First argument less than or equal to second argument -# int_eq First argument is numerically equal to the second argument -# int_ne First argument is not numerically equal to the second argument -# ---------------------------------------------------------------------------- -int_gt = $(__gmsl_tr2)$(call __gmsl_make_bool, \ - $(filter-out $(words $2), \ - $(words $(call int_max,$1,$2)))) -int_gte = $(__gmsl_tr2)$(call __gmsl_make_bool, \ - $(call int_gt,$1,$2)$(call int_eq,$1,$2)) -int_lt = $(__gmsl_tr2)$(call __gmsl_make_bool, \ - $(filter-out $(words $1), \ - $(words $(call int_max,$1,$2)))) -int_lte = $(__gmsl_tr2)$(call __gmsl_make_bool, \ - $(call int_lt,$1,$2)$(call int_eq,$1,$2)) -int_eq = $(__gmsl_tr2)$(call __gmsl_make_bool, \ - $(filter $(words $1),$(words $2))) -int_ne = $(__gmsl_tr2)$(call __gmsl_make_bool, \ - $(filter-out $(words $1),$(words $2))) - -# ---------------------------------------------------------------------------- -# Function: gt, gte, lt, lte, eq, ne -# Arguments: Two integers to be compared -# Returns: $(true) or $(false) -# -# gt First argument greater than second argument -# gte First argument greater than or equal to second argument -# lt First argument less than second argument -# lte First argument less than or equal to second argument -# eq First argument is numerically equal to the second argument -# ne First argument is not numerically equal to the second argument -# ---------------------------------------------------------------------------- -gt = $(__gmsl_tr2)$(call __gmsl_int_wrap2,int_gt,$1,$2) -gte = $(__gmsl_tr2)$(call __gmsl_int_wrap2,int_gte,$1,$2) -lt = $(__gmsl_tr2)$(call __gmsl_int_wrap2,int_lt,$1,$2) -lte = $(__gmsl_tr2)$(call __gmsl_int_wrap2,int_lte,$1,$2) -eq = $(__gmsl_tr2)$(call __gmsl_int_wrap2,int_eq,$1,$2) -ne = $(__gmsl_tr2)$(call __gmsl_int_wrap2,int_ne,$1,$2) - -# increment adds 1 to its argument, decrement subtracts 1. Note that -# decrement does not range check and hence will not underflow, but -# will incorrectly say that 0 - 1 = 0 - -# ---------------------------------------------------------------------------- -# Function: int_inc -# Arguments: 1: A number in x's representation -# Returns: The number incremented by 1 in x's representation -# ---------------------------------------------------------------------------- -int_inc = $(strip $(__gmsl_tr1)$1 x) - -# ---------------------------------------------------------------------------- -# Function: inc -# Arguments: 1: An integer -# Returns: The argument incremented by 1 -# ---------------------------------------------------------------------------- -inc = $(__gmsl_tr1)$(call __gmsl_int_wrap1,int_inc,$1) - -# ---------------------------------------------------------------------------- -# Function: int_dec -# Arguments: 1: A number in x's representation -# Returns: The number decremented by 1 in x's representation -# ---------------------------------------------------------------------------- -int_dec = $(__gmsl_tr1)$(strip $(if $(call sne,0,$(words $1)), \ - $(wordlist 2,$(words $1),$1), \ - $(call __gmsl_warning,Decrement underflow))) - -# ---------------------------------------------------------------------------- -# Function: dec -# Arguments: 1: An integer -# Returns: The argument decremented by 1 -# ---------------------------------------------------------------------------- -dec = $(__gmsl_tr1)$(call __gmsl_int_wrap1,int_dec,$1) - -# double doubles its argument, and halve halves it - -# ---------------------------------------------------------------------------- -# Function: int_double -# Arguments: 1: A number in x's representation -# Returns: The number doubled (i.e. * 2) and returned in x's representation -# ---------------------------------------------------------------------------- -int_double = $(strip $(__gmsl_tr1)$1 $1) - -# ---------------------------------------------------------------------------- -# Function: double -# Arguments: 1: An integer -# Returns: The integer times 2 -# ---------------------------------------------------------------------------- -double = $(__gmsl_tr1)$(call __gmsl_int_wrap1,int_double,$1) - -# ---------------------------------------------------------------------------- -# Function: int_halve -# Arguments: 1: A number in x's representation -# Returns: The number halved (i.e. / 2) and returned in x's representation -# ---------------------------------------------------------------------------- -int_halve = $(__gmsl_tr1)$(strip $(subst xx,x,$(filter-out xy x y, \ - $(join $1,$(foreach a,$1,y x))))) - -# ---------------------------------------------------------------------------- -# Function: halve -# Arguments: 1: An integer -# Returns: The integer divided by 2 -# ---------------------------------------------------------------------------- -halve = $(__gmsl_tr1)$(call __gmsl_int_wrap1,int_halve,$1) - -ifdef __gmsl_have_eval -# ########################################################################### -# ASSOCIATIVE ARRAYS -# ########################################################################### - -# ---------------------------------------------------------------------------- -# Function: set -# Arguments: 1: Name of associative array -# 2: The key value to associate -# 3: The value associated with the key -# Returns: None -# ---------------------------------------------------------------------------- -set = $(__gmsl_tr3)$(call assert_no_dollar,$0,$1$2$3)$(eval __gmsl_aa_$1_$2 = $3) - -# ---------------------------------------------------------------------------- -# Function: get -# Arguments: 1: Name of associative array -# 2: The key to retrieve -# Returns: The value stored in the array for that key -# ---------------------------------------------------------------------------- -get = $(strip $(__gmsl_tr2)$(call assert_no_dollar,$0,$1$2)$(if $(filter-out undefined,$(origin __gmsl_aa_$1_$2)), \ - $(__gmsl_aa_$1_$2))) - -# ---------------------------------------------------------------------------- -# Function: keys -# Arguments: 1: Name of associative array -# Returns: Returns a list of all defined keys in the array -# ---------------------------------------------------------------------------- -keys = $(__gmsl_tr1)$(call assert_no_dollar,$0,$1)$(sort $(patsubst __gmsl_aa_$1_%,%, \ - $(filter __gmsl_aa_$1_%,$(.VARIABLES)))) - -# ---------------------------------------------------------------------------- -# Function: defined -# Arguments: 1: Name of associative array -# 2: The key to test -# Returns: Returns true if the key is defined (i.e. not empty) -# ---------------------------------------------------------------------------- -defined = $(__gmsl_tr2)$(call assert_no_dollar,$0,$1$2)$(call sne,$(call get,$1,$2),) - -endif # __gmsl_have_eval - -ifdef __gmsl_have_eval -# ########################################################################### -# NAMED STACKS -# ########################################################################### - -# ---------------------------------------------------------------------------- -# Function: push -# Arguments: 1: Name of stack -# 2: Value to push onto the top of the stack (must not contain -# a space) -# Returns: None -# ---------------------------------------------------------------------------- -push = $(__gmsl_tr2)$(call assert_no_dollar,$0,$1$2)$(eval __gmsl_stack_$1 := $2 $(if $(filter-out undefined,\ - $(origin __gmsl_stack_$1)),$(__gmsl_stack_$1))) - -# ---------------------------------------------------------------------------- -# Function: pop -# Arguments: 1: Name of stack -# Returns: Top element from the stack after removing it -# ---------------------------------------------------------------------------- -pop = $(__gmsl_tr1)$(call assert_no_dollar,$0,$1)$(strip $(if $(filter-out undefined,$(origin __gmsl_stack_$1)), \ - $(call first,$(__gmsl_stack_$1)) \ - $(eval __gmsl_stack_$1 := $(call rest,$(__gmsl_stack_$1))))) - -# ---------------------------------------------------------------------------- -# Function: peek -# Arguments: 1: Name of stack -# Returns: Top element from the stack without removing it -# ---------------------------------------------------------------------------- -peek = $(__gmsl_tr1)$(call assert_no_dollar,$0,$1)$(call first,$(__gmsl_stack_$1)) - -# ---------------------------------------------------------------------------- -# Function: depth -# Arguments: 1: Name of stack -# Returns: Number of items on the stack -# ---------------------------------------------------------------------------- -depth = $(__gmsl_tr1)$(call assert_no_dollar,$0,$1)$(words $(__gmsl_stack_$1)) - -endif # __gmsl_have_eval - -# ########################################################################### -# DEBUGGING FACILITIES -# ########################################################################### - -# ---------------------------------------------------------------------------- -# Target: gmsl-print-% -# Arguments: The % should be replaced by the name of a variable that you -# wish to print out. -# Action: Echos the name of the variable that matches the % and its value. -# For example, 'make gmsl-print-SHELL' will output the value of -# the SHELL variable -# ---------------------------------------------------------------------------- -gmsl-print-%: ; @echo $* = $($*) - -# ---------------------------------------------------------------------------- -# Function: assert -# Arguments: 1: A boolean that must be true or the assertion will fail -# 2: The message to print with the assertion -# Returns: None -# ---------------------------------------------------------------------------- -assert = $(if $1,,$(call __gmsl_error,Assertion failure: $2)) - -# ---------------------------------------------------------------------------- -# Function: assert_exists -# Arguments: 1: Name of file that must exist, if it is missing an assertion -# will be generated -# Returns: None -# ---------------------------------------------------------------------------- -assert_exists = $(call assert,$(wildcard $1),file '$1' missing) - -# ---------------------------------------------------------------------------- -# Function: assert_no_dollar -# Arguments: 1: Name of a function being executd -# 2: Arguments to check -# Returns: None -# ---------------------------------------------------------------------------- -assert_no_dollar = $(call assert,$(call not,$(findstring $$,$2)),$1 called with a dollar sign in argument) diff --git a/build/gmsl/gmsl b/build/gmsl/gmsl deleted file mode 100644 index 2ff2897..0000000 --- a/build/gmsl/gmsl +++ /dev/null @@ -1,89 +0,0 @@ -# ---------------------------------------------------------------------------- -# -# GNU Make Standard Library (GMSL) -# -# A library of functions to be used with GNU Make's $(call) that -# provides functionality not available in standard GNU Make. -# -# Copyright (c) 2005-2008 John Graham-Cumming -# -# This file is part of GMSL -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# Neither the name of the John Graham-Cumming nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -# ---------------------------------------------------------------------------- - -# Determine if the library has already been included and if so don't -# bother including it again - -ifndef __gmsl_included - -# Standard definitions for true and false. true is any non-empty -# string, false is an empty string. These are intended for use with -# $(if). - -true := T -false := - -# ---------------------------------------------------------------------------- -# Function: not -# Arguments: 1: A boolean value -# Returns: Returns the opposite of the arg. (true -> false, false -> true) -# ---------------------------------------------------------------------------- -not = $(if $1,$(false),$(true)) - -# Prevent reinclusion of the library - -__gmsl_included := $(true) - -# Try to determine where this file is located. If the caller did -# include /foo/gmsl then extract the /foo/ so that __gmsl gets -# included transparently - -ifneq ($(MAKEFILE_LIST),) -__gmsl_root := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)) - -# If there are any spaces in the path in __gmsl_root then give up - -ifeq (1,$(words $(__gmsl_root))) -__gmsl_root := $(patsubst %gmsl,%,$(__gmsl_root)) -else -__gmsl_root := -endif - -include $(__gmsl_root)__gmsl - -else - -include __gmsl - -endif - -endif # __gmsl_included - diff --git a/build/gmsl/gmsl-tests b/build/gmsl/gmsl-tests deleted file mode 100644 index b205be6..0000000 --- a/build/gmsl/gmsl-tests +++ /dev/null @@ -1,647 +0,0 @@ -# ---------------------------------------------------------------------------- -# -# GNU Make Standard Library (GMSL) Test Suite -# -# Test suite for the GMSL -# -# Copyright (c) 2005-2007 John Graham-Cumming -# -# This file is part of GMSL -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# -# Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# Neither the name of the John Graham-Cumming nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -# ---------------------------------------------------------------------------- - -.PHONY: all -all: - @echo - @echo Test Summary - @echo ------------ - @echo "$(call int_decode,$(passed)) tests passed; $(call int_decode,$(failed)) tests failed" - -include gmsl - -passed := -failed := - -ECHO := /bin/echo - -start_test = $(shell $(ECHO) -n "Testing '$1': " >&2)$(eval current_test := OK) -stop_test = $(shell $(ECHO) " $(current_test)" >&2) -test_pass = .$(eval passed := $(call int_inc,$(passed))) -test_fail = X$(eval failed := $(call int_inc,$(failed)))$(eval current_test := ERROR '$1' != '$2') -test_assert = $(if $(filter undefined,$(origin 2)),$(eval 2 :=))$(shell $(ECHO) -n $(if $(call seq,$1,$2),$(call test_pass,$1,$2),$(call test_fail,$1,$2)) >&2) - -$(call start_test,not) -$(call test_assert,$(call not,$(true)),$(false)) -$(call test_assert,$(call not,$(false)),$(true)) -$(call stop_test) - -$(call start_test,or) -$(call test_assert,$(call or,$(true),$(true)),$(true)) -$(call test_assert,$(call or,$(true),$(false)),$(true)) -$(call test_assert,$(call or,$(false),$(true)),$(true)) -$(call test_assert,$(call or,$(false),$(false)),$(false)) -$(call stop_test) - -$(call start_test,and) -$(call test_assert,$(call and,$(true),$(true)),$(true)) -$(call test_assert,$(call and,$(true),$(false)),$(false)) -$(call test_assert,$(call and,$(false),$(true)),$(false)) -$(call test_assert,$(call and,$(false),$(false)),$(false)) -$(call stop_test) - -$(call start_test,xor) -$(call test_assert,$(call xor,$(true),$(true)),$(false)) -$(call test_assert,$(call xor,$(true),$(false)),$(true)) -$(call test_assert,$(call xor,$(false),$(true)),$(true)) -$(call test_assert,$(call xor,$(false),$(false)),$(false)) -$(call stop_test) - -$(call start_test,nand) -$(call test_assert,$(call nand,$(true),$(true)),$(false)) -$(call test_assert,$(call nand,$(true),$(false)),$(true)) -$(call test_assert,$(call nand,$(false),$(true)),$(true)) -$(call test_assert,$(call nand,$(false),$(false)),$(true)) -$(call stop_test) - -$(call start_test,nor) -$(call test_assert,$(call nor,$(true),$(true)),$(false)) -$(call test_assert,$(call nor,$(true),$(false)),$(false)) -$(call test_assert,$(call nor,$(false),$(true)),$(false)) -$(call test_assert,$(call nor,$(false),$(false)),$(true)) -$(call stop_test) - -$(call start_test,xnor) -$(call test_assert,$(call xnor,$(true),$(true)),$(true)) -$(call test_assert,$(call xnor,$(true),$(false)),$(false)) -$(call test_assert,$(call xnor,$(false),$(true)),$(false)) -$(call test_assert,$(call xnor,$(false),$(false)),$(true)) -$(call stop_test) - -$(call start_test,first) -$(call test_assert,$(call first,1 2 3),1) -$(call test_assert,$(call first,1),1) -$(call test_assert,$(call first,),) -$(call stop_test) - -$(call start_test,last) -$(call test_assert,$(call last,1 2 3),3) -$(call test_assert,$(call last,1),1) -$(call test_assert,$(call last,),) -$(call stop_test) - -$(call start_test,rest) -$(call test_assert,$(call rest,1 2 3),2 3) -$(call test_assert,$(call rest,1),) -$(call test_assert,$(call rest,),) -$(call stop_test) - -$(call start_test,chop) -$(call test_assert,$(call chop,1 2 3),1 2) -$(call test_assert,$(call chop,1 2 3 4),1 2 3) -$(call test_assert,$(call chop,1),) -$(call test_assert,$(call chop,),) -$(call stop_test) - -$(call start_test,length) -$(call test_assert,$(call length,1 2 3),3) -$(call test_assert,$(call length,1 2 3 4),4) -$(call test_assert,$(call length,1),1) -$(call test_assert,$(call length,),0) -$(call stop_test) - -$(call start_test,map) -$(call test_assert,$(call map,origin,__undefined map MAKE),undefined file default) -$(call test_assert,$(call map,origin,),) -$(call stop_test) - -joinem = $1$2 -$(call start_test,pairmap) -$(call test_assert,$(call pairmap,addsuffix,2 1 3,a b c),a2 b1 c3) -$(call test_assert,$(call pairmap,addprefix,2 1 3,a b c d),2a 1b 3c d) -$(call test_assert,$(call pairmap,addprefix,2 1 3 4,a b c),2a 1b 3c) -$(call test_assert,$(call pairmap,joinem,2 1 3 4,a b c),2a 1b 3c 4) -$(call stop_test) - -$(call start_test,seq) -$(call test_assert,$(call seq,abc,abc),T) -$(call test_assert,$(call seq,x,),) -$(call test_assert,$(call seq,,x),) -$(call test_assert,$(call seq,x,x),T) -$(call test_assert,$(call seq,a%c,abc),) -$(call test_assert,$(call seq,abc,a%c),) -$(call test_assert,$(call seq,abc,ABC),) -$(call test_assert,$(call seq,abc,),) -$(call test_assert,$(call seq,,),T) -$(call test_assert,$(call seq,a b c,a b c),T) -$(call test_assert,$(call seq,aa% bb% cc,aa% bb% cc),T) -$(call test_assert,$(call seq,aa% bb% cc,aa% bb cc),) -$(call test_assert,$(call seq,aa% bb% cc,xx yy zz),) -$(call stop_test) - -$(call start_test,sne) -$(call test_assert,$(call sne,abc,abc),) -$(call test_assert,$(call sne,x,),T) -$(call test_assert,$(call sne,,x),T) -$(call test_assert,$(call sne,x,x),) -$(call test_assert,$(call sne,abc,ABC),T) -$(call test_assert,$(call sne,abc,),T) -$(call test_assert,$(call sne,,),) -$(call test_assert,$(call sne,a b c,a b c),) -$(call test_assert,$(call sne,aa% bb% cc,aa% bb% cc),) -$(call test_assert,$(call sne,aa% bb% cc,aa% bb cc),T) -$(call stop_test) - -$(call start_test,strlen) -$(call test_assert,$(call strlen,),0) -$(call test_assert,$(call strlen,a),1) -$(call test_assert,$(call strlen,a b),3) -$(call test_assert,$(call strlen,a ),2) -$(call test_assert,$(call strlen, a),2) -$(call test_assert,$(call strlen, ),2) -$(call test_assert,$(call strlen, ),3) -$(call test_assert,$(call strlen, ),4) -$(call stop_test) - -$(call start_test,substr) -$(call test_assert,$(call substr,xyz,1,1),x) -$(call test_assert,$(call substr,xyz,1,2),xy) -$(call test_assert,$(call substr,xyz,2,3),yz) -$(call test_assert,$(call substr,some string,1,1),s) -$(call test_assert,$(call substr,some string,1,2),so) -$(call test_assert,$(call substr,some string,1,3),som) -$(call test_assert,$(call substr,some string,1,4),some) -$(call test_assert,$(call substr,some string,1,5),some ) -$(call test_assert,$(call substr,some string,1,6),some s) -$(call test_assert,$(call substr,some string,5,5), ) -$(call test_assert,$(call substr,some string,5,6), s) -$(call test_assert,$(call substr,some string,5,7), st) -$(call test_assert,$(call substr,some string,5,8), str) -$(call test_assert,$(call substr,some string,1,100),some string) -$(call stop_test) - -$(call start_test,lc) -$(call test_assert,$(call lc,The Quick Brown Fox),the quick brown fox) -$(call test_assert,$(call lc,the1 quick2 brown3 fox4),the1 quick2 brown3 fox4) -$(call test_assert,$(call lc,The_),the_) -$(call test_assert,$(call lc,),) -$(call stop_test) - -$(call start_test,uc) -$(call test_assert,$(call uc,The Quick Brown Fox),THE QUICK BROWN FOX) -$(call test_assert,$(call uc,the1 quick2 brown3 fox4),THE1 QUICK2 BROWN3 FOX4) -$(call test_assert,$(call uc,The_),THE_) -$(call test_assert,$(call uc,),) -$(call stop_test) - -$(call start_test,tr) -$(call test_assert,$(call tr,A B C,1 2 3,CAPITAL),31PIT1L) -$(call test_assert,$(call tr,a b c,1 2 3,CAPITAL),CAPITAL) -$(call test_assert,$(call tr,E L I,3 1 1,I AM ELITE),1 AM 311T3) -$(call stop_test) - -$(call start_test,leq) -$(call test_assert,$(call leq,1 2 3,1 2 3),T) -$(call test_assert,$(call leq,1 2 3,1 2 3 4),) -$(call test_assert,$(call leq,1 2 3 4,1 2 3),) -$(call test_assert,$(call leq,1,1),T) -$(call test_assert,$(call leq,,),T) -$(call stop_test) - -$(call start_test,lne) -$(call test_assert,$(call lne,1 2 3,1 2 3),) -$(call test_assert,$(call lne,1 2 3,1 2 3 4),T) -$(call test_assert,$(call lne,1 2 3 4,1 2 3),T) -$(call test_assert,$(call lne,1,1),) -$(call test_assert,$(call lne,,),) -$(call stop_test) - -$(call start_test,empty_set) -$(call test_assert,$(empty_set),) -$(call test_assert,$(empty_set),$(call set_create,)) -$(call stop_test) - -$(call start_test,set_create) -$(call test_assert,$(call set_create,),) -$(call test_assert,$(call set_create,1 2 2 3),1 2 3) -$(call test_assert,$(call set_create,2 1 1 2 2 3),1 2 3) -$(call test_assert,$(call set_create,1),1) -$(call stop_test) - -$(call start_test,set_insert) -$(call test_assert,$(call set_insert,1,$(empty_set)),1) -$(call test_assert,$(call set_insert,1,$(call set_create,1)),1) -$(call test_assert,$(call set_insert,1,$(call set_create,1 2)),1 2) -$(call test_assert,$(call set_insert,0,$(call set_create,1 2)),0 1 2) -$(call stop_test) - -$(call start_test,set_remove) -$(call test_assert,$(call set_remove,1,$(empty_set)),$(empty_set)) -$(call test_assert,$(call set_remove,1,$(call set_create,1 2)),2) -$(call test_assert,$(call set_remove,1,$(call set_create,1 11 2)),11 2) -$(call test_assert,$(call set_remove,0,$(call set_create,1 2)),1 2) -$(call stop_test) - -$(call start_test,set_is_member) -$(call test_assert,$(call set_is_member,1,$(empty_set)),) -$(call test_assert,$(call set_is_member,1,$(call set_create,2 3)),) -$(call test_assert,$(call set_is_member,1,$(call set_create,1 2 3)),T) -$(call test_assert,$(call set_is_member,1,$(call set_create,1)),T) -$(call stop_test) - -$(call start_test,set_union) -$(call test_assert,$(call set_union,,),) -$(call test_assert,$(call set_union,1 2,),1 2) -$(call test_assert,$(call set_union,,3 4),3 4) -$(call test_assert,$(call set_union,1 2,3 4),1 2 3 4) -$(call test_assert,$(call set_union,1 2 3,3 4 5),1 2 3 4 5) -$(call stop_test) - -$(call start_test,set_intersection) -$(call test_assert,$(call set_intersection,,),) -$(call test_assert,$(call set_intersection,1 2,),) -$(call test_assert,$(call set_intersection,,3 4),) -$(call test_assert,$(call set_intersection,1 2,3 4),) -$(call test_assert,$(call set_intersection,1 2 3 4,3 4 5),3 4) -$(call stop_test) - -$(call start_test,set_is_subset) -$(call test_assert,$(call set_is_subset,,),T) -$(call test_assert,$(call set_is_subset,1 2,),) -$(call test_assert,$(call set_is_subset,,3 4),T) -$(call test_assert,$(call set_is_subset,1 2,3 4),) -$(call test_assert,$(call set_is_subset,1 2,1 2 3 4 5),T) -$(call test_assert,$(call set_is_subset,1 2,1 2),T) -$(call test_assert,$(call set_is_subset,1 2,1 3 4 5),) -$(call stop_test) - -$(call start_test,set_equal) -$(call test_assert,$(call set_equal,,),T) -$(call test_assert,$(call set_equal,1,),) -$(call test_assert,$(call set_equal,,1),) -$(call test_assert,$(call set_equal,1,1),T) -$(call test_assert,$(call set_equal,1 2,),) -$(call test_assert,$(call set_equal,,1 2),) -$(call test_assert,$(call set_equal,1 2,1 2 3),) -$(call stop_test) - -$(call start_test,int_encode) -$(call test_assert,$(call int_encode,0),) -$(call test_assert,$(call int_encode,1),x) -$(call test_assert,$(call int_encode,2),x x) -$(call test_assert,$(call int_encode,10),x x x x x x x x x x) -$(call stop_test) - -$(call start_test,int_decode) -$(call test_assert,$(call int_decode,),0) -$(call test_assert,$(call int_decode,x),1) -$(call test_assert,$(call int_decode,x x),2) -$(call test_assert,$(call int_decode,x x x x x x x x x x),10) -$(call stop_test) - -$(call start_test,int_plus) -$(call test_assert,$(call int_plus,$(call int_encode,3),$(call int_encode,4)),$(call int_encode,7)) -$(call test_assert,$(call int_plus,$(call int_encode,0),$(call int_encode,4)),$(call int_encode,4)) -$(call test_assert,$(call int_plus,$(call int_encode,3),$(call int_encode,0)),$(call int_encode,3)) -$(call test_assert,$(call int_plus,$(call int_encode,0),$(call int_encode,0)),$(call int_encode,0)) -$(call test_assert,$(call int_plus,$(call int_encode,1),$(call int_encode,0)),$(call int_encode,1)) -$(call stop_test) - -$(call start_test,plus) -$(call test_assert,$(call plus,3,4),7) -$(call test_assert,$(call plus,4,3),7) -$(call test_assert,$(call plus,0,4),4) -$(call test_assert,$(call plus,3,0),3) -$(call test_assert,$(call plus,0,0),0) -$(call stop_test) - -__gmsl_warning = $1 -$(call start_test,int_subtract) -$(call test_assert,$(call int_subtract,$(call int_encode,3),$(call int_encode,4)),Subtraction underflow) -$(call test_assert,$(call int_subtract,$(call int_encode,4),$(call int_encode,3)),$(call int_encode,1)) -$(call test_assert,$(call int_subtract,$(call int_encode,3),$(call int_encode,0)),$(call int_encode,3)) -$(call test_assert,$(call int_subtract,$(call int_encode,0),$(call int_encode,0)),$(call int_encode,0)) -$(call test_assert,$(call int_subtract,$(call int_encode,1),$(call int_encode,0)),$(call int_encode,1)) -$(call stop_test) - -__gmsl_warning = x x x x x x x x x x -$(call start_test,subtract) -$(call test_assert,$(call subtract,3,4),10) -$(call test_assert,$(call subtract,4,3),1) -$(call test_assert,$(call subtract,3,0),3) -$(call test_assert,$(call subtract,0,0),0) -$(call stop_test) - -$(call start_test,int_multiply) -$(call test_assert,$(call int_multiply,$(call int_encode,3),$(call int_encode,4)),$(call int_encode,12)) -$(call test_assert,$(call int_multiply,$(call int_encode,4),$(call int_encode,3)),$(call int_encode,12)) -$(call test_assert,$(call int_multiply,$(call int_encode,3),$(call int_encode,0)),$(call int_encode,0)) -$(call test_assert,$(call int_multiply,$(call int_encode,0),$(call int_encode,0)),$(call int_encode,0)) -$(call test_assert,$(call int_multiply,$(call int_encode,1),$(call int_encode,0)),$(call int_encode,0)) -$(call stop_test) - -$(call start_test,multiply) -$(call test_assert,$(call multiply,3,4),12) -$(call test_assert,$(call multiply,4,3),12) -$(call test_assert,$(call multiply,3,0),0) -$(call test_assert,$(call multiply,0,3),0) -$(call test_assert,$(call multiply,0,0),0) -$(call stop_test) - -__gmsl_error = $1 -$(call start_test,int_divide) -$(call test_assert,$(call int_divide,$(call int_encode,3),$(call int_encode,4)),$(call int_encode,0)) -$(call test_assert,$(call int_divide,$(call int_encode,4),$(call int_encode,3)),$(call int_encode,1)) -$(call test_assert,$(call int_divide,$(call int_encode,31),$(call int_encode,3)),$(call int_encode,10)) -$(call test_assert,$(call int_divide,$(call int_encode,30),$(call int_encode,3)),$(call int_encode,10)) -$(call test_assert,$(call int_divide,$(call int_encode,29),$(call int_encode,3)),$(call int_encode,9)) -$(call test_assert,$(call int_divide,$(call int_encode,0),$(call int_encode,1)),$(call int_encode,0)) -$(call test_assert,$(call int_divide,$(call int_encode,1),$(call int_encode,0)),Division by zero) -$(call stop_test) - -__gmsl_error = x x x x x x x x x x -$(call start_test,divide) -$(call test_assert,$(call divide,3,4),0) -$(call test_assert,$(call divide,4,3),1) -$(call test_assert,$(call divide,21,2),10) -$(call test_assert,$(call divide,20,2),10) -$(call test_assert,$(call divide,19,2),9) -$(call test_assert,$(call divide,1,0),10) -$(call stop_test) - -$(call start_test,associative array) -$(call test_assert,$(call get,myarray,key1),) -$(call set,myarray,key1,value1) -$(call test_assert,$(call get,myarray,key1),value1) -$(call test_assert,$(call get,myarray,key2),) -$(call test_assert,$(call get,myarray1,key1),) -$(call test_assert,$(call defined,myarray,key1),T) -$(call test_assert,$(call defined,myarray,key2),) -$(call test_assert,$(call defined,myarray1,key1),) -$(call set,myarray,key2,value2) -$(call test_assert,$(call keys,myarray),key1 key2) -$(call test_assert,$(call keys,myarray1),) -$(call stop_test) - -$(call start_test,named stack) -$(call test_assert,$(call pop,mystack),) -$(call test_assert,$(call push,mystack,e2)) -$(call push,mystack,e1) -$(call test_assert,$(call pop,mystack),e1) -$(call test_assert,$(call pop,mystack),e2) -$(call push,mystack,f3) -$(call push,mystack,f1) -$(call test_assert,$(call pop,mystack),f1) -$(call push,mystack,f2) -$(call test_assert,$(call peek,mystack),f2) -$(call test_assert,$(call depth,mystack),2) -$(call test_assert,$(call pop,mystack),f2) -$(call test_assert,$(call depth,mystack),1) -$(call test_assert,$(call pop,myotherstack),) -$(call stop_test) - -$(call start_test,reverse) -$(call test_assert,$(call reverse,),) -$(call test_assert,$(call reverse,1),1) -$(call test_assert,$(call reverse,1 2),2 1) -$(call test_assert,$(call reverse,1 2 3),3 2 1) -$(call stop_test) - -$(call start_test,uniq) -$(call test_assert,$(call uniq,),) -$(call test_assert,$(call uniq,a),a) -$(call test_assert,$(call uniq,a a),a) -$(call test_assert,$(call uniq,a aa),a aa) -$(call test_assert,$(call uniq,a aa a),a aa) -$(call test_assert,$(call uniq,a b ba ab b a a ba a),a b ba ab) -$(call stop_test) - -c:=, -$(call start_test,split) -$(call test_assert,$(call split,$c,comma$cseparated$cstring),comma separated string) -$(call test_assert,$(call split,*,star*field*record),star field record) -$(call test_assert,$(call split,*,star*),star) -$(call test_assert,$(call split,*,star*field),star field) -$(call test_assert,$(call split,*,star****field),star field) -$(call test_assert,$(call split,*,),) -$(call stop_test) - -$(call start_test,merge) -$(call test_assert,$(call merge,$c,list of things),list$cof$cthings) -$(call test_assert,$(call merge,*,list of things),list*of*things) -$(call test_assert,$(call merge,*,list),list) -$(call test_assert,$(call merge,*,),) -$(call stop_test) - -$(call start_test,int_max) -$(call test_assert,$(call int_max,$(call int_encode,2),$(call int_encode,1)),$(call int_encode,2)) -$(call test_assert,$(call int_max,$(call int_encode,1),$(call int_encode,2)),$(call int_encode,2)) -$(call test_assert,$(call int_max,$(call int_encode,2),$(call int_encode,0)),$(call int_encode,2)) -$(call test_assert,$(call int_max,$(call int_encode,0),$(call int_encode,2)),$(call int_encode,2)) -$(call test_assert,$(call int_max,$(call int_encode,2),$(call int_encode,2)),$(call int_encode,2)) -$(call test_assert,$(call int_max,$(call int_encode,0),$(call int_encode,0)),$(call int_encode,0)) -$(call stop_test) - -$(call start_test,max) -$(call test_assert,$(call max,2,1),2) -$(call test_assert,$(call max,1,2),2) -$(call test_assert,$(call max,2,0),2) -$(call test_assert,$(call max,0,2),2) -$(call test_assert,$(call max,2,2),2) -$(call test_assert,$(call max,0,0),0) -$(call stop_test) - -$(call start_test,int_min) -$(call test_assert,$(call int_min,$(call int_encode,2),$(call int_encode,1)),$(call int_encode,1)) -$(call test_assert,$(call int_min,$(call int_encode,1),$(call int_encode,2)),$(call int_encode,1)) -$(call test_assert,$(call int_min,$(call int_encode,2),$(call int_encode,0)),$(call int_encode,0)) -$(call test_assert,$(call int_min,$(call int_encode,0),$(call int_encode,2)),$(call int_encode,0)) -$(call test_assert,$(call int_min,$(call int_encode,2),$(call int_encode,2)),$(call int_encode,2)) -$(call test_assert,$(call int_min,$(call int_encode,0),$(call int_encode,0)),$(call int_encode,0)) -$(call stop_test) - -$(call start_test,min) -$(call test_assert,$(call min,2,1),1) -$(call test_assert,$(call min,1,2),1) -$(call test_assert,$(call min,2,0),0) -$(call test_assert,$(call min,0,2),0) -$(call test_assert,$(call min,2,2),2) -$(call test_assert,$(call min,0,0),0) -$(call stop_test) - -__gmsl_error = $1 -$(call start_test,assert functions) -$(call test_assert,$(call assert,$(true),ignore),) -$(call test_assert,$(call assert,$(false),failed),Assertion failure: failed) -$(call test_assert,$(call assert_exists,gmsl-tests),) -$(call test_assert,$(call assert_exists,MISSING-gmsl-tests),Assertion failure: file 'MISSING-gmsl-tests' missing) -$(call stop_test) - -$(call start_test,int_inc) -$(call test_assert,$(call int_inc,$(call int_encode,0)),$(call int_encode,1)) -$(call test_assert,$(call int_inc,$(call int_encode,1)),$(call int_encode,2)) -$(call test_assert,$(call int_inc,$(call int_encode,4)),$(call int_encode,5)) -$(call test_assert,$(call int_inc,$(call int_encode,10)),$(call int_encode,11)) -$(call stop_test) - -$(call start_test,inc) -$(call test_assert,$(call inc,0),1) -$(call test_assert,$(call inc,1),2) -$(call test_assert,$(call inc,4),5) -$(call test_assert,$(call inc,10),11) -$(call stop_test) - -__gmsl_warning = $1 -$(call start_test,int_dec) -$(call test_assert,$(call int_dec,$(call int_encode,0)),Decrement underflow) -$(call test_assert,$(call int_dec,$(call int_encode,1)),$(call int_encode,0)) -$(call test_assert,$(call int_dec,$(call int_encode,4)),$(call int_encode,3)) -$(call test_assert,$(call int_dec,$(call int_encode,10)),$(call int_encode,9)) -$(call stop_test) - -__gmsl_warning = x x x x x x x x x x -$(call start_test,dec) -$(call test_assert,$(call dec,0),10) -$(call test_assert,$(call dec,1),0) -$(call test_assert,$(call dec,4),3) -$(call test_assert,$(call dec,10),9) -$(call stop_test) - -$(call start_test,int_double) -$(call test_assert,$(call int_double,$(call int_encode,0)),$(call int_encode,0)) -$(call test_assert,$(call int_double,$(call int_encode,1)),$(call int_encode,2)) -$(call test_assert,$(call int_double,$(call int_encode,4)),$(call int_encode,8)) -$(call stop_test) - -$(call start_test,double) -$(call test_assert,$(call double,0),0) -$(call test_assert,$(call double,1),2) -$(call test_assert,$(call double,4),8) -$(call stop_test) - -$(call start_test,int_halve) -$(call test_assert,$(call int_halve,$(call int_encode,0)),$(call int_encode,0)) -$(call test_assert,$(call int_halve,$(call int_encode,2)),$(call int_encode,1)) -$(call test_assert,$(call int_halve,$(call int_encode,8)),$(call int_encode,4)) -$(call test_assert,$(call int_halve,$(call int_encode,7)),$(call int_encode,3)) -$(call stop_test) - -$(call start_test,halve) -$(call test_assert,$(call halve,0),0) -$(call test_assert,$(call halve,2),1) -$(call test_assert,$(call halve,8),4) -$(call test_assert,$(call halve,7),3) -$(call stop_test) - -$(call start_test,gt) -$(call test_assert,$(call gt,2,3),) -$(call test_assert,$(call gt,3,2),$(true)) -$(call test_assert,$(call gt,2,2),) -$(call stop_test) - -$(call start_test,gte) -$(call test_assert,$(call gte,2,3),) -$(call test_assert,$(call gte,3,2),$(true)) -$(call test_assert,$(call gte,2,2),$(true)) -$(call stop_test) - -$(call start_test,lt) -$(call test_assert,$(call lt,2,3),$(true)) -$(call test_assert,$(call lt,3,2),) -$(call test_assert,$(call lt,2,2),) -$(call stop_test) - -$(call start_test,lte) -$(call test_assert,$(call lte,2,3),$(true)) -$(call test_assert,$(call lte,3,2),) -$(call test_assert,$(call lte,2,2),$(true)) -$(call stop_test) - -$(call start_test,eq) -$(call test_assert,$(call eq,2,3),) -$(call test_assert,$(call eq,3,2),) -$(call test_assert,$(call eq,2,2),$(true)) -$(call stop_test) - -$(call start_test,ne) -$(call test_assert,$(call ne,2,3),$(true)) -$(call test_assert,$(call ne,3,2),$(true)) -$(call test_assert,$(call ne,2,2),) -$(call stop_test) - -$(call start_test,int_gt) -$(call test_assert,$(call int_gt,$(call int_encode,2),$(call int_encode,3)),) -$(call test_assert,$(call int_gt,$(call int_encode,3),$(call int_encode,2)),$(true)) -$(call test_assert,$(call int_gt,$(call int_encode,2),$(call int_encode,2)),) -$(call stop_test) - -$(call start_test,int_gte) -$(call test_assert,$(call int_gte,$(call int_encode,2),$(call int_encode,3)),) -$(call test_assert,$(call int_gte,$(call int_encode,3),$(call int_encode,2)),$(true)) -$(call test_assert,$(call int_gte,$(call int_encode,2),$(call int_encode,2)),$(true)) -$(call stop_test) - -$(call start_test,int_lt) -$(call test_assert,$(call int_lt,$(call int_encode,2),$(call int_encode,3)),$(true)) -$(call test_assert,$(call int_lt,$(call int_encode,3),$(call int_encode,2)),) -$(call test_assert,$(call int_lt,$(call int_encode,2),$(call int_encode,2)),) -$(call stop_test) - -$(call start_test,int_lte) -$(call test_assert,$(call int_lte,$(call int_encode,2),$(call int_encode,3)),$(true)) -$(call test_assert,$(call int_lte,$(call int_encode,3),$(call int_encode,2)),) -$(call test_assert,$(call int_lte,$(call int_encode,2),$(call int_encode,2)),$(true)) -$(call stop_test) - -$(call start_test,int_eq) -$(call test_assert,$(call int_eq,$(call int_encode,2),$(call int_encode,3)),) -$(call test_assert,$(call int_eq,$(call int_encode,3),$(call int_encode,2)),) -$(call test_assert,$(call int_eq,$(call int_encode,2),$(call int_encode,2)),$(true)) -$(call stop_test) - -$(call start_test,int_ne) -$(call test_assert,$(call int_ne,$(call int_encode,2),$(call int_encode,3)),$(true)) -$(call test_assert,$(call int_ne,$(call int_encode,3),$(call int_encode,2)),$(true)) -$(call test_assert,$(call int_ne,$(call int_encode,2),$(call int_encode,2)),) -$(call stop_test) - -$(call start_test,gmsl_compatible) -$(call test_assert,$(call gmsl_compatible,$(gmsl_version)),$(true)) -$(call test_assert,$(call gmsl_compatible,0 9 0),$(true)) -$(call test_assert,$(call gmsl_compatible,0 0 1),$(true)) -$(call test_assert,$(call gmsl_compatible,0 0 0),$(true)) -$(call test_assert,$(call gmsl_compatible,2 0 0),) -$(call test_assert,$(call gmsl_compatible,1 1 0),) -$(call test_assert,$(call gmsl_compatible,1 0 8),$(true)) -$(call test_assert,$(call gmsl_compatible,1 0 8),$(true)) -$(call test_assert,$(call gmsl_compatible,1 0 10),$(true)) -$(call test_assert,$(call gmsl_compatible,1 0 11),$(true)) -$(call test_assert,$(call gmsl_compatible,1 0 12),) -$(call stop_test) diff --git a/build/gmsl/index.html b/build/gmsl/index.html deleted file mode 100644 index 8cc93ae..0000000 --- a/build/gmsl/index.html +++ /dev/null @@ -1,687 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<html><head> - <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> - <title>GNU Make Standard Library</title></head> - -<body> -<h1>GNU Make Standard Library</h1> -The GNU Make Standard Library (GMSL) is a collection of functions -implemented using native GNU Make functionality that provide list and -string manipulation, integer arithmetic, associative arrays, stacks, -and debugging facilities. The GMSL is released under the BSD License.<br> -<br> -<a href="http://sourceforge.net/projects/gmsl/">[Project Page]</a> <a href="http://sourceforge.net/project/showfiles.php?group_id=129887">[Download]</a> -<a href="http://sourceforge.net/forum/forum.php?forum_id=443916">[Discussion -Forum]</a><br> -<h2>Using GMSL</h2> -The two files needed are <span style="font-family: monospace;">gmsl</span> -and <span style="font-family: monospace;">__gmsl</span>. To -include the GMSL in your Makefile do<br> -<pre style="margin-left: 40px;">include gmsl</pre> -<span style="font-family: monospace;">gmsl</span> automatically includes<span style="font-family: monospace;"> __gmsl</span>. To check that -you have the right version of <span style="font-family: monospace;">gmsl</span> -use the <span style="font-family: monospace;">gmsl_compatible</span> -function (see -below). The current version is <span style="font-family: monospace;">1 -0 11</span>.<br> -<br> -The GMSL package also includes a test suite for GMSL. Just run <span style="font-family: monospace;">make -f gmsl-tests</span>.<br> -<h2>Logical Operators</h2>GMSL has boolean $(true) (a non-empty string) -and $(false) (an empty string). The following operators can be -used with those variables.<br> -<br> -<hr style="width: 100%; height: 2px;"><span style="font-weight: bold;">not</span><br> - -<br> - -<span style="font-family: monospace;">Arguments: A boolean value</span><br style="font-family: monospace;"> - -<span style="font-family: monospace;">Returns: Returns $(true) if the boolean is $(false) and vice versa</span><br style="font-family: monospace;"> - -<hr style="width: 100%; height: 2px; font-family: monospace;"><span style="font-weight: bold;"></span><span style="font-weight: bold;">and</span><br> -<br> -<span style="font-family: monospace;">Arguments: Two boolean values</span><br style="font-family: monospace;"> -<span style="font-family: monospace;">Returns: Returns $(true) if both of the booleans are true</span><br style="font-family: monospace;"> -<hr style="width: 100%; height: 2px; font-family: monospace;"><span style="font-weight: bold;">or</span><br> -<br> -<span style="font-family: monospace;">Arguments: Two boolean values</span><br style="font-family: monospace;"> -<span style="font-family: monospace;">Returns: Returns $(true) if either of the booleans is true</span><br style="font-family: monospace;"> -<hr style="width: 100%; height: 2px; font-family: monospace;"><span style="font-weight: bold;">xor</span><br style="font-weight: bold;"> -<br> -<span style="font-family: monospace;">Arguments: Two boolean values</span><br style="font-family: monospace;"> -<span style="font-family: monospace;">Returns: Returns $(true) if exactly one of the booleans is true</span><br style="font-family: monospace;"> -<hr style="width: 100%; height: 2px; font-family: monospace;"><span style="font-weight: bold;">nand</span><br> -<br> -<span style="font-family: monospace;">Arguments: Two boolean values</span><br style="font-family: monospace;"> -<span style="font-family: monospace;">Returns: Returns value of 'not and'</span><br style="font-family: monospace;"> -<hr style="width: 100%; height: 2px; font-family: monospace;"><span style="font-weight: bold;">nor</span><br> -<br> -<span style="font-family: monospace;">Arguments: Two boolean values</span><br style="font-family: monospace;"> -<span style="font-family: monospace;">Returns: Returns value of 'not or'</span><br style="font-family: monospace;"> -<hr style="width: 100%; height: 2px; font-family: monospace;"><span style="font-weight: bold;">xnor</span><br> -<br> -<span style="font-family: monospace;">Arguments: Two boolean values</span><br style="font-family: monospace;"> -<span style="font-family: monospace;">Returns: Returns value of 'not xor'</span><br style="font-family: monospace;"> -<hr style="width: 100%; height: 2px; font-family: monospace;"> -<h2>List Manipulation Functions</h2> - A list is a string of characters; the list separator is a space.<br> - -<br> -<hr style="width: 100%; height: 2px;"><b>first</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A list<br> -Returns: Returns the first element of a list<br> -</span> -<hr><b>last</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A list<br> -Returns: Returns the last element of a list<br> -</span> -<hr><b>rest</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A list<br> -Returns: Returns the list with the first element -removed<br> -</span> -<hr><b>chop</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A list<br> -Returns: Returns the list with the last element removed<br> -</span> -<hr><b>map</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: Name of function to -$(call) for each element of list<br> - 2: List to -iterate over calling the function in 1<br> -Returns: The list after calling the function on each -element<br> -</span> -<hr><b>pairmap</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: Name of function to -$(call) for each pair of elements<br> - 2: List to -iterate over calling the function in 1<br> - 3: Second -list to iterate over calling the function in 1<br> -Returns: The list after calling the function on each -pair of elements<br> -</span> -<hr><b>leq</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A list to compare -against...<br> - 2: ...this -list<br> -Returns: Returns $(true) if the two lists are identical<br> -</span> -<hr><b>lne</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A list to compare -against...<br> - 2: ...this -list<br> -Returns: Returns $(true) if the two lists are different<br> -</span> -<hr><b>reverse</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A list to reverse<br> -Returns: The list with its elements in reverse order<br> -</span> -<hr><b>uniq</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A list to deduplicate<br> -Returns: The list with elements in order without duplicates<br> -</span> -<hr><b>length</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A list<br> -Returns: The number of elements in the list<br> -</span> -<hr style="width: 100%; height: 2px;"><span style="font-family: monospace;"></span> -<h2>String Manipulation Functions</h2> -A string is any sequence of characters.<br> -<br> -<hr style="width: 100%; height: 2px;"><b>seq</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A string to compare -against...<br> - 2: ...this -string<br> -Returns: Returns $(true) if the two strings are -identical<br> -</span> -<hr><b>sne</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A string to compare -against...<br> - 2: ...this -string<br> -Returns: Returns $(true) if the two strings are not -the same<br> -</span> -<hr><b>strlen</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A string<br> -Returns: Returns the length of the string<br> -</span> -<hr><b>substr</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A string<br> - 2: Start offset (first character is 1)<br> - 3: Ending offset (inclusive)<br>Returns: Returns a substring<br> -</span> -<hr><b>split</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: The character to -split on<br> - 2: A -string to split<br> -Returns: Splits a string into a list separated by -spaces at the split<br> - character -in the first argument<br> -</span> -<hr><b>merge</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: The character to -put between fields<br> - 2: A list -to merge into a string<br> -Returns: Merges a list into a single string, list -elements are separated<br> - by the -character in the first argument<br> -</span> -<hr><b>tr</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: The list of -characters to translate from <br> - 2: The -list of characters to translate to<br> - 3: The -text to translate<br> -Returns: Returns the text after translating characters<br> -</span> -<hr><b>uc</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: Text to upper case<br> -Returns: Returns the text in upper case<br> -</span> -<hr><b>lc</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: Text to lower case<br> -Returns: Returns the text in lower case<br> -</span> -<hr style="width: 100%; height: 2px;"><span style="font-family: monospace;"></span> -<h2>Set Manipulation Functions</h2> -Sets are represented by sorted, deduplicated lists. To create a set -from a list use <span style="font-family: -monospace;">set_create</span>, or start with the <span -style="font-family: monospace;">empty_set</span> and <span -style="font-family: monospace;">set_insert</span> individual elements. -The empty set is defined as <span style="font-family: -monospace;">empty_set</span>.<p> - -<hr><b>set_create</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A list of set elements<br> -Returns: Returns the newly created set<br> -</span> - -<hr><b>set_insert</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A single element to add to a set<br> - 2: A set<br> -Returns: Returns the set with the element added<br> -</span> - -<hr><b>set_remove</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A single element to remove from a set<br> - 2: A set<br> -Returns: Returns the set with the element removed<br> -</span> - -<hr><b>set_is_member</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A single element<br> - 2: A set<br> -Returns: Returns $(true) if the element is in the set<br> -</span> - -<hr><b>set_union</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A set<br> - 2: Another set<br> -Returns: Returns the union of the two sets<br> -</span> - -<hr><b>set_intersection</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A set<br> - 2: Another set<br> -Returns: Returns the intersection of the two sets<br> -</span> - -<hr><b>set_is_subset</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A set<br> - 2: Another set<br> -Returns: Returns $(true) if the first set is a subset of the second<br> -</span> - -<hr><b>set_equal</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A set<br> - 2: Another set<br> -Returns: Returns $(true) if the two sets are identical<br> -</span> - -<hr style="width: 100%; height: 2px;"><span style="font-family: monospace;"></span> -<h2>Integer Arithmetic Functions</h2> -Integers are represented by lists with the equivalent number of -x's. For example the number 4 is x x x x. The maximum -integer that the library can handle as <span style="font-style: italic;">input</span> (i.e. as the argument to a -call to <span style="font-family: monospace;">int_encode</span>) is -65536. There is no limit on integer size for internal computations or -output.<br> -<br> -The arithmetic library functions come in two forms: one form of each -function takes integers as arguments and the other form takes the -encoded form (x's created by a call to <span style="font-family: monospace;">int_encode</span>). For example, -there are two plus functions: <span style="font-family: monospace;">plus</span> -(called with integer arguments and returns an integer) and <span style="font-family: monospace;">int_plus</span> (called with encoded -arguments and returns an encoded result).<br> -<br> -<span style="font-family: monospace;">plus</span> will be slower than <span style="font-family: monospace;">int_plus</span> because its arguments -and result have to be translated between the x's format and -integers. If doing a complex calculation use the <span style="font-family: monospace;">int_*</span> forms with a single -encoding of inputs and single decoding of the output. For simple -calculations the direct forms can be used.<br> -<br> -<hr style="width: 100%; height: 2px;"><b>int_decode</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A number of x's -representation<br> -Returns: Returns the integer for human consumption -that is represented<br> - by the -string of x's<br> -</span> -<hr><b>int_encode</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A number in -human-readable integer form<br> -Returns: Returns the integer encoded as a string of x's<br> -</span> -<hr><b>int_plus</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A number in x's -representation<br> - 2: Another -number in x's represntation<br> -Returns: Returns the sum of the two numbers in x's -representation<br> -</span> -<hr><b>plus (wrapped version of int_plus)</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: An integer<br> - 2: Another -integer<br> -Returns: Returns the sum of the two integers<br> -</span> -<hr><b>int_subtract</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A number in x's -representation<br> - 2: Another -number in x's represntation<br> -Returns: Returns the difference of the two numbers in -x's representation,<br> - or outputs -an error on a numeric underflow<br> -</span> -<hr><b>subtract (wrapped version of int_subtract)</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: An integer<br> - 2: Another -integer<br> -Returns: Returns the difference of the two integers,<br> - or outputs -an error on a numeric underflow<br> -</span> -<hr><b>int_multiply</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A number in x's -representation<br> - 2: Another -number in x's represntation<br> -Returns: Returns the product of the two numbers in x's -representation<br> -</span> -<hr><b>multiply (wrapped version of int_multiply)</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: An integer<br> - 2: Another -integer<br> -Returns: Returns the product of the two integers<br> -</span> -<hr><b>int_divide</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A number in x's -representation<br> - 2: Another -number in x's represntation<br> -Returns: Returns the result of integer division of -argument 1 divided<br> - by -argument 2 in x's representation<br> -</span> -<hr><b>divide (wrapped version of int_divide)</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: An integer<br> - 2: Another -integer<br> -Returns: Returns the integer division of the first -argument by the second<br> -</span> -<hr><b>int_max, int_min</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A number in x's -representation<br> - 2: Another -number in x's represntation<br> -Returns: Returns the maximum or minimum of its -arguments in x's<br> - -representation<br> -</span> -<hr><b>max, min</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: An integer<br> - 2: Another -integer<br> -Returns: Returns the maximum or minimum of its integer -arguments<br> -</span> -<hr><b>int_gt, int_gte, int_lt, int_lte, int_eq, int_ne</b><br> -<br> -<span style="font-family: monospace;">Arguments: Two x's representation -numbers to be compared<br> -Returns: $(true) or $(false)<br> -<br> -int_gt First argument greater than second argument<br> -int_gte First argument greater than or equal to second argument<br> -int_lt First argument less than second argument <br> -int_lte First argument less than or equal to second argument<br> -int_eq First argument is numerically equal to the second argument<br> -int_ne First argument is not numerically equal to the second argument<br> -</span> -<hr><b>gt, gte, lt, lte, eq, ne</b><br> -<br> -<span style="font-family: monospace;">Arguments: Two integers to be -compared<br> -Returns: $(true) or $(false)<br> -<br> -gt First argument greater than second argument<br> -gte First argument greater than or equal to second argument<br> -lt First argument less than second argument <br> -lte First argument less than or equal to second argument<br> -eq First argument is numerically equal to the second argument<br> -ne First argument is not numerically equal to the second argument<br> -</span> -increment adds 1 to its argument, decrement subtracts 1. Note that<br> -decrement does not range check and hence will not underflow, but<br> -will incorrectly say that 0 - 1 = 0<br> -<hr><b>int_inc</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A number in x's -representation<br> -Returns: The number incremented by 1 in x's -representation<br> -</span> -<hr><b>inc</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: An integer<br> -Returns: The argument incremented by 1<br> -</span> -<hr><b>int_dec</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A number in x's -representation<br> -Returns: The number decremented by 1 in x's -representation<br> -</span> -<hr><b>dec</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: An integer<br> -Returns: The argument decremented by 1<br> -</span> -<hr><b>int_double</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A number in x's -representation<br> -Returns: The number doubled (i.e. * 2) and returned in -x's representation<br> -</span> -<hr><b>double</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: An integer<br> -Returns: The integer times 2<br> -</span> -<hr><b>int_halve</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A number in x's -representation<br> -Returns: The number halved (i.e. / 2) and returned in -x's representation<br> -</span> -<hr><b>halve</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: An integer<br> -Returns: The integer divided by 2<br> -</span> -<hr style="width: 100%; height: 2px;"><span style="font-family: monospace;"></span> -<h2>Associative Arrays</h2> -An associate array maps a key value (a string with no spaces in it) to -a single value (any string). <br> -<b><br> -</b> -<hr style="width: 100%; height: 2px;"><b>set</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: Name of associative -array<br> - 2: The key -value to associate<br> - 3: The -value associated with the key<br> -Returns: None<br> -</span> -<hr><b>get</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: Name of associative -array<br> - 2: The key -to retrieve<br> -Returns: The value stored in the array for that key<br> -</span> -<hr><b>keys</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: Name of associative -array<br> -Returns: Returns a list of all defined keys in the -array<br> -</span> -<hr><b>defined</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: Name of associative -array<br> - 2: The key -to test<br> -Returns: Returns true if the key is defined (i.e. not -empty)<br> -</span> -<hr style="width: 100%; height: 2px;"><span style="font-family: monospace;"></span> -<h2>Named Stacks</h2> -A stack is an ordered list of strings (with no spaces in them).<br> -<br> -<hr style="width: 100%; height: 2px;"><b>push</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: Name of stack<br> - 2: Value -to push onto the top of the stack (must not contain<br> - a space)<br> -Returns: None<br> -</span> -<hr><b>pop</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: Name of stack<br> -Returns: Top element from the stack after removing it<br> -</span> -<hr><b>peek</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: Name of stack<br> -Returns: Top element from the stack without removing it<br> -</span> -<hr><b>depth</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: Name of stack<br> -Returns: Number of items on the stack<br> -</span> -<hr style="width: 100%; height: 2px;"><span style="font-family: monospace;"></span> -<h2>Miscellaneous and Debugging Facilities</h2> -GMSL defines the following constants; all are accessed as normal GNU -Make variables by wrapping them in <span style="font-family: monospace;">$()</span> or <span style="font-family: monospace;">${}</span>.<br> -<br> -<table style="text-align: left;" border="1" cellpadding="2" cellspacing="2"> - <tbody> - <tr> - <td><span style="font-style: italic;">Constant</span><br> - </td> - <td><span style="font-style: italic;">Value</span><br> - </td> - <td><span style="font-style: italic;">Purpose</span><br> - </td> - </tr> - <tr> - <td><span style="font-family: monospace;">true</span><br> - </td> - <td><span style="font-family: monospace;">T</span><br> - </td> - <td>Boolean for <span style="font-family: monospace;">$(if)</span> -and return from GMSL functions<br> - </td> - </tr> - <tr> - <td><span style="font-family: monospace;">false</span><br> - </td> - <td><br> - </td> - <td>Boolean for <span style="font-family: monospace;">$(if)</span> -and return from GMSL functions<br> - </td> - </tr> - <tr> - <td><span style="font-family: monospace;">gmsl_version</span><br> - </td> - <td><span style="font-family: monospace;">1 0 0</span><br> - </td> - <td>GMSL version number as list: major minor revision<br> - </td> - </tr> - </tbody> -</table> -<span style="font-weight: bold;"><br> -gmsl_compatible</span><span style="font-family: monospace;"><br> -<br> -Arguments: List containing the desired library version number (maj min -rev)<br> -</span><span style="font-family: monospace;">Returns: -$(true) if this version of the library is compatible<br> -</span><span style="font-family: monospace;"> -with the requested version number, otherwise $(false)</span> -<hr><b>gmsl-print-% (target not a function)</b><br> -<br> -<span style="font-family: monospace;">Arguments: The % should be -replaced by the name of a variable that you<br> - wish to -print out.<br> -Action: Echos the name of the variable that matches -the % and its value.<br> - For -example, 'make gmsl-print-SHELL' will output the value of<br> - the SHELL -variable<br> -</span> -<hr><b>assert</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: A boolean that must -be true or the assertion will fail<br> - 2: The -message to print with the assertion<br> -Returns: None<br> -</span> -<hr><b>assert_exists</b><br> -<br> -<span style="font-family: monospace;">Arguments: 1: Name of file that -must exist, if it is missing an assertion<br> - will be -generated<br> -Returns: None<br> -</span> -<hr style="width: 100%; height: 2px;"><br> -GMSL has a number of environment variables (or command-line overrides) -that control various bits of functionality:<br> -<br> -<table style="text-align: left;" border="1" cellpadding="2" cellspacing="2"> - <tbody> - <tr> - <td><span style="font-style: italic;">Variable</span><br> - </td> - <td><span style="font-style: italic;">Purpose</span><br> - </td> - </tr> - <tr> - <td><span style="font-family: monospace;">GMSL_NO_WARNINGS</span><br> - </td> - <td>If set prevents GMSL from outputting warning messages: -artithmetic functions generate underflow warnings.<br> - </td> - </tr> - <tr> - <td><span style="font-family: monospace;">GMSL_NO_ERRORS</span><br> - </td> - <td>If set prevents GMSL from generating fatal errors: division -by zero or failed assertions are fatal.<br> - </td> - </tr> - <tr> - <td><span style="font-family: monospace;">GMSL_TRACE</span><br> - </td> - <td>Enables function tracing. Calls to GMSL functions will -result in name and arguments being traced.<br> - </td> - </tr> - </tbody> -</table> -<span style="font-family: monospace;"></span><br> -<hr> -Copyright (c) 2005-2006 <a href="http://www.jgc.org/">John Graham-Cumming</a>.<br> -<hr style="width: 100%; height: 2px;"> -<table style="width: 100%; text-align: left;" border="0" cellpadding="2" cellspacing="2"> - <tbody> - <tr> - <td style="width: 50%;">John Graham-Cumming's work on this -project was sponsored by <a href="http://www.electric-cloud.com/">Electric -Cloud, Inc</a>.<br> - <a href="http://www.electric-cloud.com/"><img alt="" src="http://gmsl.sf.net/ec_logo.gif" style="border: 0px solid ; width: 223px; height: 47px;"></a><br> - </td> - <td align="right"> - <p><a href="http://sourceforge.net/"><img src="http://sourceforge.net/sflogo.php?group_id=129887&type=1" alt="SourceForge.net Logo" border="0" height="31" width="88"></a></p> - </td> - </tr> - </tbody> -</table> -</body></html> diff --git a/build/tools/build-prebuilt.sh b/build/tools/build-prebuilt.sh new file mode 100755 index 0000000..4c58997 --- /dev/null +++ b/build/tools/build-prebuilt.sh @@ -0,0 +1,2 @@ +#!/bin/sh +# TODO(Nowar): Build clang, clang++ and llvm-link to <GDK>/toolchains/llvm/prebuilt/. diff --git a/samples/hello-llvm/jni/Android-portable.mk b/samples/hello-llvm/jni/Android-portable.mk index 9046d53..fb75899 100644 --- a/samples/hello-llvm/jni/Android-portable.mk +++ b/samples/hello-llvm/jni/Android-portable.mk @@ -2,9 +2,16 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) -LOCAL_CFLAGS := -D NUM=7788 - LOCAL_MODULE := hello_llvm +LOCAL_CFLAGS := -D NUM=7788 LOCAL_SRC_FILES := hello_llvm.c test.c include $(BUILD_BITCODE) + + +include $(CLEAR_VARS) + +LOCAL_MODULE := test2 +LOCAL_SRC_FILES := test2.c + +include $(BUILD_BITCODE) diff --git a/samples/hello-llvm/jni/Android.mk b/samples/hello-llvm/jni/Android.mk index e69de29..09c5ad1 100644 --- a/samples/hello-llvm/jni/Android.mk +++ b/samples/hello-llvm/jni/Android.mk @@ -0,0 +1,9 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := hellollvmDSO +LOCAL_CFLAGS := -D NUM=7788 +LOCAL_SRC_FILES := hello_llvm.c test.c + +include $(BUILD_SHARED_LIBRARY) diff --git a/samples/hello-llvm/jni/Application.mk b/samples/hello-llvm/jni/Application.mk new file mode 100644 index 0000000..59fdfab --- /dev/null +++ b/samples/hello-llvm/jni/Application.mk @@ -0,0 +1,3 @@ +# The ARMv7 is significanly faster due to the use of the hardware FPU +APP_ABI := armeabi armeabi-v7a +APP_PLATFORM := android-12 diff --git a/samples/hello-llvm/jni/test2.c b/samples/hello-llvm/jni/test2.c new file mode 100644 index 0000000..c8620b6 --- /dev/null +++ b/samples/hello-llvm/jni/test2.c @@ -0,0 +1 @@ +void foo(); diff --git a/toolchains/llvm/config.mk b/toolchains/llvm/config.mk deleted file mode 100644 index c880834..0000000 --- a/toolchains/llvm/config.mk +++ /dev/null @@ -1 +0,0 @@ -TOOLCHAIN_ABIS := llvm diff --git a/toolchains/llvm/setup.mk b/toolchains/llvm/setup.mk index 7fd7b19..d57835e 100644 --- a/toolchains/llvm/setup.mk +++ b/toolchains/llvm/setup.mk @@ -1,11 +1,11 @@ -GDK_TOOLCHAIN_PREFIX := $(GDK_TOOLCHAIN_ROOT)/toolchains/llvm/prebuilt/ +GDK_TOOLCHAIN_PREFIX := $(GDK_TOOLCHAIN_ROOT)/llvm/prebuilt/ -# FIXME(Nowar): In future, we will use llvm-ndk-cc +# TODO(Nowar): In future, we use llvm-ndk-cc. BITCODE_CC := $(TOOLCHAIN_PREFIX)clang -BITCODE_CFLAGS := -emit-llvm +BITCODE_CFLAGS := -ccc-host-triple armv7-none-linux-gnueabi -emit-llvm -BITCODE_CXX := $(TOOLCHAIN_PREFIX)clang++ -BITCODE_CXXFLAGS := $(BITCODE_CFLAGS) -fno-exceptions -fno-rtti -D __cplusplus +BITCODE_CPP := $(TOOLCHAIN_PREFIX)clang++ +BITCODE_CPPFLAGS := $(BITCODE_CFLAGS) -fno-exceptions -fno-rtti -D __cplusplus BITCODE_LD := $(TOOLCHAIN_PREFIX)llvm-link BITCODE_LDFLAGS := @@ -13,22 +13,10 @@ BITCODE_LDFLAGS := BITCODE_C_INCLUDES := \ $(GDK_PLATFORM_ROOT)/usr/include -define ev-compile-c-to-bc -_SRC := $$(LOCAL_PATH)/$(1) -_OBJ := $(GDK_PROJECT_PATH)/$(2) -_FLAGS := $$(LOCAL_CFLAGS) \ - $$(BITCODE_CFLAGS) \ - -I $$(LOCAL_C_INCLUDES) \ - -I $$(BITCODE_C_INCLUDES) \ - -c - - -compile-c-to-bc = $(eval $(call ev-compile-c-to-bc,$1,$(1:%.c=%.bc))) - -define cmd-build-bitcode -$(BITCODE_LD) \ - $(call host-path, $(PRIVATE_OBJECTS)) \ - $(PRIVATE_LDFLAGS) \ - $(PRIVATE_LDLIBS) \ - -o $(call host-path, $@) -endef +#define cmd-build-bitcode +#$(BITCODE_LD) \ +# $(call host-path, $(PRIVATE_OBJECTS)) \ +# $(PRIVATE_LDFLAGS) \ +# $(PRIVATE_LDLIBS) \ +# -o $(call host-path, $@) +#endef |