Re: RFC: crash extension module handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff Moyer wrote:
Dave Anderson <anderson@xxxxxxxxxx> writes:


Anyway, I've been tinkering with the extensions/Makefile to do such
a thing, and have a crude addition that does just that, although
it does the compile of all "new" C files every time whether they
need it or not -- via the additional "contrib" target:

30c30
< all: link_defs $(OBJECTS)
---

all: link_defs $(OBJECTS) contrib

43a44,50

contrib:
	@for CFILE in `/bin/ls *.c | grep -v echo.c | grep -v dminfo.c
| grep -v

sial.c`; do \

	   OUTPUT=`echo $$CFILE | cut -d. -f1`.so; \
	   echo "gcc -nostartfiles -shared -rdynamic -o $$OUTPUT
$$CFILE -fPIC

-D$(TARGET) $(TARGET_CFLAGS)"; \

	   gcc -nostartfiles -shared -rdynamic -o $$OUTPUT $$CFILE
-fPIC -D$(TARGET)

$(TARGET_CFLAGS); \

       done


It prevents the re-compilation of echo.c and dminfo.c, and of Luc
Chouinard's upcoming sial.c extension module.  (SIAL is an alternative
crash extension mechanism -- more on that when it's available...)

Anyway, I've tried screwing around with the Makefile to use a generic
*.so target, using $@, $(basename ...) and so on, but I'm not a Makefile
master, and I cannot quite get it quite right, although I'm sure it can
be done.

So if anybody out there can do it cleaner than the "contrib" target above,
I'd like to take a look.


Try this.

Cheers,

Jeff


Awesome! -- but see below...

--- crash-4.0/extensions/Makefile.orig	2007-09-20 16:35:36.000000000 -0400
+++ crash-4.0/extensions/Makefile	2007-09-20 16:35:42.000000000 -0400
@@ -26,18 +26,15 @@
# - create a compile stanza below, typically using "echo.so" as # a base template. # +CONTRIB_SRC := $(wildcard *.c)
+CONTRIB_SO := $(patsubst %.c,%.so,$(wildcard *.c))
-all: link_defs $(OBJECTS)
+all: link_defs $(OBJECTS) $(CONTRIB_SO)
 	
 link_defs:
 	@if [ ! -f defs.h ]; then \
ln -s ../defs.h; fi -echo.so: ../defs.h echo.c
-	gcc -nostartfiles -shared -rdynamic -o echo.so echo.c -fPIC \
-				 		-D$(TARGET) $(TARGET_CFLAGS)
-
-dminfo.so: ../defs.h dminfo.c
-	gcc -nostartfiles -shared -rdynamic -o dminfo.so dminfo.c -fPIC \
-				 		-D$(TARGET) $(TARGET_CFLAGS)
-	
+$(CONTRIB_SO): $(CONTRIB_SRC)
+	gcc -nostartfiles -shared -rdynamic -o $@ $< -fPIC \
+						-D$(TARGET) $(TARGET_CFLAGS)


Question...

Can the above be done, but with one of the other specific
*.so targets still in place?  I ask because the sial.c
extension module *does* need a unique compile line (to
include an extra libsial.a library, some -I targets, etc.).

So I would still need to be able to exclude the sial.c file
from being built as above, as well as having its own target
in the Makefile.  And my earlier clumsy attempts kept "colliding"
with the other echo.so and dminfo.so targets.

Thanks,
  Dave





--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/crash-utility

[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux