home *** CD-ROM | disk | FTP | other *** search
- .key source,target
- .bra {
- .ket }
- .def source lmkfile
- .def target smakefile
-
- ; LMKTOSMAKE Version 6.50
- ; By Steve Evans and Doug Walker
- ;
- ; Attempts to convert makefiles intended for Lattice C and
- ; SAS/C Version 5 to the format required by SAS/C Version 6
- ;
- ; USAGE: LMKTOSMAKE <source> <target>
- ;
- ; If not specified, "lmkfile" is used for the source and "smakefile"
- ; for the target.
-
- if not exists {source}
- echo "USAGE: lmktosmake <source> <target>"
- quit 20
- endif
-
- echo "LMKTOSMAKE Makefile Converter Version 1.0"
-
- if exists {target}
- echo " "
- ask "{target} about to be overwritten, proceed? (Y/N):"
- if not warn
- quit 20
- endif
- endif
-
- echo " "
- echo "Converting *"{source}*" to *"{target}*"."
-
- echo >{target} "# Makefile converted using LMKTOSMAKE version 1.0"
- echo >>{target} " "
- echo >>{target} "CC = sc5" ;needed because some makefiles omit this
- echo >>{target} " "
- type >>{target} {source}
-
- ; First off, let's get any constructs that we know we can't recognize
- ; Invoking the seperate phases of the compiler individually is a problem
- ; because the individual phases are now libraries and not invokable as
- ; seperate programs.
-
- echo " "
- echo "LMKTOSMAKE cannot translate any V5 file that invokes the phases of"
- echo "the compiler seperately (lc1, lc1b, lc2, and go). I am now checking"
- echo "for such invocations. If you see any such lines in the following"
- echo "output, you must fix them by hand."
- echo " "
- grep -$ "lc1 " {target}
- grep -$ "lc1b " {target}
- grep -$ "lc2 " {target}
- grep -$ "go " {target}
- echo " "
- echo "Done checking."
-
- ; Substitute for the LC: path assign. LC: pointed to the subdirectory of the
- ; V5 tree that contained the commands; the equivalent directory in V6 is not
- ; SC:, but rather SC:C/ .
- ;
- ; The funny [] syntax allows mixed-case to be matched.
- ;
- echo " "
- echo "Substituting for lc: and command names..."
-
- splat -o "[Ll][Cc]:" "sc:c/" {target}
-
- ; Substitute for the actual compiler and linker commands. We use the SC5 command
- ; since it is command-line compatible with Version 5, and translating options would
- ; be very, very difficult. Slink is command-line compatible with Blink.
-
- ; "LC " => "sc5 "
- splat -o "[Ll][Cc][ \t]" "sc5 " {target}
-
- ; "LC\n" => "sc5\n"
- splat -o "[Ll][Cc][\n]" "sc5\n" {target}
-
- ; "BLINK " => "slink "
- splat -o "[Bb][Ll][Ii][Nn][Kk][ \t]" "slink " {target}
-
- ; "BLINK\n" => "slink\n"
- splat -o "[Bb][Ll][Ii][Nn][Kk][\n]" "slink\n" {target}
-
- ; "LMK " => "smake "
- splat -o "[Ll][Mm][Kk][ \t]" "smake " {target}
-
- ; "LMK\n" => "smake\n"
- splat -o "[Ll][Mm][Kk][\n]" "smake\n" {target}
-
- ;
- ; Substitute for the link libraries. Note that in V6, the registerized
- ; and nonregisterized libraries have been combined into one. This means,
- ; for example, that "lc.lib" and "lcr.lib" should both get translated
- ; to "sc.lib".
- ;
- ; Note that the double asterisk is necessary to get a single asterisk into
- ; the strings; AmigaDOS treats the first one as an escape character.
- ;
- echo " "
- echo "Substituting for link libraries and DEFINEs..."
- splat -o "[Ss][Mm][Aa][Ll][Ll]\.[Ll][Ii][Bb]" "amiga.lib" {target}
- splat -o "[Ll][Cc][Rr]**\.[Ll][Ii][Bb]" "sc.lib" {target}
- splat -o "[Ll][Cc][Mm][Rr]**\.[Ll][Ii][Bb]" "scm.lib" {target}
- splat -o "[Ll][Cc][Mm][Ii][Ee][Ee][Ee]\.[Ll][Ii][Bb]" "scmieee.lib" {target}
- splat -o "[Ll][Cc][Mm][Ff][Ff][Pp]\.[Ll][Ii][Bb]" "scmffp.lib" {target}
- splat -o "[Ll][Cc][Mm][Ss][Rr]**\.[Ll][Ii][Bb]" "scms.lib" {target}
- splat -o "[Ll][Cc][Mm][Rr]**881\.[Ll][Ii][Bb]" "scm881.lib" {target}
- splat -o "[Ll][Cc][Nn][Bb]\.[Ll][Ii][Bb]" "scnb.lib" {target}
- splat -o "[Ll][Cc][Ss][Rr]**\.[Ll][Ii][Bb]" "scs.lib" {target}
- splat -o "[Ll][Cc][Ss][Nn][Bb]\.[Ll][Ii][Bb]" "scsnb.lib" {target}
-
- ; Version 5.x users often added a DEFINE statement to the link
- ; line to get rid of part of the normal startup. This statement
- ; took the form
- ;
- ; DEFINE __main=__tinymain
- ;
- ; or a variant. The correct change in 6.0 is
- ;
- ; DEFINE ___main=___tinymain
- ;
- ; Actually, in 6.50 we could do away with it altogether, but this
- ; will work OK without unresolved symbols.
- ;
- splat -o "[_@]_main" "___main" {target}
- splat -o "[_@]_tinymain" "___tinymain" {target}
-
- echo " "
- echo "LMKTOSMAKE finished. Output filename is *"{target}*"."
-