Line | |
---|
1 | import type ; |
---|
2 | import generators ; |
---|
3 | import os ; |
---|
4 | import print ; |
---|
5 | |
---|
6 | type.register FOO : foo ; |
---|
7 | |
---|
8 | generators.register-standard foo.foo : FOO : CPP H ; |
---|
9 | |
---|
10 | rule foo ( targets * : sources * : properties * ) |
---|
11 | { |
---|
12 | # On NT, you need an exported symbol in order to have an import lib generated |
---|
13 | if [ os.name ] = NT && <main-target-type>LIB in $(properties) |
---|
14 | { |
---|
15 | .decl = "echo void __declspec(dllexport) foo(){}" ; |
---|
16 | } |
---|
17 | if [ modules.peek : OS ] in CYGWIN && <main-target-type>LIB in $(properties) && $toolset != gcc |
---|
18 | { |
---|
19 | .decl = "echo 'void __declspec(dllexport) foo(){}'" ; |
---|
20 | } |
---|
21 | |
---|
22 | |
---|
23 | .decl1 on $(<) = $(.decl:E="echo //") ; |
---|
24 | |
---|
25 | # Further files must be touched also; NT doesn't have a touch command |
---|
26 | local i = [ print.echo-cmd "#include <z.h>" ] ; |
---|
27 | .decl2 on $(<) = " |
---|
28 | $(i) > " ; |
---|
29 | } |
---|
30 | |
---|
31 | actions foo |
---|
32 | { |
---|
33 | $(.decl1) > $(<[1]) $(.decl2)$(<[2-]) |
---|
34 | } |
---|
35 | |
---|
Note: See
TracBrowser
for help on using the repository browser.