zsh-workers
 help / color / mirror / code / Atom feed
* linked-in modules
@ 1996-12-22 18:20 Zefram
  1996-12-23  2:51 ` Zoltan Hidvegi
  0 siblings, 1 reply; 5+ messages in thread
From: Zefram @ 1996-12-22 18:20 UTC (permalink / raw)
  To: Z Shell workers mailing list

-----BEGIN PGP SIGNED MESSAGE-----

This patch makes the linked-in modules mechanism more general.  It makes
it available whether dynamic loading is available or not, the way I
originally intended it.  It also avoids a lot of special-casing in
the Makefiles, so that the Makefile only needs to know specially about
modules that have more than one source file (currently only zle).

 -zefram

      Index: Src/Makefile.in
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/Src/Makefile.in,v
      retrieving revision 1.1.1.13
      diff -c -r1.1.1.13 Makefile.in
      *** Src/Makefile.in	1996/12/22 01:13:16	1.1.1.13
      --- Src/Makefile.in	1996/12/22 04:17:55
      ***************
      *** 75,81 ****
        prefix='$(prefix)' exec_prefix='$(exec_prefix)' bindir='$(bindir)' \
        libdir='$(libdir)' infodir='$(infodir)' mandir='$(mandir)' manext='$(manext)'
        
      ! MODBINS = $(srcdir)/modules-bltin
        
        DLEXT=.$(DL_EXT)
        NLEXT=._foobarbaz_
      --- 75,81 ----
        prefix='$(prefix)' exec_prefix='$(exec_prefix)' bindir='$(bindir)' \
        libdir='$(libdir)' infodir='$(infodir)' mandir='$(mandir)' manext='$(manext)'
        
      ! MODBINS = modules-bltin
        
        DLEXT=.$(DL_EXT)
        NLEXT=._foobarbaz_
      ***************
      *** 131,137 ****
        system.h zsh.h ztype.h Zle/zle.h
        
        # zsh headers necessary for compilation
      ! HDRS = $(DIST_HDRS) signames.h @RLIMITS_SRC_H@ ../config.h
        
        # zsh C source included in distribution
        DIST_SRCS = builtin.c compat.c cond.c exec.c glob.c hashtable.c hist.c \
      --- 131,137 ----
        system.h zsh.h ztype.h Zle/zle.h
        
        # zsh headers necessary for compilation
      ! HDRS = $(DIST_HDRS) signames.h zshxmods.h @RLIMITS_SRC_H@ ../config.h
        
        # zsh C source included in distribution
        DIST_SRCS = builtin.c compat.c cond.c exec.c glob.c hashtable.c hist.c \
      ***************
      *** 142,167 ****
        Zle/zle_vi.c Zle/zle_word.c Zle/zle.h Zle/compctl.c $(DIST_HDRS)
        
        # generated prototypes
      - DYNAMIC_PROTO =
      - NYNAMIC_PROTO = Zle/zle_bindings.pro Zle/zle_hist.pro \
      - Zle/zle_main.pro Zle/zle_misc.pro Zle/zle_move.pro Zle/zle_refresh.pro \
      - Zle/zle_tricky.pro Zle/zle_utils.pro Zle/zle_vi.pro Zle/zle_word.pro \
      - Zle/zle_deltochar.pro Zle/compctl.pro
      - 
        PROTO = builtin.pro compat.pro cond.pro exec.pro glob.pro hashtable.pro \
        hist.pro init.pro input.pro jobs.pro lex.pro linklist.pro loop.pro \
        main.pro math.pro mem.pro module.pro params.pro parse.pro prompt.pro \
      ! signals.pro subst.pro text.pro utils.pro watch.pro $(@D@YNAMIC_PROTO)
        
        # object files
      - DYNAMIC_OBJS =
      - NYNAMIC_OBJS = Zle/zle_bindings.o Zle/zle_hist.o Zle/zle_main.o \
      - Zle/zle_misc.o Zle/zle_move.o Zle/zle_refresh.o Zle/zle_tricky.o \
      - Zle/zle_utils.o Zle/zle_vi.o Zle/zle_word.o Zle/compctl.o
        LIBOBJS = builtin.o compat.o cond.o exec.o glob.o hashtable.o \
        hist.o init.o input.o jobs.o lex.o linklist.o loop.o math.o mem.o \
        module.o params.o parse.o prompt.o signals.o subst.o text.o \
      ! utils.o watch.o $(@D@YNAMIC_OBJS)
        
        # dynamically loadable modules
        MODULE_DIRS = Modules Zle
      --- 142,157 ----
        Zle/zle_vi.c Zle/zle_word.c Zle/zle.h Zle/compctl.c $(DIST_HDRS)
        
        # generated prototypes
        PROTO = builtin.pro compat.pro cond.pro exec.pro glob.pro hashtable.pro \
        hist.pro init.pro input.pro jobs.pro lex.pro linklist.pro loop.pro \
        main.pro math.pro mem.pro module.pro params.pro parse.pro prompt.pro \
      ! signals.pro subst.pro text.pro utils.pro watch.pro
        
        # object files
        LIBOBJS = builtin.o compat.o cond.o exec.o glob.o hashtable.o \
        hist.o init.o input.o jobs.o lex.o linklist.o loop.o math.o mem.o \
        module.o params.o parse.o prompt.o signals.o subst.o text.o \
      ! utils.o watch.o
        
        # dynamically loadable modules
        MODULE_DIRS = Modules Zle
      ***************
      *** 169,191 ****
        
        LOBJS = main.o
        NOBJS = $(LIBOBJS) main.o
        
        OBJS = $(LIBOBJS) $(LOBJS)
        
        LIBZSH = libzsh.so.$(VERSION)
        NIBZSH =
        
        # ========= DEPENDENCIES FOR BUILDING ==========
        
        # default target
      ! all: zsh modules
        
      ! modules: $(PROTO) $(ANSI@U@KNR) $(MO@D@ULE_DIRS)
        
      ! zsh: $(PROTO) $(ANSI@U@KNR) $(@L@IBZSH) $(@L@OBJS)
      ! 	$(LINK) $(@L@OBJS) $(LIBS)
        
      ! $(LIBZSH): $(LIBOBJS)
        	$(DLLD) $(LDFLAGS) $(DLLDFLAGS) -o $(LIBZSH) $(LIBOBJS) $(NLIST)
        	ln -sf $(LIBZSH) libzsh.so
        
      --- 159,199 ----
        
        LOBJS = main.o
        NOBJS = $(LIBOBJS) main.o
      + LSTMP =
      + LLIST =
      + NSTMP = stamp-modobjs
      + NLIST = `cat stamp-modobjs`
        
        OBJS = $(LIBOBJS) $(LOBJS)
        
        LIBZSH = libzsh.so.$(VERSION)
        NIBZSH =
        
      + # default linked-in modules
      + 
      + XMODS = zle compctl
      + XMODDEPS = compctl:zle
      + 
      + DYNAMIC_XMODS =
      + NYNAMIC_XMODS = $(XMODS)
      + 
      + ZLE_OBJS = Zle/zle_bindings.o Zle/zle_hist.o Zle/zle_main.o Zle/zle_misc.o \
      + Zle/zle_move.o Zle/zle_refresh.o Zle/zle_tricky.o Zle/zle_utils.o \
      + Zle/zle_vi.o Zle/zle_word.o
      + 
        # ========= DEPENDENCIES FOR BUILDING ==========
        
        # default target
      ! all: bin modules
      ! 
      ! modules: proto $(ANSI@U@KNR) $(MO@D@ULE_DIRS)
        
      ! bin: proto zsh
        
      ! zsh: $(ANSI@U@KNR) $(@L@IBZSH) $(@L@OBJS) $(@L@STMP)
      ! 	$(LINK) $(@L@OBJS) $(@L@LIST) $(LIBS)
        
      ! $(LIBZSH): $(LIBOBJS) $(NSTMP)
        	$(DLLD) $(LDFLAGS) $(DLLDFLAGS) -o $(LIBZSH) $(LIBOBJS) $(NLIST)
        	ln -sf $(LIBZSH) libzsh.so
        
      ***************
      *** 207,212 ****
      --- 215,222 ----
        
        init.o: bltinmods.list zshpaths.h
        
      + module.o: zshxmods.h
      + 
        $(MODULE_DIRS): FORCE
        	@cd $@ && $(MAKE) $(MAKEDEFS) modules
        
      ***************
      *** 225,232 ****
      --- 235,308 ----
        	    echo "DOMOD(boot_$$mod)"; \
        	done ) > $@
        
      + zshxmods.h: $(MODBINS)
      + 	( \
      + 	    modbins=" `cat $(MODBINS)` "; \
      + 	    for mod in $(XMODS); do \
      + 		case $$modbins in \
      + 		    *" $$mod "*) \
      + 			for dep in $(XMODDEPS); do \
      + 			    case $$dep in \
      + 				$$mod:*) \
      + 				    d=`echo $$dep | sed 's/.*://'`; \
      + 				    case $$modbins in \
      + 					*" $$d "*) ;; \
      + 					*)  rm -f $@; \
      + 					    echo >&2 "Linked-in module \`$$mod' depends on non-linked-in module \`$$d'!"; \
      + 					    exit 1 ;; \
      + 				    esac ;; \
      + 			    esac; \
      + 			done; \
      + 			echo "#define   LINKED_XMOD_$$mod 1" ;; \
      + 		    *)  echo "#define UNLINKED_XMOD_$$mod 1" ;; \
      + 		esac; \
      + 	    done; \
      + 	) > $@
      + 
      + $(MODBINS):
      + 	echo $(@D@YNAMIC_XMODS) > $@
      + 
      + proto: $(PROTO)
      + 	@for dir in $(MODULE_DIRS); do \
      + 	    ( cd $$dir && $(MAKE) $(MAKEDEFS) proto ) || exit 1; \
      + 	done
      + 
        $(PROTO): makepro.sed
        
      + $(NSTMP): FORCE
      + 	@dn=true; \
      + 	test -f $(NSTMP) || dn=false; \
      + 	echo > $(NSTMP).tmp; \
      + 	for mod in `cat $(MODBINS)`; do \
      + 	    case $$mod in \
      + 		zle) objs="$(ZLE_OBJS)" ;; \
      + 		*) \
      + 		    for dir in $(MODULE_DIRS) NOWHERE; do \
      + 			if test .$$dir = .NOWHERE; then \
      + 			    echo >&2 \
      + 			      "WARNING: don't know how to build module $$mod"; \
      + 			    continue 2; \
      + 			elif test -f $(srcdir)/$$dir/$$mod.c; then \
      + 			    objs=$$dir/$$mod.o; \
      + 			    break; \
      + 			fi; \
      + 		    done ;; \
      + 	    esac; \
      + 	    echo Making $${objs}:; \
      + 	    $(MAKE) $(MAKEDEFS) $$objs || exit 1; \
      + 	    echo $$objs >> $(NSTMP).tmp; \
      + 	    for obj in $$objs; do \
      + 		test $$obj -nt $(NSTMP) && dn=false; \
      + 	    done; \
      + 	done; \
      + 	if $$dn && cmp -s $(NSTMP).tmp $(NSTMP); then \
      + 	    rm -f $(NSTMP).tmp; \
      + 	    echo "\`$(NSTMP)' is up to date."; \
      + 	else \
      + 	    mv -f $(NSTMP).tmp $(NSTMP); \
      + 	    echo "Updated \`$(NSTMP)'."; \
      + 	fi
      + 
        FORCE:
        
        # ========== DEPENDENCIES FOR INSTALLING ==========
      ***************
      *** 269,275 ****
        
        clean: mostlyclean
        	rm -f zsh ansi2knr $(@D@LCLEAN) signames.h rlimits.h \
      ! 	      zshpaths.h bltinmods.list *.*.c *.pro
        
        distclean: clean
        	rm -f Makefile
      --- 345,351 ----
        
        clean: mostlyclean
        	rm -f zsh ansi2knr $(@D@LCLEAN) signames.h rlimits.h \
      ! 	      zshpaths.h bltinmods.list zshxmods.h *.*.c *.pro
        
        distclean: clean
        	rm -f Makefile
      Index: Src/globals.h
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/Src/globals.h,v
      retrieving revision 1.1.1.27
      diff -c -r1.1.1.27 globals.h
      *** Src/globals.h	1996/12/22 01:13:23	1.1.1.27
      --- Src/globals.h	1996/12/22 03:58:40
      ***************
      *** 559,579 ****
        /* flag for whether terminal has automargin (wraparound) capability */
        EXTERN int hasam;
        
      ! #ifdef ZLE_MODULE
        # ifdef GLOBALS
        void (*trashzleptr) _((void)) = noop_function;
        unsigned char * (*zlereadptr) _((char *lp, char *rp)) = load_zleread;
        void (*spaceinlineptr) _((int)) = noop_function_int;
        void (*gotwordptr) _((void)) = noop_function;
        void (*refreshptr) _((void)) = noop_function;
      ! # else
        extern void (*trashzleptr) _((void));
        extern unsigned char * (*zlereadptr) _((char *lp, char *rp));
        extern void (*spaceinlineptr) _((int));
        extern void (*gotwordptr) _((void));
        extern void (*refreshptr) _((void));
      ! # endif
      ! #endif
        
        /* pid of process undergoing 'process substitution' */
         
      --- 559,579 ----
        /* flag for whether terminal has automargin (wraparound) capability */
        EXTERN int hasam;
        
      ! #ifdef UNLINKED_XMOD_zle
        # ifdef GLOBALS
        void (*trashzleptr) _((void)) = noop_function;
        unsigned char * (*zlereadptr) _((char *lp, char *rp)) = load_zleread;
        void (*spaceinlineptr) _((int)) = noop_function_int;
        void (*gotwordptr) _((void)) = noop_function;
        void (*refreshptr) _((void)) = noop_function;
      ! # else /* !GLOBALS */
        extern void (*trashzleptr) _((void));
        extern unsigned char * (*zlereadptr) _((char *lp, char *rp));
        extern void (*spaceinlineptr) _((int));
        extern void (*gotwordptr) _((void));
        extern void (*refreshptr) _((void));
      ! # endif /* !GLOBALS */
      ! #endif /* UNLINKED_XMOD_zle */
        
        /* pid of process undergoing 'process substitution' */
         
      Index: Src/init.c
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/Src/init.c,v
      retrieving revision 1.1.1.28
      diff -c -r1.1.1.28 init.c
      *** Src/init.c	1996/12/22 01:13:26	1.1.1.28
      --- Src/init.c	1996/12/22 04:16:27
      ***************
      *** 545,557 ****
            createnameddirtable();  /* create hash table for named directories */
            createparamtable();     /* create paramater hash table             */
        
      ! #ifdef ZLE_MODULE
      !     add_dep("compctl", "zle");
            addbuiltin("bindkey", 0, NULL, 0, -1, "zle");
            addbuiltin("vared", 0, NULL, 1, 7, "zle");
      !     addbuiltin("compctl", 0, NULL, 0, -1, "compctl");
        #endif
        
        #ifdef HAVE_GETRLIMIT
            for (i = 0; i != RLIM_NLIMITS; i++) {
        	getrlimit(i, current_limits + i);
      --- 545,566 ----
            createnameddirtable();  /* create hash table for named directories */
            createparamtable();     /* create paramater hash table             */
        
      ! #ifdef UNLINKED_XMOD_zle
            addbuiltin("bindkey", 0, NULL, 0, -1, "zle");
            addbuiltin("vared", 0, NULL, 1, 7, "zle");
      ! #endif /* UNLINKED_XMOD_zle */
      ! 
      ! #ifdef LINKED_XMOD_zle
      ! # define ZLE_DEP(mod)
      ! #else
      ! # define ZLE_DEP(mod) add_dep((mod), "zle")
        #endif
        
      + #ifdef UNLINKED_XMOD_compctl
      +     addbuiltin("compctl", 0, NULL, 0, -1, "compctl");
      +     ZLE_DEP("compctl");
      + #endif /* UNLINKED_XMOD_compctl */
      + 
        #ifdef HAVE_GETRLIMIT
            for (i = 0; i != RLIM_NLIMITS; i++) {
        	getrlimit(i, current_limits + i);
      ***************
      *** 784,790 ****
            source(buf);
        }
        
      - #ifndef DYNAMIC
        #define DOMOD(boot) int boot(Module);
        #include "bltinmods.list"
        #undef DOMOD
      --- 793,798 ----
      ***************
      *** 797,800 ****
        #include "bltinmods.list"
        #undef DOMOD
        }
      - #endif /*!DYNAMIC*/
      --- 805,807 ----
      Index: Src/main.c
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/Src/main.c,v
      retrieving revision 1.1.1.2
      diff -c -r1.1.1.2 main.c
      *** Src/main.c	1996/12/22 01:13:28	1.1.1.2
      --- Src/main.c	1996/12/22 01:32:06
      ***************
      *** 68,76 ****
            setupvals();
            init_signals();
            global_heapalloc();
      - #ifndef DYNAMIC
            init_bltinmods();
      - #endif
            run_init_scripts();
            init_misc();
        
      --- 68,74 ----
      Index: Src/module.c
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/Src/module.c,v
      retrieving revision 1.1.1.3
      diff -c -r1.1.1.3 module.c
      *** Src/module.c	1996/12/22 01:13:30	1.1.1.3
      --- Src/module.c	1996/12/22 04:16:34
      ***************
      *** 410,416 ****
            return ret;
        }
        
      ! #ifdef ZLE_MODULE
        typedef void (*Voidfn) _((void));
        
        static struct symbols {
      --- 410,416 ----
            return ret;
        }
        
      ! #ifdef UNLINKED_XMOD_zle
        typedef void (*Voidfn) _((void));
        
        static struct symbols {
      ***************
      *** 481,485 ****
        	return (unsigned char *)shingetline();
            }
        }
      ! #endif /* ZLE_MODULE */
        #endif /* DYNAMIC */
      --- 481,485 ----
        	return (unsigned char *)shingetline();
            }
        }
      ! #endif /* UNLINKED_XMOD_zle */
        #endif /* DYNAMIC */
      Index: Src/zsh.h
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/Src/zsh.h,v
      retrieving revision 1.1.1.26
      diff -c -r1.1.1.26 zsh.h
      *** Src/zsh.h	1996/12/22 01:13:37	1.1.1.26
      --- Src/zsh.h	1996/12/22 04:16:13
      ***************
      *** 38,52 ****
        #include <config.h>
        #include <system.h>
        
      ! #ifdef DYNAMIC
      ! # ifndef MODULE
      ! #  define ZLE_MODULE
      ! #  define trashzle()      trashzleptr()
      ! #  define zleread(X,Y)    zlereadptr(X,Y)
      ! #  define spaceinline(X)  spaceinlineptr(X)
      ! #  define gotword()       gotwordptr()
      ! #  define refresh()       refreshptr()
      ! # endif
        #endif
        
        /* A few typical macros */
      --- 38,51 ----
        #include <config.h>
        #include <system.h>
        
      ! #include "zshxmods.h"
      ! 
      ! #if defined(UNLINKED_XMOD_zle) && !defined(IN_ZLE)
      ! # define trashzle()      trashzleptr()
      ! # define zleread(X,Y)    zlereadptr(X,Y)
      ! # define spaceinline(X)  spaceinlineptr(X)
      ! # define gotword()       gotwordptr()
      ! # define refresh()       refreshptr()
        #endif
        
        /* A few typical macros */
      ***************
      *** 1303,1309 ****
        #include "signals.h"
        #include "prototypes.h"
        #include "globals.h"
      ! #if !defined(ZLE_MODULE) && !defined(MODULE)
        # include "zle.h"
        #endif
        #include "hashtable.h"
      --- 1302,1308 ----
        #include "signals.h"
        #include "prototypes.h"
        #include "globals.h"
      ! #if defined(LINKED_XMOD_zle) && !defined(MODULE)
        # include "zle.h"
        #endif
        #include "hashtable.h"
      Index: Src/Modules/Makefile.in
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/Src/Modules/Makefile.in,v
      retrieving revision 1.1.1.1
      diff -c -r1.1.1.1 Makefile.in
      *** Src/Modules/Makefile.in	1996/12/22 01:13:38	1.1.1.1
      --- Src/Modules/Makefile.in	1996/12/22 02:34:47
      ***************
      *** 96,102 ****
        # default target
        all: modules
        
      ! modules: $(PROTO) $(MODULES)
        
        # ========== DEPENDENCIES FOR INSTALLING ==========
        
      --- 96,106 ----
        # default target
        all: modules
        
      ! modules: proto $(MODULES)
      ! 
      ! proto: $(PROTO)
      ! 
      ! $(PROTO): ../makepro.sed
        
        # ========== DEPENDENCIES FOR INSTALLING ==========
        
      Index: Src/Zle/Makefile.in
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/Src/Zle/Makefile.in,v
      retrieving revision 1.1.1.1
      diff -c -r1.1.1.1 Makefile.in
      *** Src/Zle/Makefile.in	1996/12/22 01:13:38	1.1.1.1
      --- Src/Zle/Makefile.in	1996/12/22 02:34:24
      ***************
      *** 105,116 ****
        # default target
        all: modules
        
      ! modules: $(PROTO) $(MODULES)
        
        zle.so: $(ZLEOBJS)
        	$(LINK) $(ZLEOBJS)
        
        $(OBJS): $(HDRS)
        
        # ========== DEPENDENCIES FOR INSTALLING ==========
        
      --- 105,120 ----
        # default target
        all: modules
        
      ! modules: proto $(MODULES)
        
        zle.so: $(ZLEOBJS)
        	$(LINK) $(ZLEOBJS)
        
        $(OBJS): $(HDRS)
      + 
      + proto: $(PROTO)
      + 
      + $(PROTO): ../makepro.sed
        
        # ========== DEPENDENCIES FOR INSTALLING ==========
        
      Index: Src/Zle/zle.h
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/Src/Zle/zle.h,v
      retrieving revision 1.1.1.1
      diff -c -r1.1.1.1 zle.h
      *** Src/Zle/zle.h	1996/12/22 01:13:39	1.1.1.1
      --- Src/Zle/zle.h	1996/12/22 03:13:55
      ***************
      *** 32,37 ****
      --- 32,38 ----
        #ifndef _ZLE_H
        #define _ZLE_H
        
      + #define IN_ZLE
        #include "zsh.h"
        
        #ifdef ZLEGLOBALS
      Index: Src/Zle/zle_main.c
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/Src/Zle/zle_main.c,v
      retrieving revision 1.1.1.1
      diff -c -r1.1.1.1 zle_main.c
      *** Src/Zle/zle_main.c	1996/12/22 01:13:39	1.1.1.1
      --- Src/Zle/zle_main.c	1996/12/22 03:53:01
      ***************
      *** 1359,1365 ****
        /* Compctl Hash Table Functions */
        /********************************/
        
      ! #ifndef MODULE
        void printcompctlp _((HashNode hn, int printflags));
        #endif
        
      --- 1359,1365 ----
        /* Compctl Hash Table Functions */
        /********************************/
        
      ! #ifdef LINKED_XMOD_compctl
        void printcompctlp _((HashNode hn, int printflags));
        #endif
        
      ***************
      *** 1379,1385 ****
            compctltab->disablenode = NULL;
            compctltab->enablenode  = NULL;
            compctltab->freenode    = freecompctlp;
      ! #ifdef MODULE
            compctltab->printnode   = NULL;
        #else
            compctltab->printnode   = printcompctlp;
      --- 1379,1385 ----
            compctltab->disablenode = NULL;
            compctltab->enablenode  = NULL;
            compctltab->freenode    = freecompctlp;
      ! #ifndef LINKED_XMOD_compctl
            compctltab->printnode   = NULL;
        #else
            compctltab->printnode   = printcompctlp;

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBMrzFqnD/+HJTpU/hAQGnwQP/ZbFKW6dCj1aybJb/VwsK9KUO45eriqFM
VNh+pem2w1DI2/7momuW9j0ED2LMc6ne9ds05tvwt/K9VE0N2njdopjMZM1YxKS4
3atsgvVvFs9oDxtyDxklpLLHU0GAgx4FUq6GJ3NCC6Dd4bro9zdnWNPKXKWudZvj
1XV2Htedx3s=
=jHYT
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: linked-in modules
  1996-12-22 18:20 linked-in modules Zefram
@ 1996-12-23  2:51 ` Zoltan Hidvegi
  1996-12-23 20:07   ` Zefram
  0 siblings, 1 reply; 5+ messages in thread
From: Zoltan Hidvegi @ 1996-12-23  2:51 UTC (permalink / raw)
  To: Zefram; +Cc: zsh-workers

> This patch makes the linked-in modules mechanism more general.  It makes
> it available whether dynamic loading is available or not, the way I
> originally intended it.  It also avoids a lot of special-casing in
> the Makefiles, so that the Makefile only needs to know specially about
> modules that have more than one source file (currently only zle).

This Makefile will soon become the most complicated part of zsh.  Here
are some more Makefile changes on the top of Zefram's patch.  It makes
some rules silent.  It cleans up the cleanup rules.

And the biggest change (at least for me): I reworote proto rule to get
parallel make compile zsh without problems (at the university I use a
dual PPro 200, which can compile everything in about 40 seconds this
way).

Zoltan


*** Src/Makefile.in.zefram	Mon Dec 23 00:57:19 1996
--- Src/Makefile.in	Mon Dec 23 03:42:38 1996
***************
*** 154,160 ****
  utils.o watch.o
  
  # dynamically loadable modules
! MODULE_DIRS = Modules Zle
  MONULE_DIRS =
  
  LOBJS = main.o
--- 154,160 ----
  utils.o watch.o
  
  # dynamically loadable modules
! MODULE_DIRS = $(MODULE_DIR) Zle
  MONULE_DIRS =
  
  LOBJS = main.o
***************
*** 186,194 ****
  # default target
  all: bin modules
  
! modules: proto $(ANSI@U@KNR) $(MO@D@ULE_DIRS)
  
! bin: proto zsh
  
  zsh: $(ANSI@U@KNR) $(@L@IBZSH) $(@L@OBJS) $(@L@STMP)
  	$(LINK) $(@L@OBJS) $(@L@LIST) $(LIBS)
--- 186,194 ----
  # default target
  all: bin modules
  
! modules: $(ANSI@U@KNR) $(MO@D@ULE_DIRS)
  
! bin: zsh
  
  zsh: $(ANSI@U@KNR) $(@L@IBZSH) $(@L@OBJS) $(@L@STMP)
  	$(LINK) $(@L@OBJS) $(@L@LIST) $(LIBS)
***************
*** 211,223 ****
  	$(AWK) -f $(srcdir)/rlimits.awk $(RLIMITS_INC_H) > rlimits.h || \
  	    echo WARNING: unknown limits:  mail rlimits.h to developers
  
! $(OBJS): $(HDRS)
  
  init.o: bltinmods.list zshpaths.h
  
! module.o: zshxmods.h
! 
! $(MODULE_DIRS): FORCE
  	@cd $@ && $(MAKE) $(MAKEDEFS) modules
  
  zshpaths.h: FORCE
--- 211,221 ----
  	$(AWK) -f $(srcdir)/rlimits.awk $(RLIMITS_INC_H) > rlimits.h || \
  	    echo WARNING: unknown limits:  mail rlimits.h to developers
  
! $(OBJS): proto $(HDRS)
  
  init.o: bltinmods.list zshpaths.h
  
! $(MODULE_DIRS): $(PROTO) $(HDRS) FORCE
  	@cd $@ && $(MAKE) $(MAKEDEFS) modules
  
  zshpaths.h: FORCE
***************
*** 236,242 ****
  	done ) > $@
  
  zshxmods.h: $(MODBINS)
! 	( \
  	    modbins=" `cat $(MODBINS)` "; \
  	    for mod in $(XMODS); do \
  		case $$modbins in \
--- 234,241 ----
  	done ) > $@
  
  zshxmods.h: $(MODBINS)
! 	@echo "Creating \`$@'."
! 	@( \
  	    modbins=" `cat $(MODBINS)` "; \
  	    for mod in $(XMODS); do \
  		case $$modbins in \
***************
*** 262,271 ****
  $(MODBINS):
  	echo $(@D@YNAMIC_XMODS) > $@
  
! proto: $(PROTO)
! 	@for dir in $(MODULE_DIRS); do \
! 	    ( cd $$dir && $(MAKE) $(MAKEDEFS) proto ) || exit 1; \
! 	done
  
  $(PROTO): makepro.sed
  
--- 261,267 ----
  $(MODBINS):
  	echo $(@D@YNAMIC_XMODS) > $@
  
! proto: $(PROTO) proto-recursive FORCE
  
  $(PROTO): makepro.sed
  
***************
*** 288,294 ****
  			fi; \
  		    done ;; \
  	    esac; \
- 	    echo Making $${objs}:; \
  	    $(MAKE) $(MAKEDEFS) $$objs || exit 1; \
  	    echo $$objs >> $(NSTMP).tmp; \
  	    for obj in $$objs; do \
--- 284,289 ----
***************
*** 324,359 ****
  	-if [ -f $(bindir)/zsh ]; then rm -f $(bindir)/zsh; fi
  	-if [ -f $(bindir)/zsh-$(VERSION) ]; then rm -f $(bindir)/zsh-$(VERSION); fi
  
! # install modules
! install.modules:
! 	for dir in $(MO@D@ULE_DIRS); do \
! 		(cd $$dir && make install.modules); \
! 	done
! 
! # uninstall modules
! uninstall.modules:
! 	for dir in $(MO@D@ULE_DIRS); do \
! 		(cd $$dir && make uninstall.modules); \
  	done
  
  # ========== DEPENDENCIES FOR CLEANUP ==========
  
! DLCLEAN = $(MODULE_DIR)/*.$(DL_EXT) $(MODULE_DIR)/*.*.[co] $(MODULE_DIR)/*.pro
! NLCLEAN =
! mostlyclean:
! 	rm -f core stamp-modobjs* *.o $(MODULE_DIR)/*.o *~
! 
! clean: mostlyclean
! 	rm -f zsh ansi2knr $(@D@LCLEAN) signames.h rlimits.h \
! 	      zshpaths.h bltinmods.list zshxmods.h *.*.c *.pro
  
! distclean: clean
  	rm -f Makefile
  
! realclean: distclean
  	rm -f TAGS tags
  
! superclean: realclean
  
  # ========== DEPENDENCIES FOR MAINTENANCE ==========
  
--- 319,358 ----
  	-if [ -f $(bindir)/zsh ]; then rm -f $(bindir)/zsh; fi
  	-if [ -f $(bindir)/zsh-$(VERSION) ]; then rm -f $(bindir)/zsh-$(VERSION); fi
  
! # install/uninstall modules
! install.modules uninstall.modules:
! 	@for dir in $(MO@D@ULE_DIRS); do \
! 		(cd $$dir && $(MAKE) $(MAKEDEFS) $@); \
  	done
  
  # ========== DEPENDENCIES FOR CLEANUP ==========
  
! mostlyclean: mostlyclean-recursive mostlyclean-src
! clean:       clean-recursive       clean-src
! distclean:   distclean-recursive   distclean-src
! realclean:   realclean-recursive   realclean-src
! superclean:  superclean-recursive  superclean-src
! 
! mostlyclean-src:
! 	rm -f core stamp-modobjs* *.o
! 
! clean-src: mostlyclean-src
! 	rm -f zsh ansi2knr signames.h rlimits.h zshpaths.h \
! 	      $(MODBINS) bltinmods.list zshxmods.h *.*.c *.pro
  
! distclean-src: clean-src
  	rm -f Makefile
  
! realclean-src: distclean-src
  	rm -f TAGS tags
  
! superclean-src: realclean-src
! 
! mostlyclean-recursive clean-recursive distclean-recursive realclean-recursive superclean-recursive proto-recursive:
! 	@for dir in $(MODULE_DIRS); do \
! 	    target=`echo $@ | sed s/-recursive//`; \
! 	    (cd $$dir && $(MAKE) $(MAKEDEFS) $$target) || exit 1; \
! 	done
  
  # ========== DEPENDENCIES FOR MAINTENANCE ==========
  
*** Src/Modules/Makefile.in.zefram	Mon Dec 23 00:57:20 1996
--- Src/Modules/Makefile.in	Mon Dec 23 03:01:56 1996
***************
*** 96,102 ****
  # default target
  all: modules
  
! modules: proto $(MODULES)
  
  proto: $(PROTO)
  
--- 96,104 ----
  # default target
  all: modules
  
! modules: $(MODULES)
! 
! $(MODULES): proto
  
  proto: $(PROTO)
  
***************
*** 127,134 ****
  
  # ========== DEPENDENCIES FOR CLEANUP ==========
  
- DLCLEAN = $(MODULE_DIR)/*.$(DL_EXT) $(MODULE_DIR)/*.*.[co] $(MODULE_DIR)/*.pro
- NLCLEAN =
  mostlyclean:
  	rm -f core stamp-modobjs* *.o *.$(DL_EXT) *~
  
--- 129,134 ----
*** Src/Zle/Makefile.in.zefram	Mon Dec 23 00:57:20 1996
--- Src/Zle/Makefile.in	Mon Dec 23 03:01:32 1996
***************
*** 105,116 ****
  # default target
  all: modules
  
! modules: proto $(MODULES)
  
  zle.so: $(ZLEOBJS)
  	$(LINK) $(ZLEOBJS)
  
! $(OBJS): $(HDRS)
  
  proto: $(PROTO)
  
--- 105,116 ----
  # default target
  all: modules
  
! modules: $(MODULES)
  
  zle.so: $(ZLEOBJS)
  	$(LINK) $(ZLEOBJS)
  
! $(OBJS): proto $(HDRS)
  
  proto: $(PROTO)
  
***************
*** 141,148 ****
  
  # ========== DEPENDENCIES FOR CLEANUP ==========
  
- DLCLEAN = $(MODULE_DIR)/*.$(DL_EXT) $(MODULE_DIR)/*.*.[co] $(MODULE_DIR)/*.pro
- NLCLEAN =
  mostlyclean:
  	rm -f core stamp-modobjs* *.o *.$(DL_EXT) *~
  
--- 141,146 ----


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: linked-in modules
  1996-12-23  2:51 ` Zoltan Hidvegi
@ 1996-12-23 20:07   ` Zefram
  1996-12-24  3:01     ` Zoltan Hidvegi
  0 siblings, 1 reply; 5+ messages in thread
From: Zefram @ 1996-12-23 20:07 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: zefram, zsh-workers

Zoltan Hidvegi wrote:
>This Makefile will soon become the most complicated part of zsh.

You mean it's not already?  (I have another patch planned which will
make it even worse.)

>! MODULE_DIRS = Modules Zle
>--- 154,160 ----
>! MODULE_DIRS = $(MODULE_DIR) Zle

Why is Src/Modules identified as $(MODULE_DIR)?  We already have two
module directories, and you have suggested a Src/Builtins directory, so
Src/Modules is really not unique.

-zefram


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: linked-in modules
  1996-12-23 20:07   ` Zefram
@ 1996-12-24  3:01     ` Zoltan Hidvegi
  1996-12-24 11:34       ` Zefram
  0 siblings, 1 reply; 5+ messages in thread
From: Zoltan Hidvegi @ 1996-12-24  3:01 UTC (permalink / raw)
  To: Zefram; +Cc: zefram, zsh-workers

Zefram write:
> Zoltan Hidvegi wrote:
> >This Makefile will soon become the most complicated part of zsh.
> 
> You mean it's not already?  (I have another patch planned which will

Well there are still some trickery in exec.c which I'd like to understand
better.  Unfortunately with my previous patch in my attempt to get parallel
make work I did too much and make always wants to rebuild everything.  The
patch below backs up a bit so that parallel make will not work again (but
make -j3 proto && make -j3 still works).

> make it even worse.)

Oh!

> >! MODULE_DIRS = Modules Zle
> >--- 154,160 ----
> >! MODULE_DIRS = $(MODULE_DIR) Zle
> 
> Why is Src/Modules identified as $(MODULE_DIR)?  We already have two
> module directories, and you have suggested a Src/Builtins directory, so
> Src/Modules is really not unique.

Just for consistency.  But you are right that it would be more consistent
to use Modules everywhere and remove MODULE_DIR completely.

Zoltan


*** Src/Makefile.in	1996/12/24 01:31:03	3.1.1.2
--- Src/Makefile.in	1996/12/24 02:01:39
***************
*** 188,194 ****
  
  modules: $(ANSI@U@KNR) $(MO@D@ULE_DIRS)
  
! bin: zsh
  
  zsh: $(ANSI@U@KNR) $(@L@IBZSH) $(@L@OBJS) $(@L@STMP)
  	$(LINK) $(@L@OBJS) $(@L@LIST) $(LIBS)
--- 188,194 ----
  
  modules: $(ANSI@U@KNR) $(MO@D@ULE_DIRS)
  
! bin: proto zsh
  
  zsh: $(ANSI@U@KNR) $(@L@IBZSH) $(@L@OBJS) $(@L@STMP)
  	$(LINK) $(@L@OBJS) $(@L@LIST) $(LIBS)
***************
*** 211,217 ****
  	$(AWK) -f $(srcdir)/rlimits.awk $(RLIMITS_INC_H) > rlimits.h || \
  	    echo WARNING: unknown limits:  mail rlimits.h to developers
  
! $(OBJS): proto $(HDRS)
  
  init.o: bltinmods.list zshpaths.h
  
--- 211,217 ----
  	$(AWK) -f $(srcdir)/rlimits.awk $(RLIMITS_INC_H) > rlimits.h || \
  	    echo WARNING: unknown limits:  mail rlimits.h to developers
  
! $(OBJS): $(HDRS)
  
  init.o: bltinmods.list zshpaths.h
  
***************
*** 261,267 ****
  $(MODBINS):
  	echo $(@D@YNAMIC_XMODS) > $@
  
! proto: $(PROTO) proto-recursive FORCE
  
  $(PROTO): makepro.sed
  
--- 261,267 ----
  $(MODBINS):
  	echo $(@D@YNAMIC_XMODS) > $@
  
! proto: $(PROTO) proto-recursive
  
  $(PROTO): makepro.sed
  
*** Src/Zle/Makefile.in	1996/12/24 01:31:03	3.1.1.2
--- Src/Zle/Makefile.in	1996/12/24 02:00:05
***************
*** 105,116 ****
  # default target
  all: modules
  
! modules: $(MODULES)
  
  zle.so: $(ZLEOBJS)
  	$(LINK) $(ZLEOBJS)
  
! $(OBJS): proto $(HDRS)
  
  proto: $(PROTO)
  
--- 105,116 ----
  # default target
  all: modules
  
! modules: proto $(MODULES)
  
  zle.so: $(ZLEOBJS)
  	$(LINK) $(ZLEOBJS)
  
! $(OBJS): $(HDRS)
  
  proto: $(PROTO)
  
*** Src/Modules/Makefile.in	1996/12/24 01:31:03	3.1.1.2
--- Src/Modules/Makefile.in	1996/12/24 02:19:48
***************
*** 96,104 ****
  # default target
  all: modules
  
! modules: $(MODULES)
! 
! $(MODULES): proto
  
  proto: $(PROTO)
  
--- 96,102 ----
  # default target
  all: modules
  
! modules: proto $(MODULES)
  
  proto: $(PROTO)
  
PATCH END (without this some mailers chop the last line of the patch)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: linked-in modules
  1996-12-24  3:01     ` Zoltan Hidvegi
@ 1996-12-24 11:34       ` Zefram
  0 siblings, 0 replies; 5+ messages in thread
From: Zefram @ 1996-12-24 11:34 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: zefram, zsh-workers

-----BEGIN PGP SIGNED MESSAGE-----

Zoltan Hidvegi wrote:
>         Unfortunately with my previous patch in my attempt to get parallel
>make work I did too much and make always wants to rebuild everything.  The
>patch below backs up a bit so that parallel make will not work again (but
>make -j3 proto && make -j3 still works).

This alternative patch fixes that problem, and should also make
parallel building safe.

 -zefram

      *** Src/Makefile.in	1996/12/24 03:11:46	1.20
      --- Src/Makefile.in	1996/12/24 03:18:38
      ***************
      *** 186,196 ****
        # default target
        all: bin modules
        
      ! modules: $(ANSI@U@KNR) $(MO@D@ULE_DIRS)
        
      ! bin: zsh
        
      ! zsh: $(ANSI@U@KNR) $(@L@IBZSH) $(@L@OBJS) $(@L@STMP)
        	$(LINK) $(@L@OBJS) $(@L@LIST) $(LIBS)
        
        $(LIBZSH): $(LIBOBJS) $(NSTMP)
      --- 186,198 ----
        # default target
        all: bin modules
        
      ! modules: proto $(HDRS) $(ANSI@U@KNR)
      ! 	@test -z '$(MO@D@ULE_DIRS)' || $(MAKE) $(MAKEDEFS) $(MODULE_DIRS)
        
      ! bin: proto $(ANSI@U@KNR)
      ! 	@$(MAKE) $(MAKEDEFS) zsh
        
      ! zsh: $(@L@IBZSH) $(@L@OBJS) $(@L@STMP)
        	$(LINK) $(@L@OBJS) $(@L@LIST) $(LIBS)
        
        $(LIBZSH): $(LIBOBJS) $(NSTMP)
      ***************
      *** 211,221 ****
        	$(AWK) -f $(srcdir)/rlimits.awk $(RLIMITS_INC_H) > rlimits.h || \
        	    echo WARNING: unknown limits:  mail rlimits.h to developers
        
      ! $(OBJS): proto $(HDRS)
        
        init.o: bltinmods.list zshpaths.h
        
      ! $(MODULE_DIRS): $(PROTO) $(HDRS) FORCE
        	@cd $@ && $(MAKE) $(MAKEDEFS) modules
        
        zshpaths.h: FORCE
      --- 213,223 ----
        	$(AWK) -f $(srcdir)/rlimits.awk $(RLIMITS_INC_H) > rlimits.h || \
        	    echo WARNING: unknown limits:  mail rlimits.h to developers
        
      ! $(OBJS): $(HDRS)
        
        init.o: bltinmods.list zshpaths.h
        
      ! $(MODULE_DIRS): FORCE
        	@cd $@ && $(MAKE) $(MAKEDEFS) modules
        
        zshpaths.h: FORCE
      *** Src/Modules/Makefile.in	1996/12/24 03:11:49	1.8
      --- Src/Modules/Makefile.in	1996/12/24 03:19:35
      ***************
      *** 30,35 ****
      --- 30,36 ----
        VERSION = @VERSION@
        
        SHELL = /bin/sh
      + @SET_MAKE@
        
        top_srcdir = @top_srcdir@
        srcdir     = @srcdir@
      ***************
      *** 96,104 ****
        # default target
        all: modules
        
      ! modules: $(MODULES)
      ! 
      ! $(MODULES): proto
        
        proto: $(PROTO)
        
      --- 97,104 ----
        # default target
        all: modules
        
      ! modules: proto
      ! 	@$(MAKE) $(MAKEDEFS) $(MODULES)
        
        proto: $(PROTO)
        
      *** Src/Zle/Makefile.in	1996/12/24 03:11:50	1.7
      --- Src/Zle/Makefile.in	1996/12/24 03:16:52
      ***************
      *** 30,35 ****
      --- 30,36 ----
        VERSION = @VERSION@
        
        SHELL = /bin/sh
      + @SET_MAKE@
        
        top_srcdir = @top_srcdir@
        srcdir     = @srcdir@
      ***************
      *** 105,116 ****
        # default target
        all: modules
        
      ! modules: $(MODULES)
        
        zle.so: $(ZLEOBJS)
        	$(LINK) $(ZLEOBJS)
        
      ! $(OBJS): proto $(HDRS)
        
        proto: $(PROTO)
        
      --- 106,118 ----
        # default target
        all: modules
        
      ! modules: proto
      ! 	@$(MAKE) $(MAKEDEFS) $(MODULES)
        
        zle.so: $(ZLEOBJS)
        	$(LINK) $(ZLEOBJS)
        
      ! $(OBJS): $(HDRS)
        
        proto: $(PROTO)
        

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: ascii

iQCVAwUBMr+/unD/+HJTpU/hAQGNLAP+NLgRir2p38vFX8dQzVUkpaqNs2Eh5p06
Q3ThaE4babo9cam8rCELhYDr4IpSaO5oTOPiDuKXxdXVe1XhzfFPo09JauflLpxn
ERz8EO2kHByLuQClUZSDGI0nlW+ee1jFWVX7Wc52l15wbn0GBg8VZhlAkPUziWVh
7QfD0/vg/hU=
=1WYI
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1996-12-24 11:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-12-22 18:20 linked-in modules Zefram
1996-12-23  2:51 ` Zoltan Hidvegi
1996-12-23 20:07   ` Zefram
1996-12-24  3:01     ` Zoltan Hidvegi
1996-12-24 11:34       ` Zefram

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).