[Click] Patch: nsclick as a dynamic library

Bart Braem bart.braem at ua.ac.be
Thu Mar 2 07:28:02 EST 2006


Hello,

For those of you who do not like recompiling ns with every change in Click 
this might be an interesting patch. This one is against Click 1.4.3 but I 
guess it should be very similar for Click CVS.

To use it you should apply the patch (of course). Afterwards you should 
certainly remove /ns/libnsclick.a and do a make clean in Click. Then run your 
configure again and the new Makefile is generated.
Then you should either remove ns and nse or do a make clean in the ns 
distribution if you want to be very sure. Running make in the ns directory 
will then make your new ns that load Click dynamically.
In order to run ns you should either install the library system wide, add it 
to ld.so.conf (and run ldconfig) or use LD_LIBRARY_PATH.
I use that one, so going to tcl/ex in the ns distribution one should run Click 
as follows:
LD_LIBRARY_PATH=/somepathtoyourclickslashns/ ../../ns 
nsclick-simple-lan.tcl
Try changing something in Click, run make in click/ns and run ns: without 
recompiling ns you should be able to use the changed Click!

Any comments welcome, as usual
Bart

--- ns/Makefile.in.orig 2006-03-02 13:09:36.000000000 +0100
+++ ns/Makefile.in      2006-03-01 11:35:19.000000000 +0100
@@ -29,13 +29,13 @@
 .SUFFIXES: .S .c .cc .o .s .ii

 .c.o:
-       $(COMPILE) -c $<
+       $(COMPILE) -c -fpic $<
 .s.o:
-       $(COMPILE) -c $<
+       $(COMPILE) -c -fpic $<
 .S.o:
-       $(COMPILE) -c $<
+       $(COMPILE) -c -fpic $<
 .cc.o:
-       $(CXXCOMPILE) -c $<
+       $(CXXCOMPILE) -c -fpic $<
 .cc.ii:
        $(CXXCOMPILE) -E $< > $@

@@ -79,11 +79,10 @@
 CCLD = $(CC)
 LINK = $(CCLD) $(CFLAGS) $(LDFLAGS) -o $@

-all: libnsclick.a
+all: libnsclick.so

-libnsclick.a: Makefile $(LIBOBJS) $(OBJS)
-       $(AR_CREATE) libnsclick.a $(LIBOBJS) $(OBJS)
-       $(RANLIB) libnsclick.a
+libnsclick.so: Makefile $(LIBOBJS) $(OBJS)
+       $(CXX) -shared -o libnsclick.so $(LIBOBJS) $(OBJS)

 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
        cd $(top_builddir) \
@@ -105,14 +104,14 @@
 include $(DEPFILES)
 endif

-install: libnsclick.a
+install: libnsclick.so
        $(mkinstalldirs) $(DESTDIR)$(libdir)
-       $(INSTALL) libnsclick.a $(DESTDIR)$(libdir)/libnsclick.a
+       $(INSTALL) libnsclick.so $(DESTDIR)$(libdir)/libnsclick.so
 uninstall:
-       /bin/rm -f $(DESTDIR)$(libdir)/libnsclick.a
+       /bin/rm -f $(DESTDIR)$(libdir)/libnsclick.so

 clean:
-       rm -f *.d *.o elements.mk elements.cc elements.conf libnsclick.a
+       rm -f *.d *.o elements.mk elements.cc elements.conf libnsclick.so
 distclean: clean
        -rm -f Makefile




-- 
Bart Braem
PATS research group
Dept. of Mathematics and Computer Sciences
University of Antwerp
G2.36, Building G
Middelheimlaan 1
2020 Antwerpen, Belgium
Phone: +32 (0)3 265.35.19.
Fax: +32 (0)3 265.37.77.
Web: www.pats.ua.ac.be
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 309 bytes
Desc: not available
Url : https://amsterdam.lcs.mit.edu/pipermail/click/attachments/20060302/583a12bc/attachment.pgp


More information about the click mailing list