[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [newbie] Recursive GNUmakefile
From: |
Nicola Pero |
Subject: |
Re: [newbie] Recursive GNUmakefile |
Date: |
Mon, 11 Nov 2002 20:49:18 +0000 (GMT) |
> Hi,
>
> I am trying to compile an application I wrote on OSX under GNUstep. I
> encounter problems with the makefile system as my sources are organised
> in subfolders, as following:
>
> - Sources/
> main.m
> Core/
> blah.m
> Utilities/
> foo.m
>
> Putting all the sources files in the OBJC_FILES (like Sources/main.m
> Sources/Core/blah.m ...) does not work properly.
>
> How should I write my makefile to support my Source tree ?
You need to have a GNUmakefile in each directory.
Sources/GNUmakefile will contain the makefile to build the final tool (I
assume we're talking of a tool - anything else is similar):
include $(GNUSTEP_MAKEFILES)/common.make
TOOL_NAME = MyTool
MyTool_OBJC_FILES = main.m
MyTool_SUBPROJECTS = Core Utilities
include $(GNUSTEP_MAKEFILES)/tool.make
as you see, it contains MyTool_SUBPROJECTS. That will tell gnustep-make
to recurse into the subdirectories, and that in the subdirectories it will
find more .m files to merge into the tool, when it's built.
Both in Core/ and Utilities/, you need a specific, very simple,
GNUmakefile with the instructions to build that particular subproject -
such as
include $(GNUSTEP_MAKEFILES)/common.make
SUBPROJECT_NAME = Core
Core_OBJC_FILES = blah.m
include $(GNUSTEP_MAKEFILES)/subproject.make
If you then type 'make' at the top-level, it will first compile the files
in the subdirectories (/subprojects), finally compile the main.m file,
then finally assemble all together into the finished tool.
Hope that helps :-)