summary refs log tree commit diff stats
path: root/tools/niminst/buildbat.tmpl
blob: f7ccbcbfa1447185620dd98ee94eba7d826c8fa1 (plain) (blame)
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
#! stdtmpl(subsChar='?') | standard
#proc GenerateBuildBatchScript(c: TConfigData, winIndex, cpuIndex: int): string = 
#  result = "@echo off\nREM Generated by niminst\n"
SET CC=gcc
SET LINKER=gcc
SET COMP_FLAGS=?{c.ccompiler.flags}
SET LINK_FLAGS=?{c.linker.flags}
SET BIN_DIR=?{firstBinPath(c).slashify}

if EXIST ..\koch.nim SET BIN_DIR=..\bin

if NOT EXIST %BIN_DIR%\nul mkdir %BIN_DIR%

REM call the compiler:

#  block win32:
#    var linkCmd = ""
#    for ff in items(c.cfiles[winIndex][cpuIndex]):
#      let f = ff.slashify
ECHO %CC% %COMP_FLAGS% -Isrc -c ?{f} -o ?{changeFileExt(f, "o")}
%CC% %COMP_FLAGS% -Isrc -c ?{f} -o ?{changeFileExt(f, "o")}
#      linkCmd.add(" " & changeFileExt(f, "o"))
#    end for

ECHO %LINKER% -o ?{"%BIN_DIR%"\toLower(c.name)}.exe ?linkCmd %LINK_FLAGS%
%LINKER% -o ?{"%BIN_DIR%"\toLower(c.name)}.exe ?linkCmd %LINK_FLAGS%

#  end block

ECHO SUCCESS