Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
K&R compilation
- X-seq: zsh-workers 2417
- From: Zefram <zefram@xxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx (Z Shell workers mailing list)
- Subject: K&R compilation
- Date: Fri, 15 Nov 1996 13:36:43 +0000 (GMT)
-----BEGIN PGP SIGNED MESSAGE-----
I worked out this new way to do ANSI -> K&R conversions, that doesn't
need individual rules for each source file. This should make maintenance
easier. I also managed to extend it to cover module compilation; before
this patch modules could not be compiled with a non-ANSI compiler.
Comments other than "it's ugly" are welcome.
-zefram
Index: Src/Makefile.in
===================================================================
RCS file: /home/zefram/usr/cvsroot/zsh/Src/Makefile.in,v
retrieving revision 1.3
diff -c -r1.3 Makefile.in
*** Makefile.in 1996/11/09 14:32:28 1.3
--- Makefile.in 1996/11/15 05:19:58
***************
*** 69,88 ****
.SUFFIXES:
.SUFFIXES: .c .o $(@D@LEXT) .pro
.c$(@D@LEXT):
! $(COMPILE) $(DLCFLAGS) -o $@.o $<
$(DLLD) $(LDFLAGS) $(DLLDFLAGS) -o $@ $@.o
rm -f $@.o
.c.o:
! $(COMPILE) $<
.c.pro:
$(SED) -n -f $(srcdir)/makepro.sed $< > $@
- # this is for ansi2krn conversion
- U = @U@
-
# this header file is parsed to generate signal names (signames.h)
SIGNAL_H = @SIGNAL_H@
--- 69,91 ----
.SUFFIXES:
.SUFFIXES: .c .o $(@D@LEXT) .pro
+ DODLCOMPILE = $(COMPILE) $(DLCFLAGS) -o $@.o $<
+ DO_DLCOMPILE = base=`echo $< | $(SED) 's,.*/,,;s,\.c$$,,'`; \
+ ./ansi2knr $< > _$$base.c && $(COMPILE) $(DLCFLAGS) -o $@.o _$$base.c
.c$(@D@LEXT):
! $(DO@U@DLCOMPILE)
$(DLLD) $(LDFLAGS) $(DLLDFLAGS) -o $@ $@.o
rm -f $@.o
+ DOCOMPILE = $(COMPILE) $<
+ DO_COMPILE = base=`echo $< | $(SED) 's,.*/,,;s,\.c$$,,'`; \
+ ./ansi2knr $< > _$$base.c && $(COMPILE) -o $$base.o _$$base.c
.c.o:
! $(DO@U@COMPILE)
.c.pro:
$(SED) -n -f $(srcdir)/makepro.sed $< > $@
# this header file is parsed to generate signal names (signames.h)
SIGNAL_H = @SIGNAL_H@
***************
*** 96,101 ****
--- 99,109 ----
# zsh headers necessary for compilation
HDRS = $(DIST_HDRS) $(GEN_HDRS)
+ # object dependencies
+ ANSI =
+ ANSI_ = ansi2knr
+ OBJDEPS = $(HDRS) $(ANSI@U@)
+
# zsh C source
SRCS = builtin.c compat.c cond.c exec.c glob.c hashtable.c hist.c init.c \
input.c jobs.c lex.c linklist.c loop.c math.c mem.c module.c mod_deltochar.c \
***************
*** 114,127 ****
zle_vi.pro zle_word.pro $(@D@YNAMIC_PROTO)
# object files
! DYNAMIC_OBJS = $Umodule.o
NYNAMIC_OBJS =
! OBJS = $Ubuiltin.o $Ucompat.o $Ucond.o $Uexec.o $Uglob.o $Uhashtable.o \
! $Uhist.o $Uinit.o $Uinput.o $Ujobs.o $Ulex.o $Ulinklist.o $Uloop.o \
! $Umath.o $Umem.o $Uparams.o $Uparse.o $Usignals.o $Usubst.o $Utext.o \
! $Uutils.o $Uwatch.o $Uzle_bindings.o $Uzle_hist.o $Uzle_main.o \
! $Uzle_misc.o $Uzle_move.o $Uzle_refresh.o $Uzle_tricky.o $Uzle_utils.o \
! $Uzle_vi.o $Uzle_word.o $(@D@YNAMIC_OBJS)
# auxiliary files
AUX = Makefile.in .indent.pro signames.awk makepro.sed ansi2knr.c TAGS tags
--- 122,134 ----
zle_vi.pro zle_word.pro $(@D@YNAMIC_PROTO)
# object files
! DYNAMIC_OBJS = module.o
NYNAMIC_OBJS =
! OBJS = 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 params.o parse.o \
! signals.o subst.o text.o utils.o watch.o zle_bindings.o zle_hist.o \
! zle_main.o zle_misc.o zle_move.o zle_refresh.o zle_tricky.o zle_utils.o \
! zle_vi.o zle_word.o $(@D@YNAMIC_OBJS)
# auxiliary files
AUX = Makefile.in .indent.pro signames.awk makepro.sed ansi2knr.c TAGS tags
***************
*** 146,161 ****
ansi2knr: ansi2knr.o
$(LINK) ansi2knr.o
signames.h: signames.awk
$(AWK) -f $(srcdir)/signames.awk $(SIGNAL_H) > signames.h
! $(OBJS): $(HDRS)
$(PROTO): makepro.sed
! mod_deltochar.$(DL_EXT): mod_deltochar.pro
! mod_example.$(DL_EXT): mod_example.pro
# ========== DEPENDENCIES FOR INSTALLING ==========
--- 153,171 ----
ansi2knr: ansi2knr.o
$(LINK) ansi2knr.o
+ ansi2knr.o: ansi2knr.c
+ $(COMPILE) $(srcdir)/ansi2knr.c
+
signames.h: signames.awk
$(AWK) -f $(srcdir)/signames.awk $(SIGNAL_H) > signames.h
! $(OBJS): $(OBJDEPS)
$(PROTO): makepro.sed
! mod_deltochar.$(DL_EXT): $(OBJDEPS) mod_deltochar.pro
! mod_example.$(DL_EXT): $(OBJDEPS) mod_example.pro
# ========== DEPENDENCIES FOR INSTALLING ==========
***************
*** 175,249 ****
uninstall.bin:
-if [ -f $(bindir)/zsh ]; then rm -f $(bindir)/zsh; fi
-if [ -f $(bindir)/zsh-$(VERSION) ]; then rm -f $(bindir)/zsh-$(VERSION); fi
-
- # ========== DEPENDENCIES FOR ANSI TO KNR CONVERSION ==========
-
- _builtin.c: builtin.c ansi2knr
- ./ansi2knr $(srcdir)/builtin.c > _builtin.c
- _compat.c: compat.c ansi2knr
- ./ansi2knr $(srcdir)/compat.c > _compat.c
- _cond.c: cond.c ansi2knr
- ./ansi2knr $(srcdir)/cond.c > _cond.c
- _exec.c: exec.c ansi2knr
- ./ansi2knr $(srcdir)/exec.c > _exec.c
- _glob.c: glob.c ansi2knr
- ./ansi2knr $(srcdir)/glob.c > _glob.c
- _hashtable.c: hashtable.c ansi2knr
- ./ansi2knr $(srcdir)/hashtable.c > _hashtable.c
- _hist.c: hist.c ansi2knr
- ./ansi2knr $(srcdir)/hist.c > _hist.c
- _init.c: init.c ansi2knr
- ./ansi2knr $(srcdir)/init.c > _init.c
- _input.c: input.c ansi2knr
- ./ansi2knr $(srcdir)/input.c > _input.c
- _jobs.c: jobs.c ansi2knr
- ./ansi2knr $(srcdir)/jobs.c > _jobs.c
- _lex.c: lex.c ansi2knr
- ./ansi2knr $(srcdir)/lex.c > _lex.c
- _linklist.c: linklist.c ansi2knr
- ./ansi2knr $(srcdir)/linklist.c > _linklist.c
- _loop.c: loop.c ansi2knr
- ./ansi2knr $(srcdir)/loop.c > _loop.c
- _math.c: math.c ansi2knr
- ./ansi2knr $(srcdir)/math.c > _math.c
- _mem.c: mem.c ansi2knr
- ./ansi2knr $(srcdir)/mem.c > _mem.c
- _module.c: module.c ansi2knr
- ./ansi2knr $(srcdir)/module.c > _module.c
- _params.c: params.c ansi2knr
- ./ansi2knr $(srcdir)/params.c > _params.c
- _parse.c: parse.c ansi2knr
- ./ansi2knr $(srcdir)/parse.c > _parse.c
- _signals.c: signals.c ansi2knr
- ./ansi2knr $(srcdir)/signals.c > _signals.c
- _subst.c: subst.c ansi2knr
- ./ansi2knr $(srcdir)/subst.c > _subst.c
- _text.c: text.c ansi2knr
- ./ansi2knr $(srcdir)/text.c > _text.c
- _utils.c: utils.c ansi2knr
- ./ansi2knr $(srcdir)/utils.c > _utils.c
- _watch.c: watch.c ansi2knr
- ./ansi2knr $(srcdir)/watch.c > _watch.c
- _zle_bindings.c: zle_bindings.c ansi2knr
- ./ansi2knr $(srcdir)/zle_bindings.c > _zle_bindings.c
- _zle_hist.c: zle_hist.c ansi2knr
- ./ansi2knr $(srcdir)/zle_hist.c > _zle_hist.c
- _zle_main.c: zle_main.c ansi2knr
- ./ansi2knr $(srcdir)/zle_main.c > _zle_main.c
- _zle_misc.c: zle_misc.c ansi2knr
- ./ansi2knr $(srcdir)/zle_misc.c > _zle_misc.c
- _zle_move.c: zle_move.c ansi2knr
- ./ansi2knr $(srcdir)/zle_move.c > _zle_move.c
- _zle_refresh.c: zle_refresh.c ansi2knr
- ./ansi2knr $(srcdir)/zle_refresh.c > _zle_refresh.c
- _zle_tricky.c: zle_tricky.c ansi2knr
- ./ansi2knr $(srcdir)/zle_tricky.c > _zle_tricky.c
- _zle_utils.c: zle_utils.c ansi2knr
- ./ansi2knr $(srcdir)/zle_utils.c > _zle_utils.c
- _zle_vi.c: zle_vi.c ansi2knr
- ./ansi2knr $(srcdir)/zle_vi.c > _zle_vi.c
- _zle_word.c: zle_word.c ansi2knr
- ./ansi2knr $(srcdir)/zle_word.c > _zle_word.c
# ========== DEPENDENCIES FOR CLEANUP ==========
--- 185,190 ----
-----BEGIN PGP SIGNATURE-----
Version: 2.6.2
iQCVAwUBMov/u3D/+HJTpU/hAQFzcQP/SgNNri6NiRaRdME4318DwYkNeXyVukKv
jA4T7NULt3p6ZnflzzBP6W5mDGECJ6yW8Nd8S3VVTBnhNW/4yt1QZkxRSR9X314A
6aPNzs/PZWIm/ZANfOf2+v2bmWrfw0vbA/c33LbRxpFuOGCADRRlk5MNULM9Fwzp
Sn5LdfiaSF4=
=ueky
-----END PGP SIGNATURE-----
Messages sorted by:
Reverse Date,
Date,
Thread,
Author