[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Make: Obscure bug with wildcards



Package: make
Version: 3.78.1-2

I am not at all sure if this bug is related to make (if it is, the
problem is upstream).  Maybe it's glibc.  I am having a lot of trouble
compiling things and could boil it down to a little setup I am going to
describe now.  It would be helpful if some people could try to reproduce
it and make suggestions on where it is comes from.  It seems it was
introduced in the last couple of weeks into Debian.

I have a directory with the following contents:
foobar:~/makebug$ find
.
./Makefile
./test
./test/cl_spushstring.h
./test/somedir
./test/cl_spushstring_append.cc
./test/cl_spushstring_push.cc
./test/cl_sstring.cc
./test/cl_sstring.h
./test/cl_st_c2.cc
./test/cl_st_concat1.cc
./test/cl_st_concat2.cc
./test/cl_st_concat3.cc
./test/cl_st_debug.cc
./test/cl_st_hashcode.cc
./test/cl_st_make0.cc
./test/cl_st_make1.cc
./test/cl_st_make2.cc
./test/cl_st_null.cc

All files are empty, except for the Makefile (see attachment).  When I run 

foobar:~/makebug$ /usr/bin/make diversion SUBDIR=test

I get the output

1   .
2   test
4   

While on older Debian/potato systems (and Solaris and so on) I get the
correct output (using upstream make-3.78.1).  Compiling make-3.78.1 on
Potato still shows the bug which is why I am so clueless about where it
comes from.

1   .
2   test
4   ./test/somedir/.

The target diversion was of course deliberately inserted to trace down the
problem.  It is simply

diversion:
        @echo "1   $(srcdir)"
        @echo "2   $(SUBDIR)"
        @echo -n "4   "
        @echo $(wildcard $(srcdir)/$(SUBDIR)/*/.)

If I rename some of the files or delete some, the error goes away.  If I
strip off stuff from the Makefile, the problem goes away as well.  But I
can reproduce it on two up-to-date potato machines and it doesn't seem to
be related to the FS, since it happens both on NFS and local ext2.  I have
tried strace to track it down but it remains mysterious to me.

The bug makes the library cln currently uncompilable on potato, it
complains about `no rule to make target...', since it must diverge down 
into test/subdir/, which it doesn't want to find. It is rather obscure to
me.

If you cannot reproduce it, try if you can build cln-1.0.3-2 from the
Debian sources.  It will most probably fail to link because of many 
missing objects.  If you still cannot reproduce it, please do contact me
again!

Regards
    -rbk.
-- 
Richard Kreckel
<Richard.Kreckel@Uni-Mainz.DE>
<http://wwwthep.physik.uni-mainz.de/~kreckel/>

# Generated automatically from Makefile.in by configure.
# Makefile for cln/src

#### Start of system configuration section. ####

# Directories used by "make":
srcdir = .
top_srcdir = ..

# Directories used by "make install":
prefix = /usr
local_prefix = /usr/local
exec_prefix = $(prefix)
datadir = ${prefix}/share
libdir = ${exec_prefix}/lib
includedir = ${prefix}/include
mandir = ${prefix}/man

# Programs used by "make":
# C compiler
CC = gcc -O
CFLAGS = 
CPP = gcc -O -E -w
# C++ compiler
CXX = c++
CXXFLAGS = -ggdb -Wall
CXXCPP = c++ -E
INCLUDES = -I../include -I$(top_srcdir)/include
GMP_INCLUDES = -I$(top_srcdir)/gmp
CPPFLAGS += $(INCLUDES)
LIBTOOL = $(SHELL) $(top_builddir)/libtool
LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile
LIBTOOL_LINK = $(LIBTOOL) --mode=link
LIBTOOL_INSTALL = $(LIBTOOL) --mode=install
LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall
AR = ar
AR_FLAGS = rc
RANLIB = ranlib
MV = mv
LN = ln
RM = rm -f


# Programs used by "make install":
INSTALL = cp
INSTALL_PROGRAM = $(INSTALL)
INSTALL_DATA = $(INSTALL)

#### End of system configuration section. ####

SHELL = /bin/sh

# Needed by $(LIBTOOL).
top_builddir = ..

# When this Makefile is called with SUBDIR=some_subdirectory, it builds
# only the object files belonging to sources in that subdirectory. The
# final library is built only if SUBDIR=.
SUBDIR = .

# Define the search path for sources.
# The ":" below keeps config.status from removing this line.
VPATH = $(srcdir)/$(SUBDIR) # :

CPPFLAGS += $(SUBDIR_INCLUDES)

# Need to know the system name.
SYSTEM := $(shell uname -s)

FILES_CC := $(notdir $(wildcard $(srcdir)/$(SUBDIR)/*.cc))
FILES_CC := $(filter-out %.i.cc, $(FILES_CC))
ASMFILES_CC := $(patsubst cl_asm_i386_%.cc,cl_asm_%.cc, $(filter cl_asm_i386_%.cc, $(FILES_CC)))
FILES_CC := $(filter-out cl_asm_%.cc, $(FILES_CC))

FILES_I_CC := $(patsubst %.cc,%.i.cc,$(FILES_CC))

FILES_S := $(patsubst %.cc,%.s,$(FILES_CC))

FILES_LO := $(patsubst %.cc,%.lo,$(FILES_CC))

ASMFILES_S := $(patsubst %.cc,%.s,$(ASMFILES_CC))

ASMFILES_LO := $(patsubst %.cc,%.lo,$(ASMFILES_CC))

OBJECTS_LO = $(FILES_LO) $(ASMFILES_LO)

SUBDIRS := $(patsubst $(srcdir)/%/.,%,$(wildcard $(srcdir)/$(SUBDIR)/*/.))
# Avoid certain subdirectories:
#   private/ and old/ don't contain valid sources,
#   CVS/ and RCS/ are created when people put the sources under version control,
#   ii_files/ is created during "make" by SGI C++.
SUBDIRS := $(filter-out old ./old private ./private CVS %/CVS RCS %/RCS ii_files ./ii_files,$(SUBDIRS))

SUBDIRS_TARGET := $(patsubst %,%.target,$(SUBDIRS))
SUBDIRS_DIRDEP := $(patsubst %,%.dirdep,$(SUBDIRS))

ifeq ($(SUBDIR),.)
ALLFILES_CC := $(notdir $(wildcard $(srcdir)/*.cc) $(foreach subdir,$(SUBDIRS), $(wildcard $(srcdir)/$(subdir)/*.cc) $(wildcard $(srcdir)/$(subdir)/*/*.cc) $(wildcard $(srcdir)/$(subdir)/*/*/*.cc)))
ALLFILES_CC := $(filter-out %.i.cc, $(ALLFILES_CC))
ALLASMFILES_CC := $(patsubst cl_asm_i386_%.cc,cl_asm_%.cc, $(filter cl_asm_i386_%.cc, $(ALLFILES_CC)))
ALLFILES_CC := $(filter-out cl_asm_%.cc, $(ALLFILES_CC))
ALLFILES_LO := $(patsubst %.cc,%.lo,$(ALLFILES_CC))
ALLASMFILES_LO := $(patsubst %.cc,%.lo,$(ALLASMFILES_CC))
ALLOBJECTS_LO = $(ALLFILES_LO) $(ALLASMFILES_LO)

all : diversion $(OBJECTS_LO) $(SUBDIRS_TARGET) libcln.la
else
all : diversion $(OBJECTS_LO) $(SUBDIRS_TARGET)
endif

diversion:
	@echo "1   $(srcdir)"
	@echo "2   $(SUBDIR)"
#	@echo -n "4   "
#	@echo $(patsubst $(srcdir)/%/.,%,$(wildcard $(srcdir)/$(SUBDIR)/*/.))
	@echo -n "4   "
	@echo $(wildcard $(srcdir)/$(SUBDIR)/*/.)

alls : $(FILES_S) $(ASMFILES_S)

allo : $(FILES_LO) $(ASMFILES_LO)

ASMFLAGS :=
ifeq (false,true)
ASMFLAGS += -DUNDERSCORE
endif

# Rules for normal compilation.

%.lo : %.c
	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $<

%.lo : %.cc
	$(LIBTOOL_COMPILE) $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $<

# Rules for normal compilation, only needed for debugging.

%.s : %.c
	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -S $< -o $@

%.s : %.cc
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -S $< -o $@

# Rules for preprocessing.

%.i : %.c
	$(CPP) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) $< > $@

%.i.cc : %.cc
	$(CXXCPP) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) $< > $@

# Rules for assembly language files,

ifneq ($(ASMFILES_LO),)

ifneq ($(filter i386,sparc sparc64),)
$(ASMFILES_S) : %.s : %.cc
	$(CXXCPP) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) $(ASMFLAGS) $< | grep -v '^#' | grep -v '^ *#line' | sed -e 's/\([.%]\) /\1/g' -e 's/ , /,/g' -e 's/ :/:/g' -e 's/\$$/#/g' > $@
else
ifeq (i386,m68k)
$(ASMFILES_S) : %.s : %.cc
ifeq (false,true)
	$(CXXCPP) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -P $(ASMFLAGS) $< | sed -e 's/\\#/#/g' -e 's/\$$//g' > $@
else
	$(CXXCPP) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -P $(ASMFLAGS) $< | sed -e 's/\\#/#/g' -e 's/\$$/%/g' > $@
endif
else
ifeq (i386,hppa)
$(ASMFILES_S) : %.s : %.cc
	-$(CXXCPP) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -P $(ASMFLAGS) $< > $@
else
$(ASMFILES_S) : %.s : %.cc
	$(CXXCPP) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -P $(ASMFLAGS) $< > $@
endif
endif
endif

ifeq (i386,hppa)
# Only the native as groks the .SHORTDATA statements
$(ASMFILES_LO) : %.lo : %.s
	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS) $(TARGET_ARCH) -c $< \
	|| COMPILER_PATH=/usr/ccs/bin $(LIBTOOL_COMPILE) $(CC) $(CFLAGS) $(TARGET_ARCH) -c $< \
	|| COMPILER_PATH=/bin $(LIBTOOL_COMPILE) $(CC) $(CFLAGS) $(TARGET_ARCH) -c $<
else
$(ASMFILES_LO) : %.lo : %.s
	$(LIBTOOL_COMPILE) $(CC) $(CFLAGS) $(TARGET_ARCH) -c $<
endif

endif


# Recurse into subdirectories
$(SUBDIRS_TARGET) : %.target : %.dirdep
	$(MAKE) SUBDIR=$*

$(SUBDIRS_DIRDEP) : %.dirdep :


ifeq ($(SUBDIR),.)

../gmp/mpn/libmpn.la : $(LIBTOOL)
	cd ../gmp && $(MAKE) mpn/libmpn.la mp_clz_tab.lo


libcln.la : $(LIBTOOL) $(ALLOBJECTS_LO) ../gmp/mpn/libmpn.la
	$(LIBTOOL_LINK) $(CC) -o libcln.la -rpath $(libdir) $(ALLOBJECTS_LO) ../gmp/mpn/*.lo ../gmp/*.lo

install : all force
	if [ ! -d $(libdir) ] ; then mkdir $(libdir) ; fi
	$(LIBTOOL_INSTALL) $(INSTALL_DATA) libcln.la $(libdir)/libcln.la
	if [ ! -d $(includedir) ] ; then mkdir $(includedir) ; fi
	$(INSTALL_DATA) $(top_srcdir)/include/*.h $(includedir)
	$(INSTALL_DATA) ../include/*.h $(includedir)
#	if [ ! -d $(mandir) ] ; then mkdir $(mandir) ; fi
#	if [ ! -d $(mandir)/man3 ] ; then mkdir $(mandir)/man3 ; fi
#	if [ ! -d $(datadir) ] ; then mkdir $(datadir) ; fi
#	if [ ! -d $(datadir)/html ] ; then mkdir $(datadir)/html ; fi

installdirs : force
	if [ ! -d $(libdir) ] ; then mkdir $(libdir) ; fi
	if [ ! -d $(includedir) ] ; then mkdir $(includedir) ; fi
#	if [ ! -d $(mandir) ] ; then mkdir $(mandir) ; fi
#	if [ ! -d $(mandir)/man3 ] ; then mkdir $(mandir)/man3 ; fi
#	if [ ! -d $(datadir) ] ; then mkdir $(datadir) ; fi
#	if [ ! -d $(datadir)/html ] ; then mkdir $(datadir)/html ; fi

uninstall : force
	$(LIBTOOL_UNINSTALL) $(RM) $(libdir)/libcln.la
	$(RM) $(addprefix $(includedir)/, $(notdir $(wildcard $(top_srcdir)/include/*.h)))
	$(RM) $(addprefix $(includedir)/, $(notdir $(wildcard ../include/*.h)))

check : all

mostlyclean : clean

clean : force
	$(RM) *.s *.o *.lo *.a *.la core
	$(RM) -r .libs _libs

distclean : clean
	$(RM) config.status config.log config.cache Makefile

maintainer-clean : distclean

endif

force :

Reply to: