1 | %%%--------------------------------- |
---|
2 | %%%------ demoA -------------------- |
---|
3 | %%%--------------------------------- |
---|
4 | %%package demoA |
---|
5 | |
---|
6 | branches classes demoA |
---|
7 | |
---|
8 | application demoA demoA.cxx foo=bar |
---|
9 | application A A.java |
---|
10 | |
---|
11 | pattern -global multi macro m1 "" Linux m1linux alpha m1alpha ; macro m2 m2 |
---|
12 | |
---|
13 | macro m3 m3 |
---|
14 | |
---|
15 | make_fragment rename -header=rename_header |
---|
16 | |
---|
17 | document rename XXX OFFSET=XXX demoA.cxx |
---|
18 | |
---|
19 | application XXXdemoA -check -group=X XXXdemoA.cxx |
---|
20 | |
---|
21 | include_path $(demoA_root) |
---|
22 | |
---|
23 | setup_script init |
---|
24 | |
---|
25 | %%%--------------------------------- |
---|
26 | %%file cmt/init.bat |
---|
27 | |
---|
28 | echo "doing A init" |
---|
29 | |
---|
30 | %%%--------------------------------- |
---|
31 | %%file cmt/init.csh |
---|
32 | |
---|
33 | echo "doing A init" |
---|
34 | |
---|
35 | %%%--------------------------------- |
---|
36 | %%file cmt/init.sh |
---|
37 | |
---|
38 | echo "doing A init" |
---|
39 | |
---|
40 | %%%--------------------------------- |
---|
41 | %%file src/demoA.cxx |
---|
42 | #include <stdio.h> |
---|
43 | |
---|
44 | int main () |
---|
45 | { |
---|
46 | //xxx |
---|
47 | printf ("demoA\n"); |
---|
48 | |
---|
49 | return (0); |
---|
50 | } |
---|
51 | |
---|
52 | %%%--------------------------------- |
---|
53 | %%file demoA/demoA.h |
---|
54 | |
---|
55 | #define demoA 123 |
---|
56 | |
---|
57 | %%%--------------------------------- |
---|
58 | %%file src/A.java |
---|
59 | |
---|
60 | public class A |
---|
61 | { |
---|
62 | public static void main (String arg[]) |
---|
63 | { |
---|
64 | System.out.println ("A"); |
---|
65 | } |
---|
66 | } |
---|
67 | |
---|
68 | %%%--------------------------------- |
---|
69 | %%file cmt/fragments/rename |
---|
70 | |
---|
71 | ## ${SUFFIX} |
---|
72 | |
---|
73 | ${CONSTITUENT} :: ${FILEPATH}${OFFSET}${NAME}${FILESUFFIX} |
---|
74 | |
---|
75 | |
---|
76 | ${FILEPATH}${OFFSET}${NAME}${FILESUFFIX} : ${FULLNAME} |
---|
77 | cp $? $@ |
---|
78 | |
---|
79 | clean:: |
---|
80 | /bin/rm -f ${FILEPATH}${OFFSET}${NAME}${FILESUFFIX} |
---|
81 | |
---|
82 | %%%--------------------------------- |
---|
83 | %%file cmt/fragments/rename_header |
---|
84 | |
---|
85 | %%%--------------------------------- |
---|
86 | %%file cmt/fragments/nmake/rename |
---|
87 | |
---|
88 | ## ${SUFFIX} |
---|
89 | |
---|
90 | ${CONSTITUENT} :: ${FILEPATH}${OFFSET}${NAME}${FILESUFFIX} |
---|
91 | |
---|
92 | ${FILEPATH}${OFFSET}${NAME}${FILESUFFIX} : ${FULLNAME} |
---|
93 | copy $? $@ |
---|
94 | |
---|
95 | clean:: |
---|
96 | del ${FILEPATH}${OFFSET}${NAME}${FILESUFFIX} |
---|
97 | |
---|
98 | %%%--------------------------------- |
---|
99 | %%file cmt/fragments/nmake/rename_header |
---|
100 | |
---|
101 | %%%--------------------------------- |
---|
102 | %%%------ demoB -------------------- |
---|
103 | %%%--------------------------------- |
---|
104 | %%package demoB |
---|
105 | package demoB |
---|
106 | |
---|
107 | use demoA |
---|
108 | |
---|
109 | application demoB -check demoB.cxx |
---|
110 | |
---|
111 | #application B B.java |
---|
112 | |
---|
113 | set before_init "before_init" |
---|
114 | |
---|
115 | setup_script init |
---|
116 | |
---|
117 | set after_init "after_init" |
---|
118 | |
---|
119 | %%file cmt/init.bat |
---|
120 | |
---|
121 | echo "doing B init" |
---|
122 | |
---|
123 | %%file cmt/init.csh |
---|
124 | |
---|
125 | echo "doing B init" |
---|
126 | |
---|
127 | %%file cmt/init.sh |
---|
128 | |
---|
129 | echo "doing B init" |
---|
130 | |
---|
131 | %%file src/demoB.cxx |
---|
132 | #include <stdio.h> |
---|
133 | |
---|
134 | #include <demoA/demoA.h> |
---|
135 | |
---|
136 | int main () |
---|
137 | { |
---|
138 | printf ("demoB demoA=%d\n", demoA); |
---|
139 | |
---|
140 | return (0); |
---|
141 | } |
---|
142 | |
---|
143 | %%file src/B.java |
---|
144 | |
---|
145 | public class B |
---|
146 | { |
---|
147 | public static void main (String arg[]) |
---|
148 | { |
---|
149 | System.out.println ("B"); |
---|
150 | } |
---|
151 | } |
---|
152 | |
---|
153 | %%%--------------------------------- |
---|
154 | %%%------ demoC -------------------- |
---|
155 | %%%--------------------------------- |
---|
156 | %%package demoC |
---|
157 | package demoC |
---|
158 | |
---|
159 | build_strategy rebuild_makefiles |
---|
160 | |
---|
161 | include_path ../demoC |
---|
162 | |
---|
163 | branches demoC |
---|
164 | |
---|
165 | library C C*.cxx |
---|
166 | |
---|
167 | macro demoC_linkopts "-L$(DEMOCROOT)/$(demoC_tag) -lC" \ |
---|
168 | WIN32 "" |
---|
169 | |
---|
170 | application demoC -check demoC.cxx |
---|
171 | |
---|
172 | path_append LD_LIBRARY_PATH "" \ |
---|
173 | Linux "../$(demoC_tag)" |
---|
174 | |
---|
175 | |
---|
176 | %%file src/demoC.cxx |
---|
177 | #include <stdio.h> |
---|
178 | |
---|
179 | typedef void (*Procedure) (); |
---|
180 | |
---|
181 | #ifdef WIN32 |
---|
182 | #include <windows.h> |
---|
183 | |
---|
184 | Procedure get_proc (const char* name) |
---|
185 | { |
---|
186 | void* f = ::LoadLibrary ("..\\Win32Debug\\C.dll"); |
---|
187 | |
---|
188 | if (f == 0) |
---|
189 | { |
---|
190 | f = ::LoadLibrary ("..\\VisualC\\C.dll"); |
---|
191 | } |
---|
192 | |
---|
193 | if (f == 0) |
---|
194 | { |
---|
195 | printf ("Cannot load the library\n"); |
---|
196 | exit (0); |
---|
197 | } |
---|
198 | |
---|
199 | Procedure p; |
---|
200 | |
---|
201 | p = (Procedure)::GetProcAddress ((HMODULE) f, name); |
---|
202 | if (p == 0) |
---|
203 | { |
---|
204 | char* s = new char[strlen(name) + 2]; |
---|
205 | s[0] = '_'; |
---|
206 | strcpy (s+1, name); |
---|
207 | p = (Procedure)::GetProcAddress((HMODULE) f, s); |
---|
208 | } |
---|
209 | |
---|
210 | if (p == 0) |
---|
211 | { |
---|
212 | printf ("Cannot get the module %s\n", name); |
---|
213 | exit (0); |
---|
214 | } |
---|
215 | |
---|
216 | return (p); |
---|
217 | } |
---|
218 | #else |
---|
219 | extern "C" { |
---|
220 | void C1 (); |
---|
221 | void C2 (); |
---|
222 | void C3 (); |
---|
223 | } |
---|
224 | #endif |
---|
225 | |
---|
226 | int main () |
---|
227 | { |
---|
228 | printf ("demoC\n"); |
---|
229 | |
---|
230 | #ifdef WIN32 |
---|
231 | |
---|
232 | Procedure c = 0; |
---|
233 | |
---|
234 | c = get_proc ("C1"); |
---|
235 | c (); |
---|
236 | c = get_proc ("C2"); |
---|
237 | c (); |
---|
238 | c = get_proc ("C3"); |
---|
239 | c (); |
---|
240 | #else |
---|
241 | C1 (); |
---|
242 | C2 (); |
---|
243 | C3 (); |
---|
244 | #endif |
---|
245 | |
---|
246 | return (0); |
---|
247 | } |
---|
248 | |
---|
249 | %%file src/C1.cxx |
---|
250 | #include <stdio.h> |
---|
251 | |
---|
252 | extern "C" { |
---|
253 | void C1 (); |
---|
254 | } |
---|
255 | |
---|
256 | void C1 () |
---|
257 | { |
---|
258 | printf ("C1\n"); |
---|
259 | } |
---|
260 | |
---|
261 | %%file src/C2.cxx |
---|
262 | #include <stdio.h> |
---|
263 | |
---|
264 | extern "C" { |
---|
265 | void C2 (); |
---|
266 | } |
---|
267 | |
---|
268 | void C2 () |
---|
269 | { |
---|
270 | printf ("C2\n"); |
---|
271 | } |
---|
272 | |
---|
273 | %%file src/C3.cxx |
---|
274 | #include <stdio.h> |
---|
275 | |
---|
276 | extern "C" { |
---|
277 | void C3 (); |
---|
278 | } |
---|
279 | |
---|
280 | void C3 () |
---|
281 | { |
---|
282 | printf ("C3\n"); |
---|
283 | } |
---|
284 | |
---|
285 | %%%--------------------------------- |
---|
286 | %%%------ Actions ------------------ |
---|
287 | %%%--------------------------------- |
---|
288 | %%cdpackage demoA |
---|
289 | %%cmt run "gmake all_groups" |
---|
290 | %%%cmt run "gmake check" |
---|
291 | %%cdpackage demoB |
---|
292 | %%%cmt run "gmake all" |
---|
293 | %%%cmt run "gmake check" |
---|
294 | %%cdpackage demoC |
---|
295 | %%%cmt run "cmt config" |
---|
296 | %%%cmt run ". setup.sh ; gmake QUIET=1 all check" |
---|