2 * {automake|configure
} => {nmake|iffe
} conversion support
4 * The first command line target overrides the default original source
5 * directory name
$(MAKEFILE
:D
). The hard work is in the makefile using
6 * these assertions
, since it must
(manually
) provide the nmake makefiles
7 * and config equivalent iffe scripts. The conversion makefile is typically
8 * named lib
/package
/PACKAGE.cvt in an ast package
$PACKAGEROOT directory
,
9 * and the conversion is run from the
$PACKAGEROOT directory
, e.g.
:
11 * nmake
-I lib
/package
-f PACKAGE-VERSION
/PACKAGE.cvt
13 * The conversion requires the ast nmake
, pax and tw commands.
15 * After the conversion you will be liberated from .
/configure
, *.in
,
16 * *.am
, automake
, autom4te
, libtool
, make depend
, and makefile
17 * recursion ordering. You can build from
$PACKAGEROOT using the ast
18 * package
(1) (which sets up the
{ HOSTTYPE PATH VPATH
} environment
):
22 * or cd into any arch
/$HOSTTYPE/src subdirectory and rebuild that portion
23 * of the hierarchy with the ast nmake
(1) (after setting PATH and VPATH
):
27 * The conversion assertions are
:
29 * package
:CONVERT
: file ...
31 * files in the original source directory are copied
32 * and converted into the .
/src and .
/lib subdirectories
33 * the default original source directory is .
/original
35 * package package name
36 * file original source file that must exist
40 * files matching pattern are not copied into the converted
43 * pattern ksh pattern of files to omit
45 * :COPY
: from to
[ file ...
]
47 * files in the from directory are copied to the to directory
48 * the action may contain
:MOVE
: exceptions to the copy
50 * from original directory subdirectory
51 * . names the original directory
53 * to converted subdirectory
54 * libNAME
=> src
/lib
/libNAME
55 * NAME
=> src
/cmd
/NAME
56 * file files or files in subdirectories to be copied
;
57 * explicit files are copied to the to directory
;
58 * if no files are specified then the from hierarchy
59 * is recursively copied to the converted directory
63 * :COPY
: assertion exceptions placed in the assertion
's action
65 * to files or subdirectory files are copied to this directory
66 * file file or files in subdirectories to be copied
72 * the :FILE: action is copied to the named file in the to directory
73 * the :FILE: action is usually specified using the here syntax to
74 * avoid make comment, quote and variable expansion
76 * :EDIT: to file ... | - pattern <<!
80 * the :EDIT: action is an ed(1) script applied to each file in the
81 * to directory after it has been copied from the original source
82 * directory; if to is - then the :EDIT: action is a sed(1) script
83 * that is applied to all files matching the file pattern during the
84 * copy from the original source directory; a file may be subject to
85 * both a sed(1) and ed(1) :EDIT:; the :EDIT: action is usually
86 * specified using the here syntax to avoid make comment, quote and
90 .CONVERT.ID. = "@(#)$Id: CONVERT (AT&T Research) 2004-03-19 $"
92 set nojobs noscan nowriteobject writestate=$$(MAKEFILE).ms
96 hierarchy = src src/cmd src/lib
98 original = $(MAKEFILE:D)
99 showedit = $(-debug:?p??)
113 .MAKEINIT : .cvt.init
115 .cvt.init : .MAKE .VIRTUAL .FORCE
117 if D = "$(~.ARGS:O=1)"
120 .ARGS : .CLEAR $(~.ARGS:O>1)
127 .cvt.atom : .FUNCTION
130 let .cvt.$(V) = .cvt.$(V) + 1
131 return .cvt.$(V).$(.cvt.$(V))
133 .cvt.omit : .FUNCTION
134 return -s',^\
(\
(?K
)?
(*/)($(omit
))?
(/*))$,,$(showedit
)'
148 ":CONVERT:" : .MAKE .OPERATOR
151 I := $(hierarchy:C,$,/Makefile)
152 init : .cvt.verify $(I)
154 test -d $(<:D) || $(MKDIR) -p $(<:D)
156 .cvt.verify : .MAKE .FORCE .REPEAT
158 if I = "$(.cvt.package:T!=F)"
159 error 3 $(original): not a $(package) source directory: missing $(I)
161 .cvt.package := $(>:C,^,$$(original)/,)
163 ":COPY:" : .MAKE .OPERATOR
166 T := $(.cvt.to $(>:O=2))
167 A := $(.cvt.atom copy)
173 test -d $(<) || $(MKDIR) -p $(<)
176 $$(A) : $(I:D=$(T):B:S)
177 $(I:D=$(T):B:S) : $$(original)/$(I)
178 $$(CP) $$(CPFLAGS) $$(*) $$(<)
181 elif "$(F:T=FF)" || "$(F:N=*.(pax|t[bg]z))"
184 test -d $(T) || $$(MKDIR) -p $(T)
186 $$(PAX) $$(PAXFLAGS) -rf $$(*:P=A) -s ',^
$(>:O
=2)/*,,' $(.cvt.omit) $(.cvt.filter)
189 F := $$(original)/$(F)
193 test -d $(T) || $$(MKDIR) -p $(T)
195 $$(TW) $$(TWFLAGS) | $$(PAX) $$(PAXFLAGS) -rw $(.cvt.omit) $(.cvt.filter) $(T:P=A)
202 test -d $(T) || $$(MKDIR) -p $(T)
204 $$(TW) $$(TWFLAGS) | $$(PAX) $$(PAXFLAGS) -rw $(.cvt.omit) $(.cvt.move) $(.cvt.filter) $(T:P=A)
209 ":EDIT:" : .MAKE .OPERATOR
213 A := ^$(>:O=2)^$$(SED) -e $(@:Q:/'\n'/ -e /G)
214 .cvt.filter += --action=$(A:@Q)
217 F := $(>:O>1:C,^,$(D)/,)
221 $$(STDED) $$(STDEDFLAGS) $$(<) <<'$(here
)'
229 ":FILE:" : .MAKE .OPERATOR
232 A := $(.cvt.atom file)
238 test -d $$(<:D) || $$(MKDIR) -p $$(<:D)
239 cat > $$(<) <<'$(here
)'
244 ":MOVE:" : .MAKE .OPERATOR
246 T := ../../../$(.cvt.to $(>:O=1))
249 .cvt.move += -s',^\
(\
(?K
)$(I
)),$(T
)/,$(showedit
)'
250 .cvt.move += -s',^\
(\
(?K
)$(I
:C
%/$%%))$,,$(showedit
)'
252 .cvt.move += -s',^\
(\
(?K
)$(I
))$,$(T
)/$(I
:B
:S
),$(showedit
)'
256 ":OMIT:" : .MAKE .OPERATOR