Script/wizard to convert exported .mcp.xml Project to makefile?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Script/wizard to convert exported .mcp.xml Project to makefile?

11,449 次查看
GordFinlay
Contributor I
Has anyone ever created the opposite of the Makefile Importer Wizard which exists in some versions of Codewarrior? I'd like to create a makefile from a Codewarrior .mcp project so that I can do building of 9S12 code using Codewarrior's compilers/linkers (via the command line interface) from a make invoked from the Eclipse IDE. 
 
I was thinking of using File/Export Project... (using CW for HCS12) to create a .mcp.xml file, and then using a Python script to create either a Maker makefile (Maker is part of the CW Build tools) or else a GNU-style makefile.
 
Perhaps I am missing something, but since the Maker build tool is provided with Codewarrior, I thought that Freescale/Metrowerks would provide an automatic way to create a Maker-compatible makefile from a .mcp file. 
 
Thanks in advance for any suggestions.
标签 (1)
0 项奖励
回复
10 回复数

3,111 次查看
LMM
Contributor I
Hello,
Is there command line utility that accept project file (.mcp) or target settings (.tdt) file to build the project outside of IDE?
 
Thank you,
0 项奖励
回复

3,111 次查看
CrasyCat
Specialist III
Hello
  There is the Command line IDE (cmdIDE).
   Please refer to the IDE 5.7 Automation Guide.pdf in your {Install}\Help\PDF directory for available options.
 
  You can specify a .mcp file when starting.
 
CrasyCat
0 项奖励
回复

3,111 次查看
alexod
Contributor I
CmdIDE works nicely, but can I pass a #define in on the command line? (-d_Token_Name_=value)
0 项奖励
回复

3,111 次查看
CompilerGuru
NXP Employee
NXP Employee
you have to specify -D in the compiler preference panel.
cmdide is an interface to the build engine, it's not a compiler driver.
0 项奖励
回复

3,111 次查看
alexod
Contributor I
Surely a build engine invokes the compiler, assembler, linker & loader in sequence?  Therefore it does spawn/chain/execute the compiler.  Sounds like CmdIDE extract the compiler command line from the MCP file based on the target modifier.  Sounds reasonable, I just wish it were more flexible.

I know I can set up varying targets, each with specific compiler options, and then CmdIDE will accept target as a parameter.  But what if I want to have a command line build that takes in a specific customization?  Thing is, I have a code generator which I will be giving to a technician, and that feeds some source code into the build process.  I want to give the build a path to the custom code to include.

I did try a "hack" of the MCP file, something I didn't want to do as there was binary and ascii mixed, and as expected it fried the MCP file and auto recovery messed up the MCP so I couldn't just undo the edit.

So I too am now looking at how to export the MCP into a make file or XML file.  Something that is ASCII, and I can edit with a SED like script.  I believe I saw CmdIDE accepts an XML file.
/x <project.xml>   specifies an XML project file to import
                   (A project file argument must also be specified for the
                   name of the imported project. Once the project has been,
                   imported, build or debug operations may commence)
I do have two other options to explore - one is use of known fixed locations for custom files, the other is use of environment variables.  I was just hoping that a simple cmd line interface to the compiler existed. 


0 项奖励
回复

3,111 次查看
CompilerGuru
NXP Employee
NXP Employee
First note that cmdide.exe is just a wrapper which starts the ide and lets the ide do the work.
Cmdide provides the command line interface to the ide.
I think the reason why providing an option like -D to cmdide is not as simple as you imagine is that the ide does track for every file if it has to be recompiled and what it depends on.
This is done more strictly than by a makefile based tool, for example if you replace a source file with an old revision, with an old modification date, the ide will detect this and rebuild it, while a makefile based build would not.
What you can do is to export your project to xml (start the ide, use File->export project). That will produce an xml you can pass to the /x option of cmdide.
Do you only need to adapt the search path? Actually custom search path roots are called source trees, and the cmdide provides explicit options (/addabsolute,...) to set those. Well, I never tried to use cmdide with those options so I don't have the experience.

Daniel

0 项奖励
回复

3,111 次查看
alexod
Contributor I
That's probably what I was looking for ultimately, /addabsolute.  It was in the help under [extended commands] not under [build operations].  That may do the job.

I understand that CmdIDE ran the full IDE, and was looking for cmd line switch to pass in compiler cmd line modifiers.  Sure the input gets messy, but still usable.  I tend to use IDE's and UDE's (Ultra Edit/Cdewright) whenever they can for the build management.

The included files would have had a newer date, but the c file they were included in needed to be touched, my scipt would have taken care of that; touching was explicitly called out in the manual procedure I am replacing.  The project was small enough I elected to use the /r switch to force a full re-build.

Thanks for all your help, I'll let you know how the /add... works.  Sounds simpler than AWKing an XML.

Alex
0 项奖励
回复

3,111 次查看
LMM
Contributor I
Thank you,
LMM
0 项奖励
回复

3,111 次查看
agrawal82
Contributor I

Hi,

I share the same concern. It would be great if such a script be made avaiable to me as well. I am using codewarrior for ARM basically.

Thanks in advance,

Mayank

0 项奖励
回复

3,111 次查看
CrasyCat
Specialist III

Hello

There is no way to export a CodeWarrior project to a Make file.

The Make utility is delivered for customer who have an existing make file and want to build from a make utility rather than from the IDE.

What I can provide you is a sample automake make file with instruction how to adjust it to your application.

Let me know if you are interested.

CrasyCat

0 项奖励
回复