How to change Makefile file name in sun studio for linux 11?
Greetings,
For historical reasons, our makefiles are called Make.bld
Sun Studio refuses to accept these as makefiles.
It'd be a big pain to modify our entire build system to take makefile as the name.
Is there a way to instruct sun studio to accept a different filename for makefiles ?
Thanks,
Bill
[342 byte] By [
hdbaddoga] at [2007-11-26 17:09:33]

# 1
I think I understand the question, but could you clarify what you mean by Sun Studio refusing to accept Make.bld files? To make dmake use some file other than 'makefile' or 'Makefile', you can use 'dmake -f <filename>' just as you would bsd or gnu make.
Or do you mean Netbeans IDE won't build your project because the makefile is named differently? I think there's a way to specify the make command in the IDE somewhere.
# 2
> I think I understand the question, but could you
> clarify what you mean by Sun Studio refusing to
> accept Make.bld files?
...
> Or do you mean Netbeans IDE won't build your project
> because the makefile is named differently? I think
> there's a way to specify the make command in the IDE
> somewhere.
Yes this is the issue I'm running into.
netbeans (aka sunstudio), thinks the file is text. when I right click and/or use the build wizard and try to select this file as a makefile. It refuses.
-Bill
# 3
Under tools->options->ide configuration->system->filetypes->makefilesThe setting is org-netbeans-modules-cpp-mime-resolverWhere do I look to reset the Makefile to be Make.bld
# 4
I did not find a way how to tell IDE that all "Make.bld" files are makefiles,
but I noticed that if I create a new Makefile (File->New->Makefiles->...)
it creates a new file and treats it as makefile (context menu has all
"make" items). So, it is not really a filename or its suffix, but something
else. I suppose this information is stored somewhere in hidden IDE
files. For example, there is a file ".nbattrs" in each directory. This file
is created by the IDE. And in my case there is a special section about
"Make.bld" file in the ".nbattrs" file:
<fileobject name="Make.bld">
<attr name="makeTargets" stringvalue="all, Sun-x86-Solaris/a.out, clean"/>
<attr name="MAKEFILE_TYPE" serialvalue="aced00057372..."/>
<attr name="makeCommand" stringvalue="dmake -m serial"/>
<attr name="makeOptions" stringvalue=""/>
<attr name="buildDirectory" stringvalue="."/>
</fileobject>
So I suppose that's the way to tell IDE about file type,
but I would not suggest to write a script that will add
such section to each ".nbattrs" file :-)
Thanks,
Nik
# 5
There is no *supported* way of getting the Sun Studio IDE (or NetBeans) to recognize
Make.bld as a Makefile. However, the solution Nik pointed out with a .nbattrs file will
work.
Here is a complete file which, if copied to each directory containing a Make.bld file
will work. However, if the directory already contains a .nbattrs file you should edit
the existing one and add the <fileobject>...</fileobject> lines rather than overwriting
the entire file.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE attributes PUBLIC "-//NetBeans//DTD DefaultAttributes 1.0//EN"
" http://www.netbeans.org/dtds/attributes-1_0.dtd">
<attributes version="1.0">
<fileobject name="Make.bld">
<attr name="MAKEFILE_TYPE" stringvalue="foo"/>
</fileobject>
</attributes>
Note: I split the DOCTYPE line myself. It should be a single line in the file (although
its probably OK if split, I didn't verify that so I'll suggest a single line).
I should warn you that the next release of the Sun Studio IDE will no longer use
.nbattrs files and you'll need a different solution. A preliminary version of the next
release is currently available by downloading Sun Studio Express 3. The IDE is
*significantly* better than the current one! You also get a lot of the same features
by downloading NetBeans 5.5 with the C/C++ Development Pack.
Gordon
