Re: RFC: crash extension module handling

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

 



On Thu, Sep 20, 2007 at 05:03:59PM -0400, Jeff Moyer wrote:
> Dave Anderson <anderson@xxxxxxxxxx> writes:
> 
> > 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.
> 
> If you list an explicit target for sial.so, then it will be used.  So,
> you'd explicity add sial.so to the all: line, then add a target for
> sial.so as you normally would.  Does that work for you?
> 
> If you think it will be common to build with different flags or
> libraries, this isn't going to work so well!
> 
> -Jeff
> 

Actually as a conincidence, recently I have also started playing with
merging libsial code with crash. I shall sync up with Luc Chouinard in
a separate thread and find out about his approach though I am quite far
to chalk out my own approach.

IIUC, Dave is ok with having extensions source files with crash src rpm?
Now, libsial has lot of .c files and keeping them in a separate directory
like extensions/libsial/*.c, should make sense and then have "make extensions"
build "libsial.so". I wonder if Jeff's approach can address the case of
having extension sources in a separate directory?

As of now, I am trying with this crude stuff added to extensions/Makfile

+libsial.so:
+       cd libsial; make -f Makefile

Thanks
Maneesh

-- 
Maneesh Soni
Linux Technology Center,
IBM India Systems and Technology Lab, 
Bangalore, India

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