blob: 60796ae9ac33cc336175cd9a06a57fd83e093887 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
#
# makenmake.pl - create a nmake file from a generic manifest file that will create the appropriate U3 structure
# $Id$
#
print "
include ../../../config.nmake
include <win32.mak>
DEVICE = device
HOST = host
MANIFEST= manifest
DATA = data
TOPDIR = ..\\..\\..
COPY = xcopy
MOVE = mv
MKDIR = mkdir
COPY_FLAGS = /d /y
distribution:
";
while($line = <>) {
if($line =~ /^\#/) { # comment
next;
} elsif($line =~ /^\[(\S+)/) { # new directory
$dir = $1;
undef $u3loc;
if($line =~ /u3loc=(\w+)/) {
$u3loc = "\$(" . uc $1 . ")";
}
$dir =~ s/\$INSTDIR?//; # remove $INSTDIR
$dir =~ s/\{/\(/g; $dir =~ s/\}/\)/g; # convert curlies to round brackets
if($dir ne '') {
print "\tif not exist $u3loc$dir \$(MKDIR) $u3loc$dir\n";
}
} else { # this is a file
$line =~ /^\s+(\S+)/;
$file = $1;
$file =~ s/\{/\(/g; $file =~ s/\}/\)/g; # convert curlies to round brackets
if($file =~ /^[^\$]/) {
$file = "\$(TOPDIR)\\" . $file;
}
if($line =~ /ifdef=(\w+)/) { # dependency
if($define ne $1) {
if(defined $define) {
print "!ENDIF\n";
}
$define = $1;
print "!IF DEFINED($define)\n";
}
} else {
if(defined $define) {
print "!ENDIF\n";
}
undef $define;
}
$u3fileloc = $u3loc; # default location
$oname = "";
if($line =~ /u3loc=(\S+)/) { # override this location
$u3fileloc = "\$(" . uc $1 . ")";
}
print "\t\$(COPY) $file $u3fileloc$dir \$(COPY_FLAGS)\n";
if($line =~ /oname=(\S+)/) { # override this filename
$oname = $1;
$file =~ /\\(.*)$/;
$name = $1;
print "\t\$(MOVE) $u3fileloc$dir\\$name $u3fileloc$dir\\$oname\n";
}
}
}
|