aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Seebach <peter.seebach@windriver.com>2014-04-21 14:58:05 -0500
committerPeter Seebach <peter.seebach@windriver.com>2014-04-21 16:16:23 -0500
commite10d0b6a04e77793bb07541f10ba5b8d82f7221c (patch)
treea434ae374374a73e0e480daa6916d7f865e5f37c
parent0f50814ea2cd21cd5b849dc551e6e39706ff22c0 (diff)
downloadpseudo-e10d0b6a04e77793bb07541f10ba5b8d82f7221c.tar.gz
pseudo-e10d0b6a04e77793bb07541f10ba5b8d82f7221c.tar.bz2
pseudo-e10d0b6a04e77793bb07541f10ba5b8d82f7221c.zip
Automatic dependency checking for wrappers
Ports can provide pseudo_wrappers.c or portdefs.h, and individual functions have implementations. These dependencies aren't known until post-configure. Make the Makefile include two sub-Makefiles which can be updated by makewrappers. Signed-off-by: Peter Seebach <peter.seebach@windriver.com>
-rw-r--r--.gitignore2
-rw-r--r--Makefile.in9
-rwxr-xr-xconfigure3
-rwxr-xr-xmakewrappers17
-rw-r--r--templates/func_deps4
-rw-r--r--templates/port_deps5
6 files changed, 38 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index c0e9983..5f038ed 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,5 @@ pseudo_tables.h
port_wrappers.c
pseudo_ports.h
templatefile.pyc
+func_deps.mk
+port_deps.mk
diff --git a/Makefile.in b/Makefile.in
index d84d6e4..a1bfe62 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -160,7 +160,9 @@ clean:
pseudo_wrapper_table.c \
pseudo_tables.c pseudo_tables.h \
pseudo_ports.h port_wrappers.c \
- offsets32 offsets64
+ offsets32 offsets64 \
+ port_deps.mk func_deps.mk
+ touch port_deps.mk func_deps.mk
distclean: clean
rm -f Makefile
@@ -183,3 +185,8 @@ tarball:
rmdir pseudo \
)
tar cjf pseudo-$(VERSION).tar.bz2 pseudo-$(VERSION)
+
+# Note when we need to rebuild pseudo_wrappers.o
+include port_deps.mk
+include func_deps.mk
+
diff --git a/configure b/configure
index 80da1d1..592e20b 100755
--- a/configure
+++ b/configure
@@ -229,6 +229,9 @@ else
SQLITE_MEMORY=""
fi
+touch port_deps.mk
+touch func_deps.mk
+
sed -e '
s,@PREFIX@,'"$opt_prefix"',g
s,@LIBDIR@,'"$opt_libdir"',g
diff --git a/makewrappers b/makewrappers
index e87cc56..992737b 100755
--- a/makewrappers
+++ b/makewrappers
@@ -420,6 +420,9 @@ class Function:
pretty += ' (%s)' % self.comments
return pretty
+ def funcdeps(self):
+ return 'pseudo_wrappers.o: ports/%s/guts/%s.c' % ( self.port, self.name )
+
class Port:
"""
A Port is a set of function declarations and code providing
@@ -497,6 +500,17 @@ additional ports to include.
def define(self):
return '#define PSEUDO_PORT_%s 1' % string.upper(self.name).replace('/', '_')
+ def portdeps(self):
+ deps = []
+ if self.wrappers:
+ deps.append(self.wrappers)
+ if self.portdef_file:
+ deps.append(self.portdef_file)
+ if deps:
+ return 'pseudo_wrappers.o: %s' % ' '.join(deps)
+ else:
+ return '# no extra dependencies for %s.' % self.name
+
def portdefs(self):
if self.portdef_file:
return '#include "%s"' % self.portdef_file
@@ -561,7 +575,8 @@ def main():
for path in glob.glob('templates/*'):
try:
source = TemplateFile(path)
- source.emit('copyright')
+ if source.name.endswith('.c') or source.name.endswith('.h'):
+ source.emit('copyright')
source.emit('header')
sources.append(source)
except IOError:
diff --git a/templates/func_deps b/templates/func_deps
new file mode 100644
index 0000000..ace0a2f
--- /dev/null
+++ b/templates/func_deps
@@ -0,0 +1,4 @@
+@name func_deps.mk
+${funcdeps}
+@header
+# Per-function extra dependencies
diff --git a/templates/port_deps b/templates/port_deps
new file mode 100644
index 0000000..8f53db7
--- /dev/null
+++ b/templates/port_deps
@@ -0,0 +1,5 @@
+@name port_deps.mk
+@port
+${portdeps}
+@header
+# port dependencies