Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: K&R compilation



Zefram wrote:
> 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.

I also made some hack on it inspired by your previous makefile hacks.  It
is simpler than your suggestion.  I'm surprised that you didn't chose that
solution.  Here is a piece which will be in the next test release (which
will be hopefully out sometime this weekend):

ANSIOBJ=.o
ANSI_OBJ=._foo_

.c$(ANSI@U@OBJ):
        $(COMPILE) $<

.c$(KNR@U@OBJ): ansi2knr
        ./ansi2knr $< > $@.c
        $(COMPILE) -o $@ $@.c
        rm -f $@.c

Modules are handled by similar rules.  I put modules in Src/Modules as
these are source files and quite closely related to those in Src.  Most
important, they need zsh.h from Src.  I did not put any Makefile and
Src/Makefile handles the modules instead.  That is because modules include
zsh.h which include the prototypes generated from the Src files and it
would be a bit tricky to create the right dependencies.

Unfortunately the present dependencies in zsh make parallel make a bit less
usable since the object files depend on .pro files.  Theoretically each
object file depends on each .pro file which means each object file depends
on each source file which would mean recompiling everything after each
single change in any source file.  To avoid this in the present makefile
nothing depends on the .pro files but the zsh target includes these
prototypes before the object files.

Zoltan



Messages sorted by: Reverse Date, Date, Thread, Author