[ECOS] CDL and makefile output

Jesper Skov jskov@zoftcorp.dk
Fri Nov 14 16:16:00 GMT 2008

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 $@ $<

+        display "Extras.o linker flags"
+        flavor  data
+        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.



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

More information about the Ecos-discuss mailing list