Skip to content

Commit

Permalink
merged --target=(unix|windows) extension from bug fix branch
Browse files Browse the repository at this point in the history
  • Loading branch information
duchier committed Aug 7, 2001
1 parent 6358209 commit 5963786
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 12 deletions.
15 changes: 12 additions & 3 deletions linker/Main.oz
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@ define
fun {MakeExecFile File}
{Property.get 'oz.home'}#'/bin/'#File
end
DefaultExecWindows = file({MakeExecFile 'ozwrapper.bin'})
DefaultExecUnix = string({MakeExecHeader 'ozengine'})
DefaultExec = case {Property.get 'platform.os'} of win32 then
file({MakeExecFile 'ozwrapper.bin'})
DefaultExecWindows
else
string({MakeExecHeader 'ozengine'})
DefaultExecUnix
end

proc {ReadFile File ?VS} F in
Expand Down Expand Up @@ -120,6 +122,10 @@ define
out(single char: &o type: string optional: true)
rewrite(multiple type: list(StringPair) default: nil)

target(rightmost type:atom(unix windows) default:unit)
unix(alias:target#unix)
windows(alias:target#windows)

executable(rightmost char: &x type: bool default: false)
execheader(single type: string
validate:
Expand Down Expand Up @@ -191,7 +197,10 @@ define
of unit then
case {CondSelect Args execwrapper unit}
of unit then
DefaultExec
case Args.target
of unix then DefaultExecUnix
[] windows then DefaultExecWindows
else DefaultExec end
elseof S then file({MakeExecFile S})
end
elseof S then file(S)
Expand Down
3 changes: 3 additions & 0 deletions linker/Print.oz
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ fun {Usage}
' (Windows default: <ozhome>/bin/ozwrapper.bin).\n' #
'--execwrapper=FILE\n' #
' Use above header, with ozwrapper.bin replaced by STR.\n' #
'--target=(unix|windows)\n' #
' When creating an executable functor,\n' #
' do it for this platform (default current).\n'#
'--compress=N, -z N (N: 0..9, default 0)\n' #
' Use compression level N for created pickle.\n'
end
Expand Down
30 changes: 21 additions & 9 deletions ozbatch/Compile.oz
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ prepare
verbose(rightmost char: &v type: bool default: auto)
quiet(rightmost char: &q alias: verbose#false)
makedepend(rightmost char: &M default: false)
target(rightmost type:atom(unix windows) default:unit)
unix(alias:target#unix)
windows(alias:target#windows)

%% options for individual modes
outputfile(single char: &o type: string default: unit)
Expand Down Expand Up @@ -161,6 +164,8 @@ prepare
' <ozhome>/bin/ozwrapper.bin).\n'#
'--execwrapper=FILE Use above header, with ozwrapper.bin\n'#
' replaced by STR.\n'#
'--target=(unix|windows) when creating an executable functor, do\n'#
' it for this platform (default current).\n'#
'-z N, --compress=N Use compression level N for pickles.\n'#
'-D NAME, --define=NAME Define macro name NAME.\n'#
'-U NAME, --undefine=NAME Undefine macro name NAME.\n'#
Expand Down Expand Up @@ -203,10 +208,12 @@ define
fun {MakeExecFile File}
{Property.get 'oz.home'}#'/bin/'#File
end
DefaultExecWindows = file({MakeExecFile 'ozwrapper.bin'})
DefaultExecUnix = string({MakeExecHeader 'ozengine'})
DefaultExec = case {Property.get 'platform.os'} of win32 then
file({MakeExecFile 'ozwrapper.bin'})
DefaultExecWindows
else
string({MakeExecHeader 'ozengine'})
DefaultExecUnix
end

local
Expand Down Expand Up @@ -390,12 +397,14 @@ in
OFN = unit
[] dump then
OFN = {ChangeExtension Arg ".ozf"}
[] executable then
case {Property.get 'platform.os'} of win32 then
OFN = {ChangeExtension Arg ".exe"}
else
OFN = {ChangeExtension Arg ""}
end
[] executable then EXT in
case OptRec.target
of unix then EXT=""
[] windows then EXT=".exe"
elsecase {Property.get 'platform.os'}
of win32 then EXT=".exe"
else EXT="" end
OFN={ChangeExtension Arg EXT}
end
elseof "-" then
if OptRec.mode == dump orelse OptRec.mode == executable
Expand Down Expand Up @@ -475,7 +484,10 @@ in
of unit then
case {CondSelect OptRec execwrapper unit}
of unit then
DefaultExec
case OptRec.target
of unix then DefaultExecUnix
[] windows then DefaultExecWindows
else DefaultExec end
elseof S then file({MakeExecFile S})
end
elseof S then file(S)
Expand Down

0 comments on commit 5963786

Please sign in to comment.