Pattern rules problem on cygwin ?

Maxime Boissonneault <[email protected]>
Newsgroups gmane.comp.gnu.make.windows
Message-ID <[email protected]>
Hello,

I have the included Makefile for a project. When compiling on Linux or 
Mac, everything works fine. When compiling on Windows with cygwin, with 
the same version of gnumake, some pattern rules don't work (see the 
attached error in the .jpg).

It seems like the compiler get a blank name for the .cpp file.

Do you see any non-portable syntax within lines 176 and 185 of the 
Makefile ?

Make is version 3.81 on each plateform.

Thanks,


-- 
--------
Put a ladder if there's a wall, don't be afraid to slip and fall, speak for  yourself or they'll speak for you.
--------
Si l'on savait ce que l'on fait, on n'appellerait pas ça de la recherche. (Albert Einstein)
--------

Maxime Boissonneault
Étudiant chercheur au doctorat en physique
Président de l'AGLEBUS
--------------------------------------------
[email protected]
[email protected]
(819) 821-8000 #63043 (jour)
(819) 823-1913 (soirs et fins de semaine)

_______________________________________________
Make-w32 mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/make-w32
Makefile (text/plain, 7.1 KB)
include Makefile.conf

# ############################
# LIST OF OBJECTS/EXES
# ############################
INCLUDEDIRS += -I./

MATRIX_DIR = matrix/
MATRIX_SOURCES = $(wildcard $(MATRIX_DIR)*.cpp)
MATRIX_OBJECTS = $(MATRIX_SOURCES:.cpp=.o)
MATRIX = libSQUACKMatrix.a
MATRIX_DEPEND = $(MATRIX_DIR)/MatrixExceptions.h matrix.h
OBJECTS += $(MATRIX_OBJECTS)
LIBRARIES += $(MATRIX)
DIRS += $(MATRIX_DIR)

SYSTEMFACTORIES_DIR = systemfactories/
SYSTEMFACTORIES_SOURCES = $(wildcard $(SYSTEMFACTORIES_DIR)*.cpp)
SYSTEMFACTORIES_OBJECTS = $(SYSTEMFACTORIES_SOURCES:.cpp=.o)
SYSTEMFACTORIES = libSQUACKSystemFactories.a
SYSTEMFACTORIES_DEPEND = generic_headers/lapack-blas.h
OBJECTS += $(SYSTEMFACTORIES_OBJECTS)
LIBRARIES += $(SYSTEMFACTORIES)
DIRS += $(SYSTEMFACTORIES_DIR)

UTILS_DIR = utilities/
UTILS_SOURCES = $(wildcard $(UTILS_DIR)*.cpp)
UTILS_OBJECTS = $(UTILS_SOURCES:.cpp=.o)
UTILITIES = libSQUACKUtilities.a
OBJECTS += $(UTILS_OBJECTS)
LIBRARIES += $(UTILITIES)
DIRS += $(UTILS_DIR)

GENERIC_HEADERS_DIR = generic_headers/
GENERIC_HEADERS = $(wildcard $(GENERIC_HEADERS_DIR)*.h)

GSL_OPENMP_DIR = gsl_openmp/

GOOGLETESTS_DIR = gtests/
GOOGLETESTS_SOURCES = $(wildcard $(GOOGLETESTS_DIR)test_*.cpp)
GOOGLETESTS_EXE = $(GOOGLETESTS_DIR)gtest_all$(EXE_EXTENSION)
EXES += $(GOOGLETESTS_EXE)
DIRS += $(GOOGLETESTS_DIR)

DEMO_DIR = demo/
DEMO_OBJECTS_SOURCES = $(wildcard $(DEMO_DIR)demo_obj_*.cpp)
DEMO_OBJECTS = $(DEMO_OBJECTS_SOURCES:.cpp=.o)
DEMO_EXES_SOURCES = $(wildcard $(DEMO_DIR)demo_exe_*.cpp)
DEMO_EXES = $(DEMO_EXES_SOURCES:.cpp=$(EXE_EXTENSION))
OBJECTS += $(DEMO_OBJECTS)
EXES += $(DEMO_EXES)
DIRS += $(DEMO_DIR)

USER_EXES_DIR = user_exes/
USER_EXES_OBJECTS_SOURCES = $(wildcard $(USER_EXES_DIR:/=/obj_*.cpp))
USER_EXES_OBJECTS = $(USER_EXES_OBJECTS_SOURCES:.cpp=.o)
USER_EXES_SOURCES = $(wildcard $(USER_EXES_DIR:/=/exe_*.cpp))
USER_EXES_EXES = $(USER_EXES_SOURCES:.cpp=$(EXE_EXTENSION))
EXES += $(USER_EXES_EXES)
OBJECTS += $(USER_EXES_OBJECTS)
DIRS += $(USER_EXES_DIR)

USER_EXES_SUBDIRS = $(subst $(USER_EXES_DIR) ,, $(sort $(dir $(wildcard $(USER_EXES_DIR)*/))))
USER_EXES_SUBDIRS_OBJECTS_SOURCES = $(wildcard $(USER_EXES_SUBDIRS:/=/obj_*.cpp))
USER_EXES_SUBDIRS_OBJECTS = $(USER_EXES_SUBDIRS_OBJECTS_SOURCES:.cpp=.o)
USER_EXES_SUBDIRS_SOURCES = $(wildcard $(USER_EXES_SUBDIRS:/=/exe_*.cpp))
USER_EXES_SUBDIRS_EXES = $(USER_EXES_SUBDIRS_SOURCES:.cpp=$(EXE_EXTENSION))
EXES += $(USER_EXES_SUBDIRS_EXES)
OBJECTS += $(USER_EXES_SUBDIRS_OBJECTS)
DIRS += $(USER_EXES_SUBDIRS)


GLOBAL_DEPEND = Makefile Makefile.conf $(GENERIC_HEADERS) gtests/system_test_complex$(EXE_EXTENSION) $(GENERIC_HEADERS_DIR)config.h
EXES += gtests/system_test_complex$(EXE_EXTENSION)

###################################
# Configuration
###################################
ifeq ($(OPENMP_ENABLED),1)
	CPPFLAGS += $(OPENMP_CPPFLAGS)
endif
ifeq ($(CBLAS_ENABLED),1)
	LIBS += $(CBLAS_LIBS)
	LIBDIRS += $(CBLAS_LIBDIR)
endif
ifeq ($(CLAPACK_ENABLED),1)
	LIBS += $(CLAPACK_LIBS)
	LIBDIRS += $(CLAPACK_LIBDIR)
endif
ifeq ($(GSL_ENABLED),1)
	LIBS += $(GSL_LIBS)
	LIBDIRS += $(GSL_LIBDIR)
	INCLUDEDIRS += $(GSL_INCLUDEDIR)
	ifeq ($(GSL_OPENMP_ENABLED),1)
		ifeq ($(OPENMP_ENABLED),1)
			GSL_OPENMP_SOURCES = $(wildcard $(GSL_OPENMP_DIR)*.c)
			GSL_OPENMP_OBJECTS = $(GSL_OPENMP_SOURCES:.c=.o)
			OBJECTS += $(GSL_OPENMP_OBJECTS)
		endif
	endif
endif

libraries:: $(LIBRARIES)

echo::
	echo $(USER_EXES_DIR)
	echo $(USER_EXES_OBJECTS_SOURCES)
	echo $(USER_EXES_OBJECTS)
	echo $(USER_EXES_SOURCES)
	echo $(USER_EXES_EXES)
	echo $(USER_EXES_SUBDIRS)
	echo $(USER_EXES_SUBDIRS_OBJECTS_SOURCES)
	echo $(USER_EXES_SUBDIRS_OBJECTS)
	echo $(USER_EXES_SUBDIRS_SOURCES)
	echo $(USER_EXES_SUBDIRS_EXES)

all:: $(OBJECTS) $(LIBRARIES) $(EXES)
objects:: $(OBJECTS)
gtests/:: gtests
gtests:: $(GOOGLETESTS_EXE)
demo/:: demo
demo:: $(DEMO_EXES)
user_exes/:: user_exes
user_exes:: $(USER_EXES_EXES) $(USER_EXES_SUBDIRS_EXES)
utilities/:: utilities
utilities:: $(UTILS_OBJECTS)
gsl_openmp/:: gsl_openmp
gsl_openmp:: $(GSL_OPENMP_OBJECTS)
matrix/:: matrix
matrix:: $(MATRIX)
systemfactories/:: systemfactories
systemfactories:: $(SYSTEMFACTORIES)

generic_headers/config.h: Makefile Makefile.conf
	@echo Creating $*.h
	@if [ -f $*.h ]; then rm $*.h; fi
	@echo "#ifndef generic_headers_config_h" >> $*.h
	@echo "	#define generic_headers_config_h" >> $*.h
ifeq ($(CBLAS_ENABLED),1)
	@echo "	#define HAVE_CBLAS" >> $*.h	
endif
ifeq ($(CLAPACK_ENABLED),1)
	@echo "	#define HAVE_CLAPACK" >> $*.h	
endif
ifeq ($(GSL_ENABLED),1)
	@echo "	#define HAVE_GSL" >> $*.h	
endif
ifeq ($(GSL_OPENMP_ENABLED),1)
	@echo "	#define USE_GSL_OMP" >> $*.h	
endif
	@echo "#endif" >> $*.h

$(MATRIX): $(MATRIX_OBJECTS) $(MATRIX_DEPEND) $(GLOBAL_DEPEND)
	ar rc $(MATRIX) $(MATRIX_OBJECTS)
	ranlib $(MATRIX)

$(SYSTEMFACTORIES): $(SYSTEMFACTORIES_OBJECTS) $(SYSTEMFACTORIES_DEPEND) $(GLOBAL_DEPEND)
	ar rc $(SYSTEMFACTORIES) $(SYSTEMFACTORIES_OBJECTS)
	ranlib $(SYSTEMFACTORIES)

$(UTILITIES): $(UTILS_OBJECTS) $(GLOBAL_DEPEND)
	ar rc $(UTILITIES) $(UTILS_OBJECTS)
	ranlib $(UTILITIES)

$(TESTS_EXES): %$(EXE_EXTENSION) : %.cpp $(LIBRARIES)
	$(CPP) $(DIRECTIVES) $(CPPFLAGS) $(INCLUDEDIRS) $(LIBDIRS) $*.cpp $(LIBRARIES) -o $*$(EXE_EXTENSION) $(LIBS) 

$(GOOGLETESTS_EXE): $(GOOGLETESTS_SOURCES) $(LIBRARIES) $(GLOBAL_DEPEND)
ifeq ($(GTEST_ENABLED),1)
	$(CPP) $(DIRECTIVES) $(CPPFLAGS) $(INCLUDEDIRS) $(GTEST_INCLUDEDIR) $(LIBDIRS) $(GTEST_LIBDIR) $(GOOGLETESTS_SOURCES) $(LIBRARIES) -o $(GOOGLETESTS_EXE) $(LIBS) -lgtest -lgtest_main
endif

$(DEMO_EXES): %$(EXE_EXTENSION) : %.cpp $(LIBRARIES) $(DEMO_OBJECTS) $(GSL_OPENMP_OBJECTS)
	$(CPP) $(DIRECTIVES) $(CPPFLAGS) $(INCLUDEDIRS) $(LIBDIRS) $*.cpp $(DEMO_OBJECTS) $(GSL_OPENMP_OBJECTS) $(LIBRARIES) -o $*$(EXE_EXTENSION) $(LIBS)  

$(USER_EXES_EXES): %$(EXE_EXTENSION) : %.cpp $(LIBRARIES) $(USER_EXES_OBJECTS) $(GSL_OPENMP_OBJECTS)
	$(CPP) $(DIRECTIVES) $(CPPFLAGS) $(INCLUDEDIRS) $(LIBDIRS) $*.cpp $(USER_EXES_OBJECTS) $(GSL_OPENMP_OBJECTS) $(LIBRARIES) -o $*$(EXE_EXTENSION) $(LIBS) 

# use secondary expansion to allow filtering of the prerequisites according to the target directory. This is to avoid compilation of unnecessary objects.
.SECONDEXPANSION:
$(USER_EXES_SUBDIRS_EXES): $$(filter $$(@D)%,$$(USER_EXES_SUBDIRS_SOURCES)) $(LIBRARIES) $$(filter $$(@D)%,$$(USER_EXES_SUBDIRS_OBJECTS)) $(GSL_OPENMP_OBJECTS) 
	$(CPP) $(DIRECTIVES) $(CPPFLAGS) $(INCLUDEDIRS) $(LIBDIRS) $*.cpp $(filter $(@D)%,$(USER_EXES_SUBDIRS_OBJECTS)) $(GSL_OPENMP_OBJECTS) $(LIBRARIES) -o $*$(EXE_EXTENSION) $(LIBS)

$(USER_EXES_SUBDIRS): $$(filter $$@%,$$(USER_EXES_SUBDIRS_EXES))

clean:
	rm -rf $(EXES) $(EXES:$(EXE_EXTENSION)=$(EXE_EXTENSION).dSYM) $(OBJECTS) $(LIBRARIES) generic_headers/config.h

gtests/system_test_complex$(EXE_EXTENSION): gtests/system_test_complex.cpp
	@$(CPP) $(CPPFLAGS) gtests/system_test_complex.cpp -o gtests/system_test_complex$(EXE_EXTENSION)
	@echo "TESTING IF YOUR IMPLEMENTATION OF std::complex IS COMPATIBLE WITH SQUACK"
	@if ./gtests/system_test_complex$(EXE_EXTENSION); then echo "... OK"; else echo "... NOT COMPATIBLE. TRY USING A DIFFERENT COMPILER."; rm gtests/system_test_complex$(EXE_EXTENSION); exit 1; fi

%.o: %.cpp %.h $(GLOBAL_DEPEND)
	$(CPP) $(CPPFLAGS) $(DIRECTIVES) $(INCLUDEDIRS) -c $*.cpp -o $*.o

%.o: %.c $(GLOBAL_DEPEND)
	$(CPP) $(DIRECTIVES) $(CPPFLAGS) $(INCLUDEDIRS) -c $*.c -o $*.o
makefileerror.jpg (image/jpeg, 35 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.