apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aa...@apache.org
Subject cvs commit: apr/build make_exports.awk make_var_export.awk make_export.awk
Date Mon, 15 Oct 2001 22:56:55 GMT
aaron       01/10/15 15:56:55

  Modified:    .        .cvsignore Makefile.in
  Added:       build    make_exports.awk make_var_export.awk
  Removed:     build    make_export.awk
  Log:
  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
  
  Revision  Changes    Path
  1.10      +3 -1      apr/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  RCS file: /home/cvs/apr/.cvsignore,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- .cvsignore	2001/08/17 07:30:59	1.9
  +++ .cvsignore	2001/10/15 22:56:55	1.10
  @@ -12,7 +12,9 @@
   Release
   *.opt
   *.plg
  -apr.exports
  +apr.exp
  +exports.c
  +export_vars.h
   .libs
   *.la
   libapr.rc
  
  
  
  1.57      +24 -12    apr/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/apr/Makefile.in,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- Makefile.in	2001/10/11 22:17:34	1.56
  +++ Makefile.in	2001/10/15 22:56:55	1.57
  @@ -17,22 +17,22 @@
   INSTALL_SUBDIRS=@INSTALL_SUBDIRS@
   
   TARGET_LIB = libapr.la
  -TARGET_EXPORTS = apr.exports
   
   #
   # Rules for building specific targets, starting with 'all' for
   # building the entire package.
   #
  -TARGETS = delete-lib $(TARGET_LIB) delete-exports $(TARGET_EXPORTS)
  +TARGETS = delete-lib $(TARGET_LIB) delete-exports export_vars.h apr.exp
   
   # bring in rules.mk for standard functionality
   @INCLUDE_RULES@
   
  -CLEAN_TARGETS = $(TARGET_EXPORTS)
  +CLEAN_TARGETS = 
   DISTCLEAN_TARGETS = config.cache config.log config.status \
   	include/apr.h include/arch/unix/apr_private.h \
  -	APRVARS libtool
  -EXTRACLEAN_TARGETS = configure aclocal.m4 include/arch/unix/apr_private.h.in
  +	APRVARS libtool apr.exp
  +EXTRACLEAN_TARGETS = configure aclocal.m4 include/arch/unix/apr_private.h.in \
  +	exports.c export_vars.h
   
   prefix=@prefix@
   exec_prefix=@exec_prefix@
  @@ -41,6 +41,8 @@
   srcdir=@srcdir@
   top_srcdir=@top_srcdir@
   
  +EXPORT_FILES = $(top_srcdir)/include/*.h
  +
   delete-lib:
   	@if test -f $(TARGET_LIB); then \
   	    for i in $(SUBDIRS); do objects="$$objects $$i/*.@so_ext@"; done ; \
  @@ -72,17 +74,27 @@
   	    $(LINK) @lib_target@
   
   delete-exports:
  -	@if test -f $(TARGET_EXPORTS); then \
  -	    headers="`find include/*.h -newer $(TARGET_EXPORTS)`" ; \
  +	@if test -f apr.exp; then \
  +	    headers="`find include/*.h -newer apr.exp`" ; \
   	    if test -n "$$headers"; then \
  -		echo Found newer headers. Will rebuild $(TARGET_EXPORTS). ; \
  -		echo $(RM) -f $(TARGET_EXPORTS) ; \
  -		$(RM) -f $(TARGET_EXPORTS) ; \
  +		echo Found newer headers. Will rebuild apr.exp. ; \
  +		echo $(RM) -f apr.exp ; \
  +		$(RM) -f apr.exp ; \
   	    fi \
   	fi
  +
  +exports.c:
  +	$(AWK) -f $(top_srcdir)/build/make_exports.awk $(EXPORT_FILES) > $@
  +
  +export_vars.h:
  +	$(AWK) -f $(top_srcdir)/build/make_var_export.awk $(EXPORT_FILES) > $@
   
  -$(TARGET_EXPORTS):
  -	$(MKEXPORT) $(top_srcdir)/include/*.h > $@
  +apr.exp: exports.c export_vars.h
  +	@echo "#! ." > $@
  +	@echo "* This file was AUTOGENERATED at build time." >> $@
  +	@echo "* Please do not edit by hand." >> $@
  +	$(CPP) $(ALL_CPPFLAGS) $(ALL_INCLUDES) exports.c | grep "ap_hack_" | sed -e 's/^.*[)]\(.*\);$$/\1/'
>> $@
  +	$(CPP) $(ALL_CPPFLAGS) $(ALL_INCLUDES) export_vars.h | sed -e 's/^\#[^!]*//' | sed -e
'/^$$/d' >> $@
   
   dox:
   	doxygen $(top_srcdir)/docs/doxygen.conf
  
  
  
  1.1                  apr/build/make_exports.awk
  
  Index: make_exports.awk
  ===================================================================
  
  BEGIN {
      printf("/*\n")
      printf(" * THIS FILE WAS AUTOGENERATED BY make_exports.awk\n")
      printf(" *\n")
      printf(" * This is an ugly hack that needs to be here, so\n")
      printf(" * that libtool will link all of the APR functions\n")
      printf(" * into server regardless of whether the base server\n")
      printf(" * uses them.\n")
      printf(" */\n")
      printf("\n")
      printf("#define CORE_PRIVATE\n")
      printf("\n")
      
      for (i = 1; i < ARGC; i++) {
          file = ARGV[i]
          sub("([^/]*[/])*", "", file)
          printf("#include \"%s\"\n", file)
      }
  
      printf("\n")
      printf("const void *ap_ugly_hack = NULL;\n")
      printf("\n")
      
      TYPE_NORMAL = 0
      TYPE_HEADER = 1
  
      stackptr = 0
  }
  
  function push(line) {
      stack[stackptr] = line
      stackptr++
  }
  
  function do_output() {
      printf("/*\n")
      printf(" * %s\n", FILENAME)
      printf(" */\n")
      
      for (i = 0; i < stackptr; i++) {
          printf("%s\n", stack[i])
      }
      
      stackptr = 0
  
      printf("\n");
  }
  
  function enter_scope(type) {
      scope++
      scope_type[scope] = type
      scope_stack[scope] = stackptr
      delete scope_used[scope]
  }
  
  function leave_scope() {
      used = scope_used[scope]
     
      if (!used)
          stackptr = scope_stack[scope]
  
      scope--
      if (used) {
          scope_used[scope] = 1
          
          if (!scope)
              do_output()
      }
  }
  
  function add_symbol(symbol) {
      if (!index(symbol, "#")) {
          push("const void *ap_hack_" symbol " = (const void *)" symbol ";")
          scope_used[scope] = 1
      }
  }
  
  /^[ \t]*AP[RU]?_DECLARE[^(]*[(][^)]*[)]([^ ]* )*[^(]+[(]/ {
      sub("[ \t]*AP[RU]?_DECLARE[^(]*[(][^)]*[)][ \t]*", "")
      sub("[(].*", "")
      sub("([^ ]* (^([ \t]*[(])))+", "")
  
      add_symbol($0)
      next
  }
  
  /^[ \t]*AP_DECLARE_HOOK[^(]*[(][^)]*[)]/ {
      split($0, args, ",")
      symbol = args[2]
      sub("^[ \t]+", "", symbol)
      sub("[ \t]+$", "", symbol)
  
      add_symbol("ap_hook_" symbol)
      add_symbol("ap_hook_get_" symbol)
      add_symbol("ap_run_" symbol)
      next
  }
  
  /^#[ \t]*if(ndef| !defined[(])([^_]*_)*H/ {
      enter_scope(TYPE_HEADER)
      next
  }
  
  /^#[ \t]*if([n]?def)? / {
      enter_scope(TYPE_NORMAL)
      push($0)
      next
  }
  
  /^#[ \t]*endif/ {
      if (scope_type[scope] == TYPE_NORMAL)
          push($0)
          
      leave_scope()
      next
  }
  
  /^#[ \t]*else/ {
      push($0)
      next
  }
  
  /^#[ \t]*elif/ {
      push($0)
      next
  }
  
  
  
  
  
  1.1                  apr/build/make_var_export.awk
  
  Index: make_var_export.awk
  ===================================================================
  # 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)
  }
  
  
  

Mime
View raw message