apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gst...@apache.org
Subject cvs commit: apr/build apr_rules.mk.in gen-build.py
Date Sat, 21 Feb 2004 00:31:49 GMT
gstein      2004/02/20 16:31:49

  Modified:    .        build.conf configure.in
               build    apr_rules.mk.in gen-build.py
  Log:
  Fix the generation of the build-outputs.mk file. That file must remain
  platform independent since it gets included with the tarball, and the
  tarball is targeted for all platforms.
  
  In this new scheme, the build-outputs.mk includes symbols named
  OBJECTS_<plat> which specifies the necessary object files for each platform.
  The apr_rules.mk(.in) file then pulls in the right symbol for the configured
  platform. Since apr-util directly uses apr_rules.mk, then it picks up the
  same logic with no change.
  
  The build.conf was altered to include a set of platform-independent files,
  and subdirectories which contain per-platform subdirectories. This was
  needed to help out the logic which selects object files based on whether a
  platform is present in each source subdir. (and if a platform subdir is not
  present, then "parent" gets used instead; e.g. use 'unix' if 'beos' is not
  in the subdir)
  
  Lastly, configure.in was updated to select the appropriate set of objects
  for the build.
  
  * build.conf:
    (paths): remove per-platform symbols
    (platform_dirs): new option to list the dirs which have platform subdirs
  
  * configure.in:
    - define and substitute OBJECTS_PLATFORM to reference the platform
      specific set of objects, which get defined in build-outputs.mk
  
  * build/apr_rules.mk.in:
    - define OBJECTS in terms of the substituted OBJECTS_PLATFORM symbol
  
  * build/gen-build.py:
    (PLATFORMS): the various platforms found in APR. unused, actually.
    (MAKE_PLATFORMS): the platforms which use a Makefile, and what default
      platform should be used if SUBDIR/<platform> is not present.
    (main): update logic to generate multiple OBJECTS_* symbols. this now
      includes logic to deal with subdirs which may not have a platform subdir
      for the platform in question, thus needing to default to another.
    (write_objects): some code factored out of main() to process a list of
      source files into dependencies lines in the makefile.
    (get_files): no more need to substitute for {platform}, and simplified
      some of the .split() stuff.
    (get_platform): no longer required. we generate for all platforms.
  
  Revision  Changes    Path
  1.2       +8 -15     apr/build.conf
  
  Index: build.conf
  ===================================================================
  RCS file: /home/cvs/apr/build.conf,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -u -r1.1 -r1.2
  --- build.conf	5 Feb 2004 10:16:20 -0000	1.1
  +++ build.conf	21 Feb 2004 00:31:48 -0000	1.2
  @@ -4,26 +4,19 @@
   
   [options]
   
  +# paths to platform-independent .c files to build
   paths =
  -  atomic/{platform}/*.c
  -  dso/{platform}/*.c
  -  file_io/{platform}/*.c
  -  locks/{platform}/*.c
  -  memory/{platform}/*.c
  -  misc/{platform}/*.c
  -  mmap/{platform}/*.c
  -  network_io/{platform}/*.c
     passwd/*.c
  -  poll/{platform}/*.c
  -  random/{platform}/*.c
  -  shmem/{platform}/*.c
     strings/*.c
  -  support/{platform}/*.c
     tables/*.c
  -  threadproc/{platform}/*.c
  -  time/{platform}/*.c
  -  user/{platform}/*.c
   
  +# directories that have platform-specific code in them. the resulting
  +# pattern will be: SUBDIR/PLATFORM/*.c
  +platform_dirs =
  +  atomic dso file_io locks memory misc mmap network_io poll random
  +  shmem support threadproc time user
  +
  +# all the public headers
   headers = include/*.h
   
   # aplibtool is manually built by the configure process
  
  
  
  1.571     +8 -0      apr/configure.in
  
  Index: configure.in
  ===================================================================
  RCS file: /home/cvs/apr/configure.in,v
  retrieving revision 1.570
  retrieving revision 1.571
  diff -u -u -r1.570 -r1.571
  --- configure.in	18 Feb 2004 10:39:09 -0000	1.570
  +++ configure.in	21 Feb 2004 00:31:48 -0000	1.571
  @@ -349,11 +349,14 @@
   
   config_subdirs="none"
   INSTALL_SUBDIRS="none"
  +OBJECTS_PLATFORM='$(OBJECTS_unix)'
  +
   case $host in
      i386-ibm-aix* | *-ibm-aix[1-2].* | *-ibm-aix3.* | *-ibm-aix4.1 | *-ibm-aix4.1.* | *-ibm-aix4.2
| *-ibm-aix4.2.*)
          OSDIR="aix"
          APR_ADDTO(LDFLAGS,-lld)
          eolstr="\\n"
  +       OBJECTS_PLATFORM='$(OBJECTS_aix)'
          ;;
      *-os2*)
          APR_ADDTO(CPPFLAGS,-DOS2)
  @@ -364,6 +367,7 @@
          eolstr="\\r\\n"
          file_as_socket="0"
          proc_mutex_is_global=1
  +       OBJECTS_PLATFORM='$(OBJECTS_os2)'
          ;;
      *beos*)
          OSDIR="beos"
  @@ -374,6 +378,7 @@
          eolstr="\\n"
          osver=`uname -r`
          proc_mutex_is_global=1
  +       OBJECTS_PLATFORM='$(OBJECTS_beos)'
          case $osver in
             5.0.4)
                file_as_socket="1"
  @@ -385,6 +390,7 @@
          ;;
      *os390)
          OSDIR="os390"
  +       OBJECTS_PLATFORM='$(OBJECTS_os390)'
          eolstr="\\n"
          ;;
      *os400)
  @@ -407,6 +413,8 @@
          eolstr="\\n"
          ;;
   esac
  +
  +AC_SUBST(OBJECTS_PLATFORM)
   
   AC_ARG_ENABLE(nonportable-atomics,
   [  --enable-nonportable-atomics  Use optimized atomic code which may produce nonportable
binaries],
  
  
  
  1.3       +6 -0      apr/build/apr_rules.mk.in
  
  Index: apr_rules.mk.in
  ===================================================================
  RCS file: /home/cvs/apr/build/apr_rules.mk.in,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -u -r1.2 -r1.3
  --- apr_rules.mk.in	5 Feb 2004 10:16:21 -0000	1.2
  +++ apr_rules.mk.in	21 Feb 2004 00:31:49 -0000	1.3
  @@ -115,6 +115,12 @@
   LTFLAGS      = @LTFLAGS@
   LT_LDFLAGS   = @LT_LDFLAGS@
   
  +# The set of object files that will be linked into the target library.
  +# The build-outputs.mk specifies a different set for each platform. The
  +# configure script will select the appropriate set.
  +#
  +OBJECTS      = @OBJECTS_PLATFORM@
  +
   #
   # Basic macro setup
   #
  
  
  
  1.9       +73 -20    apr/build/gen-build.py
  
  Index: gen-build.py
  ===================================================================
  RCS file: /home/cvs/apr/build/gen-build.py,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -u -r1.8 -r1.9
  --- gen-build.py	15 Feb 2004 21:06:33 -0000	1.8
  +++ gen-build.py	21 Feb 2004 00:31:49 -0000	1.9
  @@ -18,13 +18,26 @@
   
   #import ezt
   
  +#
  +# legal platforms: aix, beos, netware, os2, os390, unix, win32
  +# 'make' users: aix, beos, os2, os390, unix
  +#
  +PLATFORMS = [ 'aix', 'beos', 'netware', 'os2', 'os390', 'unix', 'win32' ]
  +MAKE_PLATFORMS = [
  +  ('unix', None),
  +  ('aix', 'unix'),
  +  ('beos', 'unix'),
  +  ('os2', 'unix'),
  +  ('os390', 'unix'),
  +  ]
  +# note: MAKE_PLATFORMS is an ordered set. we want to generate unix symbols
  +#       first, so that the later platforms can reference them.
  +
   
   def main():
     parser = ConfigParser.ConfigParser()
     parser.read('build.conf')
   
  -  dirs = { }
  -  files = get_files(parser.get('options', 'paths'))
     headers = get_files(parser.get('options', 'headers'))
   
     # compute the relevant headers, along with the implied includes
  @@ -40,22 +53,45 @@
     f = open('build-outputs.mk', 'w')
     f.write('# DO NOT EDIT. AUTOMATICALLY GENERATED.\n\n')
   
  -  objects = [ ]
  -  for file in files:
  -    assert file[-2:] == '.c'
  -    obj = file[:-2] + '.lo'
  -    objects.append(obj)
  +  # write out the platform-independent files
  +  files = get_files(parser.get('options', 'paths'))
  +  objects, dirs = write_objects(f, legal_deps, h_deps, files)
  +  f.write('\nOBJECTS_all = %s\n\n' % string.join(objects))
   
  -    dirs[os.path.dirname(file)] = None
  +  # for each platform and each subdirectory holding platform-specific files,
  +  # write out their compilation rules, and an OBJECT_<subdir>_<plat> symbol.
  +  for platform, parent in MAKE_PLATFORMS:
  +
  +    # record the object symbols to build for each platform
  +    group = [ '$(OBJECTS_all)' ]
  +
  +    for subdir in string.split(parser.get('options', 'platform_dirs')):
  +      path = '%s/%s' % (subdir, platform)
  +      if not os.path.exists(path):
  +        # this subdir doesn't have a subdir for this platform, so we'll
  +        # use the parent-platform's set of symbols
  +        if parent:
  +          group.append('$(OBJECTS_%s_%s)' % (subdir, parent))
  +        continue
  +
  +      # remember that this directory has files/objects
  +      dirs[path] = None
  +
  +      # write out the compilation lines for this subdir
  +      files = get_files(path + '/*.c')
  +      objects, _unused = write_objects(f, legal_deps, h_deps, files)
  +
  +      symname = 'OBJECTS_%s_%s' % (subdir, platform)
   
  -    # what headers does this file include, along with the implied headers
  -    deps = extract_deps(file, legal_deps)
  -    for hdr in deps.keys():
  -      deps.update(h_deps.get(hdr, {}))
  +      # and write the symbol for the whole group
  +      f.write('\n%s = %s\n\n' % (symname, string.join(objects)))
   
  -    f.write('%s: %s .make.dirs %s\n' % (obj, file, string.join(deps.values())))
  +      # and include that symbol in the group
  +      group.append('$(%s)' % symname)
  +
  +    # write out a symbol which contains the necessary files
  +    f.write('OBJECTS_%s = %s\n\n' % (platform, string.join(group)))
   
  -  f.write('\nOBJECTS = %s\n\n' % string.join(objects))
     f.write('HEADERS = $(top_srcdir)/%s\n\n' % string.join(headers, ' $(top_srcdir)/'))
     f.write('SOURCE_DIRS = %s $(EXTRA_SOURCE_DIRS)\n\n' % string.join(dirs.keys()))
   
  @@ -76,6 +112,28 @@
             '\t@for d in $(BUILD_DIRS); do test -d $$d || mkdir $$d; done\n' \
             '\t@echo timestamp > $@\n')
   
  +
  +def write_objects(f, legal_deps, h_deps, files):
  +  dirs = { }
  +  objects = [ ]
  +
  +  for file in files:
  +    assert file[-2:] == '.c'
  +    obj = file[:-2] + '.lo'
  +    objects.append(obj)
  +
  +    dirs[os.path.dirname(file)] = None
  +
  +    # what headers does this file include, along with the implied headers
  +    deps = extract_deps(file, legal_deps)
  +    for hdr in deps.keys():
  +      deps.update(h_deps.get(hdr, {}))
  +
  +    f.write('%s: %s .make.dirs %s\n' % (obj, file, string.join(deps.values())))
  +
  +  return objects, dirs
  +
  +
   def extract_deps(fname, legal_deps):
     "Extract the headers this file includes."
     deps = { }
  @@ -104,15 +162,10 @@
   
   
   def get_files(patterns):
  -  patterns = string.replace(patterns, '{platform}', get_platform())
  -  patterns = string.split(string.strip(patterns))
     files = [ ]
  -  for pat in patterns:
  +  for pat in string.split(patterns):
       files.extend(glob.glob(pat))
     return files
  -
  -def get_platform():
  -  return 'unix'
   
   
   if __name__ == '__main__':
  
  
  

Mime
View raw message