dcstraw
dcstraw

Reputation: 3311

How do I build the TypeScript compiler (tsc.js) from source?

How do I build the TypeScript compiler (at typescript.codeplex.com) from source? When I clone it from git I see a Makefile, but make in cygwin fails with *** missing separator (did you mean TAB instead of 8 spaces?)

I can't find any clear documentation, and the Readme file in the source doesn't help.

Upvotes: 5

Views: 2067

Answers (3)

Oleg Mihailik
Oleg Mihailik

Reputation: 2590

There's an even easier answer, apparently. Just referring to tsc.ts in /src/compiler does the trick:

tsc tsc.ts --out tsc.js

All other files are pulled via /// syntax automatically.

Upvotes: 1

dcstraw
dcstraw

Reputation: 3311

The Makefile in the TypeScript source is in NMAKE format and has dependencies on Windows commands. NMAKE comes with Visual Studio and is in the path when you run a Visual Studio Command Prompt.

In order to build you need both nmake and nodejs in your path. Then just run:

nmake TYPESCRIPT_HOST=node world

from the directory containing your TypeScript source. The built .js files will be placed in built\local

Edit: Added the missing arg setting TYPESCRIPT_HOST

Upvotes: 3

Markus Jarderot
Markus Jarderot

Reputation: 89171

To use the makefile with mingw32 or cygwin make, you need to go trough the file and fix the indentation.

sed -i.bak -e "s/^[[:space:]]\+/    /" Makefile

To get it to compile, you can issue this command:

make TYPESCRIPT_HOST="cscript //Nologo" compiler

This also works with nmake.

Upvotes: 3

Related Questions