5

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.

3 Answers 3

3

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.

Sign up to request clarification or add additional context in comments.

Comments

3

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

2 Comments

As Markus Jarderot points out you can also use TYPESCRIPT_HOST="cscript //Nologo", which removes the dependency on nodejs. I found that using node makes the build much faster though.
After building, run npm install -g and you have easy access to tsc.
1

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.