Doing case conversion in a make file ?

Hi,

I use gnu make for most of my make file these days. Now I have to change some old code that used the old IAR DOS 8051 tools. The problem is that the output file names are all converted to upper case, which causes havoc with the make rules, since all my input files are lower case filenames. Does anyone have a way of getting gnu make to do a case insensitive compare ?

Regards Anton Erasmus

Reply to
Anton Erasmus
Loading thread data ...

I don't see why that would cause havoc --- DOS completely ignores filename case, and so will any version of GNU make ported to DOS. If it didn't, that port of GNU make would have to be considered fatally flawed.

Could you give a more detailed description of the problem?

--
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
Reply to
Hans-Bernhard Broeker

I presume you're using *nix.

1) Why does the case of the old output filenames matter? Aren't you rebuilding from scratch?

2) What, specifically, is the problem with your makefile?

Steve

formatting link

Reply to
Steve at fivetrees

Since he is using DOS tools tht seems less likely. In fact given the problem description is seems most probable to me that he is using one of the newer windows variants (NT, 9X etc..). They have adopted the unfortunate case perserving but case insensitive approach. The GNU tools ported to NT generally maintain their case sensitive nature. A lot of the DOS based tools uppercase filenames before opening or creating a file which gives no problem when they open an existing lower case file (name) but when they create a file NT then preserves the upper case name which the GNU tools now think is different from the lower case name.

What I have done when I have run across this is make the compile a two command process. The first is the usual compile command (cc, c85comp, whatever). The second is a simple rename command something like

rename OUT.OBJ out.obj

Some rename utilities attempt to help you and since the name hasn't changed they don't touch it. There should be some rename/lowercase filename utilities around (I don't know if cygwins mv will work). It's been a while since I've dealt with it so I can't offer much more than that as genreal guidance. But take comfort in the fact that it can be done. Worst case involves a copy to a new filename.

Robert

Reply to
R Adsett

I am using bash under cygwin. With make the case of the output file matters. If one has a rule to build generate .o files from .c files and the C compiler generates FILENAME.O in stead of filename.o as it should, then make does not recognise the FILENAME.O. When using this particular compiler I want to be able to tell make to treat FILENAME.O as if it was filename.o.

Regards Anton Erasmus

Reply to
Anton Erasmus
[...]

If this is a problem, you could adjust the compiler options to generate object files with a different extension (.o or whatever) and rename those

mv OUT.O out.obj

Or vice versa. Or vice vice versa (link .o files instead of .obj files or vice versa).

Regards,

-=Dave

--
Change is inevitable, progress is not.
Reply to
Dave Hansen

Thanks,

You described my problem much better than I did. I want to use cygwin under Windows2000 for building my old DOS based projects. The 2 step approach looks like it will work, even if I have to write my own special rename command. (I am sure there should be a simple script based method using something available under cygwin)

Regards Anton Erasmus

Reply to
Anton Erasmus

Dave Hansen has solved my problem. (And given a better description of the problem)

But to recap: I am using tools written for DOS in a non-DOS environment, specifically cygwin under Windows 2000. In cygwin the gnu tools does not ignore case. The problem is that the old DOS tools generate output filenames in upper case only. e.g. If I specify that a lst file should be generated, and the input file is file.c the output file would be FILE.LST, even if I explicitly specify an output file of file.lst. The solution is a two step process involving running the tool that generates the upper case filename, and then renaming the output with a suitable utility to the lower case form.

Regards Anton Erasmus

Reply to
Anton Erasmus

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.