Multilanguage development
I would like to develop an application with two languages. Actually, the goal is to generate two differents application, one with a language 开发者_JAVA百科(Java), the other on in another language (C#).
I would like to use makefiles to help me generate one application or the other one, thanks to targets definition.
I don't know where to begin. Have you ever try to develop like this ? Is it possible to use one makefile to call java compiler or c# compiler using different targets ?
Thanks in advance for your help.
Sure, you can use a make file to compile (and link) source files for different languages. There's no limitation. All you need is a compiler (linker) that can be called by a shell / from a command line.
Alternatives: ant can do both Java and C#. If you don't need to build both applications with a single build file, you still can use separate files and write a batch/shell script to call both builders.
Yes it is possible to override a Makefile variable to point to either javac or the .NET compiler.
You will, however, most likely not benefit from this as it is very hard to write a program that is valid in both languages.
You may want to look into http://www.ikvm.net/ which provides a Java emulation environment under .NET, so if you have a Java program it can run under .NET.
There is also the Fantom project, which claims to do that, but I have strong doubts regarding cross-platform support (how can you abstract all side-effects of all APIs?).
But I don't know the project, maybe they do a fine job.
http://fantom.org/
my idea is pretty dumb but i guess you could try this: step 1: make a bat file step 2: make the 2 script files step 3: make it so it executes both of them!
@echo off
start yourfile.script
start yourfile.script
this idea is gonna fail
精彩评论