Re: [cc65] Please critique this makefile

From: <silverdr1wfmh.org.pl>
Date: 2010-04-21 21:37:45
On 2010-04-21, at 16:28, Oliver Schmidt wrote:

> Hi,
>
>>> http://www.cc65.org/doc/make.html
>
>> Would you be able to create a Makefile that would allow building  
>> from a
>> sources directory containing arbitrary number of mixed (C and ASM)  
>> source
>> files?
>>
>> I mean the location of the directory is the parameter, not each and  
>> every
>> source file...
>
> I'm not really sure what you want to express. Could you please  
> elaborate?

I mean that instead of explicitly naming each source file in the  
Makefile, I want to name only the directory where the sources reside.

Instead of

CSOURCES = sources/foo.c sources/bar.c sources/etc.c
ASMSOUIRCES = sources/foo.s sources/bar.s sources/etc.s

or something similar I would like to have only:

SOURCEDIR = sources/

and both types of source files are dynamically found

>> AFAIR due to the fact that C files are compiled into asm, which
>> only then gets assembled into object files. Now I don't remember  
>> exactly the
>> reason but I think it was due to the fact that both dependent and
>> non-dependent asm files were to be taken into account, which is not  
>> a very
>> typical situation with other compilers.
>
> Two solutions to this problem (if I understand you right) come into my
> mind first:
>
> 1. AFAIK coming from the GCC world is the idea to distinguish between
> '.S' for source assembler files and '.s' for intermediate assembler
> files. Doing so will work even on a Windows filesystem.
>
> 2. Keep GNU make from knowing about the intermediate assembler files
> by compiling and assembling C sources in a single make recipe and
> deleting the intermediate assembler file right away.

AFAIR that was the path I have taken but then things still didn't work  
as expected (dependencies). Since you replied, I think I shall have to  
get back to it. Maybe we can work something out!

>> This sort of "universal" Makefile would be really highly appreciated!
>
> If I clearly understand what you're looking for I'm rather optimistic
> that I can provide a solution. With "universal" you are refering to
> "both C and assembler sources" ?

Yes, both types of sources the CC65 (as package) supports. But by  
"universal" I also mean that I can have the same Makefile for  
virtually all simple (or even not so simple but not requiring some non- 
cc65 tools) CC65 projects, as long as I keep the project (directory)  
structure consistent.

Something like:

project/
         |
         + objects/
         |
         + resources/
         |
         - sources/

I think this could set a standard starting point for CC65 projects.

-- 
SD!

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed Apr 21 21:37:53 2010

This archive was generated by hypermail 2.1.8 : 2010-04-21 21:37:55 CEST