Revert "build: add symbol versioning when we build with gnu ld"
[Samba.git] / source3 / script / mksyms.awk
bloba30bea4d340ba7b8ad2d4e8d8c391a25be68d735
2 # mksyms.awk
4 # Extract symbols to export from C-header files.
5 # output in version-script format for linking shared libraries.
7 # Copyright (C) 2008 Micheal Adam <obnox@samba.org>
9 BEGIN {
10 inheader=0;
11 current_file="";
12 print "#"
13 print "# This file is automatically generated with \"make symbols\". DO NOT EDIT "
14 print "#"
15 print "{"
16 print "\tglobal:"
19 END {
20 print""
21 print "\tlocal: *;"
22 print "};"
26 if (FILENAME!=current_file) {
27 print "\t\t# The following definitions come from",FILENAME
28 current_file=FILENAME
30 if (inheader) {
31 if (match($0,"[)][ \t]*[;][ \t]*$")) {
32 inheader = 0;
34 next;
38 /^static/ || /^[ \t]*typedef/ || !/^[a-zA-Z\_]/ {
39 next;
42 /^extern[ \t]+[^()]+[;][ \t]*$/ {
43 gsub(/[^ \t]+[ \t]+/, "");
44 sub(/[;][ \t]*$/, "");
45 printf "\t\t%s;\n", $0;
46 next;
49 # look for function headers:
51 gotstart = 0;
52 if ($0 ~ /^[A-Za-z_][A-Za-z0-9_]+/) {
53 gotstart = 1;
55 if(!gotstart) {
56 next;
60 /[_A-Za-z0-9]+[ \t]*[(].*[)][ \t]*;[ \t]*$/ {
61 sub(/[(].*$/, "");
62 gsub(/[^ \t]+[ \t]+/, "");
63 gsub(/^[*]/, "");
64 printf "\t\t%s;\n",$0;
65 next;
68 /[_A-Za-z0-9]+[ \t]*[(]/ {
69 inheader=1;
70 sub(/[(].*$/, "");
71 gsub(/[^ \t]+[ \t]+/, "");
72 gsub(/^[*]/, "");
73 printf "\t\t%s;\n",$0;
74 next;