summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
Diffstat (limited to 'build')
-rw-r--r--build/Makefile.in12
-rw-r--r--build/apr_rules.mk.in21
-rwxr-xr-xbuild/gen-build.py100
3 files changed, 114 insertions, 19 deletions
diff --git a/build/Makefile.in b/build/Makefile.in
deleted file mode 100644
index c05665a19..000000000
--- a/build/Makefile.in
+++ /dev/null
@@ -1,12 +0,0 @@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-TARGETS=
-INCLUDES=
-DISTCLEAN_TARGETS = apr_rules.mk
-EXTRACLEAN_TARGETS = ltcf-c.sh ltmain.sh libtool.m4
-
-# bring in rules.mk for standard functionality
-@INCLUDE_RULES@
-
-# DO NOT REMOVE
diff --git a/build/apr_rules.mk.in b/build/apr_rules.mk.in
index a23738738..392efa141 100644
--- a/build/apr_rules.mk.in
+++ b/build/apr_rules.mk.in
@@ -140,9 +140,9 @@ install: all-recursive
all-recursive depend-recursive:
@otarget=`echo $@ | sed s/-recursive//`; \
- list='$(SUBDIRS)'; \
+ list='$(SOURCE_DIRS)'; \
for i in $$list; do \
- if test -d "$$i"; then \
+ if test -f "$$i/Makefile"; then \
target="$$otarget"; \
echo "Making $$target in $$i"; \
if test "$$i" = "."; then \
@@ -161,9 +161,9 @@ all-recursive depend-recursive:
clean-recursive distclean-recursive extraclean-recursive:
@otarget=`echo $@ | sed s/-recursive//`; \
- list='$(SUBDIRS) $(CLEAN_SUBDIRS)'; \
+ list='$(CLEAN_SUBDIRS)'; \
for i in $$list; do \
- if test -d "$$i"; then \
+ if test -f "$$i/Makefile"; then \
target="$$otarget"; \
echo "Making $$target in $$i"; \
if test "$$i" = "."; then \
@@ -182,10 +182,17 @@ clean-recursive distclean-recursive extraclean-recursive:
# autoconf 2.5x is creating a 'autom4te.cache' directory
# In case someone ran autoconf by hand, get rid of that directory
-# aswell.
+# as well.
local-clean: x-local-clean
- $(RM) -f *.o *.lo *.a *.la *.so *.obj $(CLEAN_TARGETS) $(PROGRAMS)
- $(RM) -rf .libs autom4te.cache
+ @list='. $(SOURCE_DIRS)'; \
+ for i in $$list; do \
+ echo $(RM) -f $$i/*.o $$i/*.lo $$i/*.a $$i/*.la $$i/*.so $$i/*.obj; \
+ $(RM) -f $$i/*.o $$i/*.lo $$i/*.a $$i/*.la $$i/*.so $$i/*.obj; \
+ echo $(RM) -rf $$i/.libs; \
+ $(RM) -rf $$i/.libs; \
+ done
+ $(RM) -f $(CLEAN_TARGETS) $(PROGRAMS)
+ $(RM) -rf autom4te.cache
local-distclean: local-clean x-local-distclean
$(RM) -f Makefile $(DISTCLEAN_TARGETS)
diff --git a/build/gen-build.py b/build/gen-build.py
new file mode 100755
index 000000000..6c6b07471
--- /dev/null
+++ b/build/gen-build.py
@@ -0,0 +1,100 @@
+#!/usr/bin/env python
+#
+# USAGE: gen-build.py TYPE
+#
+# where TYPE is one of: make, dsp, vcproj
+#
+# It reads build.conf from the current directory, and produces its output
+# into the current directory.
+#
+
+
+import os
+import ConfigParser
+import getopt
+import string
+import glob
+import re
+
+#import ezt
+
+
+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
+ legal_deps = map(os.path.basename, headers)
+ h_deps = { }
+ for fname in headers:
+ h_deps[os.path.basename(fname)] = extract_deps(fname, legal_deps)
+ resolve_deps(h_deps)
+
+ 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)
+
+ 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 %s\n' % (obj, file, string.join(deps.keys(), ' ')))
+
+ f.write('\nOBJECTS = %s\n\n' % string.join(objects))
+ f.write('HEADERS = %s\n\n' % string.join(headers))
+ f.write('SOURCE_DIRS = %s\n\n' % string.join(dirs.keys()))
+
+
+def extract_deps(fname, legal_deps):
+ "Extract the headers this file includes."
+ deps = { }
+ for line in open(fname).readlines():
+ if line[:8] != '#include':
+ continue
+ inc = _re_include.match(line).group(1)
+ if inc in legal_deps:
+ deps[inc] = None
+ return deps
+_re_include = re.compile('#include *["<](.*)[">]')
+
+
+def resolve_deps(header_deps):
+ "Alter the provided dictionary to flatten includes-of-includes."
+ altered = 1
+ while altered:
+ altered = 0
+ for hdr, deps in header_deps.items():
+ print hdr, deps
+ start = len(deps)
+ for dep in deps.keys():
+ deps.update(header_deps.get(dep, {}))
+ if len(deps) != start:
+ altered = 1
+
+
+def get_files(patterns):
+ patterns = string.replace(patterns, '{platform}', get_platform())
+ patterns = string.split(string.strip(patterns))
+ files = [ ]
+ for pat in patterns:
+ files.extend(glob.glob(pat))
+ return files
+
+def get_platform():
+ return 'unix'
+
+
+if __name__ == '__main__':
+ main()