This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: CDL and makefile output


On Wed, Nov 12, 2008 at 10:15 PM, Bart Veer <bartv@ecoscentric.com> wrote:
> If you really need to do something like this, it is possible but not
> easy. You can invoke a Tcl script from inside a custom build step,
> along similar lines to the memalloc package. That Tcl script can read
> in install/include/pkgconf/ecos.mak and anything else in pkgconf/ that
> contains relevant options, e.g. your CYGBLD_GLOBAL_EXTRAS_LDFLAGS. It
> can then exec the linker with the appropriate options.

Uh, not liking the looks of that. Partly because I've never really
used Tcl, partly because keeping the logic in the makefile would be
nicer (IMHO, of course).

So I tried to see if I could do it in a simpler fashion. And I found a
solution after some tinkering. The real question is now, would
something like the below be accepted in a contribution?

Index: hal.cdl
===================================================================
--- hal.cdl	(revision 26)
+++ hal.cdl	(working copy)
@@ -71,10 +71,22 @@

     make -priority 250 {
         <PREFIX>/lib/extras.o: <PREFIX>/lib/libextras.a
-        $(CC) $(CFLAGS) -nostdlib -Wl,-r -Wl,--whole-archive -o $@ $<
+        $(CC) $(CFLAGS) $(shell grep " EXTRAS_LDFLAGS "
$(PREFIX)/include/pkgconf/system.h | cut -d' '  -f 3-) -o $@ $<
     }

+    cdl_option CYGBLD_GLOBAL_EXTRAS_LDFLAGS {
+        display "Extras.o linker flags"
+        flavor  data
+	    parent  CYGBLD_GLOBAL_OPTIONS
+        no_define
+        define -file=system.h EXTRAS_LDFLAGS
+        default_value { "-nostdlib -Wl,-r -Wl,--whole-archive" }
+        description   "
+            This option controls the extras.o linker flags. Individual
+            packages may define options which override these global flags."
+    }


I have only tested in on BSD/OS X (where it works as intended) but I
can't see why it shouldn't work on Linux and Windows/CygWin.

Comments?

Cheers,
Jesper

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]