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