[Python-Dev] grumble, grumble - makesetup prepends leading $(srcdir) - why?

Guido van Rossum guido@beopen.com
Thu, 06 Jul 2000 10:40:00 -0500


> Here's one that's bugged me for awhile that I'm tired of working around.
> Perhaps someone can explain why makesetup does what it does.
> 
> In my Modules/Setup.local file I have
> 
>     TOP=$(HOME)/src/python
>     EDIR=$(TOP)/PyExtensions1.5
>     llop $(EDIR)/llopmodule.c        # helper function(s) for latlong.py
> 
> This gets converted into
> 
>     llopmodule.o: $(srcdir)/$(EDIR)/llopmodule.c; $(CC) $(CCSHARED)  $(CFLAGS) -c $(srcdir)/$(EDIR)/llopmodule.c
>     llopmodule$(SO):  llopmodule.o; $(LDSHARED)  llopmodule.o  -o llopmodule$(SO)
> 
> in Modules/Makefile.  Is there a good reason why is $(srcdir)/ prepended to
> the source file reference, thus breaking my local module references?  It
> seems the culprit is
> 
>     case $src in
>     glmodule.c) ;;
>     /*) ;;
>     *) src='$(srcdir)/'$src;;
>     esac
> 
> around about line 193.  I think this should be changed to
> 
>     case $src in
>     glmodule.c) ;;
>     /*) ;;
>     \$*) ;;
>     *) src='$(srcdir)/'$src;;
>     esac
> 
> or something similar that protects paths that begin with a Make variable.
> That fix works for me.  Any objections to me checking it in?

Good idea.  Go ahead.

> Also, who died and made glmodule.c king?

It was Jack & me.  We're not dead yet!  The reason is that glmodule.c
is actually generated by a script that is run automatically from the
Makefile.

--Guido van Rossum (home page: http://dinsdale.python.org/~guido/)