summaryrefslogtreecommitdiff
path: root/build/make_var_export.awk
diff options
context:
space:
mode:
authoraaron <aaron@13f79535-47bb-0310-9956-ffa450edef68>2001-10-15 22:56:55 +0000
committeraaron <aaron@13f79535-47bb-0310-9956-ffa450edef68>2001-10-15 22:56:55 +0000
commitd2ff617f22549f3e39730644f70bfcc747d65d1b (patch)
tree14166416c5fd6f9bbbbb2a752cf67cb919c3e4ff /build/make_var_export.awk
parent781f9e920f872c39895a693b81117eb353609033 (diff)
downloadlibapr-d2ff617f22549f3e39730644f70bfcc747d65d1b.tar.gz
Various changes toward the goal of AIX shared library builds:
Scripts migrated from httpd-2.0 for building exports.c and export_vars.h (make_exports.awk and make_var_export.awk). Removed obsolete script (make_export.awk). Used Victor's CPP rules from httpd-2.0 to create apr.exp list of exported symbols (for AIX) from the export.c and export_vars.h files. export.lo is then created for programs (like httpd) that need to link against a stub library so that the symbols will be available to all DSOs. Reviewed by: Victor J. Orlikowski git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@62425 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'build/make_var_export.awk')
-rw-r--r--build/make_var_export.awk59
1 files changed, 59 insertions, 0 deletions
diff --git a/build/make_var_export.awk b/build/make_var_export.awk
new file mode 100644
index 000000000..966e14ecc
--- /dev/null
+++ b/build/make_var_export.awk
@@ -0,0 +1,59 @@
+# Based on apr's make_export.awk, which is
+# based on Ryan Bloom's make_export.pl
+
+/^#[ \t]*if(def)? (AP[RU]?_|!?defined).*/ {
+ if (old_filename != FILENAME) {
+ if (old_filename != "") printf("%s", line)
+ macro_no = 0
+ found = 0
+ count = 0
+ old_filename = FILENAME
+ line = ""
+ }
+ macro_stack[macro_no++] = macro
+ macro = substr($0, length($1)+2)
+ count++
+ line = line "#ifdef " macro "\n"
+ next
+}
+
+/^#[ \t]*endif/ {
+ if (count > 0) {
+ count--
+ line = line "#endif /* " macro " */\n"
+ macro = macro_stack[--macro_no]
+ }
+ if (count == 0) {
+ if (found != 0) {
+ printf("%s", line)
+ }
+ line = ""
+ }
+ next
+}
+
+function add_symbol (sym_name) {
+ if (count) {
+ found++
+ }
+ for (i = 0; i < count; i++) {
+ line = line "\t"
+ }
+ line = line sym_name "\n"
+
+ if (count == 0) {
+ printf("%s", line)
+ line = ""
+ }
+}
+
+/^[ \t]*AP[RU]?_DECLARE_DATA .*;$/ {
+ varname = $NF;
+ gsub( /[*;]/, "", varname);
+ gsub( /\[.*\]/, "", varname);
+ add_symbol(varname);
+}
+
+END {
+ printf("%s", line)
+}