浏览代码

+ Group C and CPP sources into C_SOURCES and CPP_SOURCES variables
* Use these new varaibles to simplify copyfiles rule, copy the objects
into output subdirectory and not in tests/test/cg.
+ New rules: create_c_objects and delete_c_objects.
create_c_objects: Compile using TEST_CCOMPILER variable value
all C_SOURCES and CPP_SOURCES, using TEST_CFLAGS option if set.
delete_c_objects: Delete the existing C compiled objects to force
recompilation in create_c_objects.

git-svn-id: trunk@17113 -

pierre 14 年之前
父节点
当前提交
dd627980e3
共有 2 个文件被更改,包括 81 次插入34 次删除
  1. 41 19
      tests/Makefile
  2. 40 15
      tests/Makefile.fpc

+ 41 - 19
tests/Makefile

@@ -1,8 +1,8 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2010/09/29]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2011/03/09]
 #
 default: allexectests
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
 BSDs = freebsd netbsd openbsd darwin
 UNIXs = linux $(BSDs) solaris qnx haiku
 LIMIT83fs = go32v2 os2 emx watcom
@@ -611,6 +611,11 @@ ifeq ($(OS_TARGET),NativeNT)
 SHAREDLIBEXT=.dll
 SHORTSUFFIX=nativent
 endif
+ifeq ($(OS_TARGET),wii)
+EXEEXT=.dol
+SHAREDLIBEXT=.so
+SHORTSUFFIX=wii
+endif
 else
 ifeq ($(OS_TARGET),go32v1)
 PPUEXT=.pp1
@@ -1503,24 +1508,42 @@ PREPUP=utils/prepup
 endif
 units:
 	$(MAKE) -C units FPC_VERSION= FPC=$(TEST_FPC) CPU_TARGET=$(TEST_CPU_TARGET) OS_TARGET=$(TEST_OS_TARGET) OPT="$(TEST_OPT)" CCOMPILER=$(TEST_CCOMPILER) BINUTILSPREFIX=$(TEST_BINUTILSPREFIX)
-copyfiles: $(TEST_OUTPUTDIR)
+.PHONY: create_c_objects delete_c_objects copyfiles
+C_SOURCE_DIR=test/cg/obj
+C_SOURCES=ctest.c tcext3.c tcext4.c tcext5.c tcext6.c
+CPP_SOURCES=cpptcl1.cpp cpptcl2.cpp
 ifneq ($(TEST_ABI),)
-	-$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)-$(TEST_ABI)/ctest.o test/cg
-	-$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)-$(TEST_ABI)/tcext3.o test/cg
-	-$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)-$(TEST_ABI)/tcext4.o test/cg
-	-$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)-$(TEST_ABI)/tcext5.o test/cg
-	-$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)-$(TEST_ABI)/tcext6.o test/cg
-	-$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)-$(TEST_ABI)/cpptcl1.o test/cg
-	-$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)-$(TEST_ABI)/cpptcl2.o test/cg
-else
-	-$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)/ctest.o test/cg
-	-$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)/tcext3.o test/cg
-	-$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)/tcext4.o test/cg
-	-$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)/tcext5.o test/cg
-	-$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)/tcext6.o test/cg
-	-$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)/cpptcl1.o test/cg
-	-$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)/cpptcl2.o test/cg
+C_OBJECTS_DIR=$(C_SOURCE_DIR)/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)-$(TEST_ABI)
+else
+C_OBJECTS_DIR=$(C_SOURCE_DIR)/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)
 endif
+C_OBJECTS=$(addprefix $(C_OBJECTS_DIR)/, $(subst .c,.o, $(C_SOURCES)))
+CPP_OBJECTS=$(addprefix $(C_OBJECTS_DIR)/, $(subst .cpp,.o, $(CPP_SOURCES)))
+create_c_objects:
+ifneq ($(TEST_CCOMPILER),)
+		-$(COPY) $(addprefix $(C_SOURCE_DIR)/, $(C_SOURCES)) $(C_OBJECTS_DIR)
+		$(MAKE) $(C_OBJECTS)
+		-$(COPY) $(addprefix $(C_SOURCE_DIR)/, $(CPP_SOURCES)) $(C_OBJECTS_DIR)
+		$(MAKE) $(CPP_OBJECTS)
+		-$(DEL) $(addprefix $(C_OBJECTS_DIR)/, $(C_SOURCES) $(CPP_SOURCES)) 
+else
+		$(ECHO) create_c_objects rule needs a valid C compiler in TEST_CCOMPILER variable
+		$(ECHO) TEST_CFLAGS variable is passed as options is used to compile the objects
+endif
+delete_c_objects:
+ifneq ($(TEST_CCOMPILER),)
+		-$(DEL) $(C_OBJECTS) $(CPP_OBJECTS)
+else
+		$(ECHO) delete_c_objects rule needs a valid C compiler in TEST_CCOMPILER variable
+		$(ECHO) to be able to recompile the objects using create_objects rule.
+endif
+$(C_OBJECTS) : %.o: %.c
+		$(TEST_CCOMPILER) -c $(TEST_CFLAGS) $< -o $@
+$(CPP_OBJECTS) : %.o: %.cpp
+		$(TEST_CCOMPILER) -c $(TEST_CFLAGS) $< -o $@
+copyfiles: $(TEST_OUTPUTDIR)
+	-$(COPY) $(C_OBJECTS) $(TEST_OUTPUTDIR)/test/cg
+	-$(COPY) $(CPP_OBJECTS) $(TEST_OUTPUTDIR)/test/cg
 	-$(MKDIRTREE) $(TEST_OUTPUTDIR)/test/units/system
 	$(COPY) test/units/system/test*.txt $(TEST_OUTPUTDIR)/test/units/system
 testprep: testprep-stamp.$(TEST_FULL_TARGET)
@@ -1563,7 +1586,6 @@ endif
 ifdef TEST_VERBOSE
 override DOTESTOPT+=-V
 endif
-# Also display benchmarks
 ifdef TEST_BENCH
 override DOTESTOPT+=-D
 endif

+ 40 - 15
tests/Makefile.fpc

@@ -178,24 +178,49 @@ units:
 # Copy test environment dependent files ctest.o, cext3.o, cext4.o to test/cg etc
 #
 
-copyfiles: $(TEST_OUTPUTDIR)
+.PHONY: create_c_objects delete_c_objects copyfiles
+
+C_SOURCE_DIR=test/cg/obj
+C_SOURCES=ctest.c tcext3.c tcext4.c tcext5.c tcext6.c
+CPP_SOURCES=cpptcl1.cpp cpptcl2.cpp
 ifneq ($(TEST_ABI),)
-        -$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)-$(TEST_ABI)/ctest.o test/cg
-        -$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)-$(TEST_ABI)/tcext3.o test/cg
-        -$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)-$(TEST_ABI)/tcext4.o test/cg
-        -$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)-$(TEST_ABI)/tcext5.o test/cg
-        -$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)-$(TEST_ABI)/tcext6.o test/cg
-        -$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)-$(TEST_ABI)/cpptcl1.o test/cg
-        -$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)-$(TEST_ABI)/cpptcl2.o test/cg
+C_OBJECTS_DIR=$(C_SOURCE_DIR)/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)-$(TEST_ABI)
+else
+C_OBJECTS_DIR=$(C_SOURCE_DIR)/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)
+endif
+C_OBJECTS=$(addprefix $(C_OBJECTS_DIR)/, $(subst .c,.o, $(C_SOURCES)))
+CPP_OBJECTS=$(addprefix $(C_OBJECTS_DIR)/, $(subst .cpp,.o, $(CPP_SOURCES)))
+
+
+create_c_objects:
+ifneq ($(TEST_CCOMPILER),)
+		-$(COPY) $(addprefix $(C_SOURCE_DIR)/, $(C_SOURCES)) $(C_OBJECTS_DIR)
+		$(MAKE) $(C_OBJECTS)
+		-$(COPY) $(addprefix $(C_SOURCE_DIR)/, $(CPP_SOURCES)) $(C_OBJECTS_DIR)
+		$(MAKE) $(CPP_OBJECTS)
+		-$(DEL) $(addprefix $(C_OBJECTS_DIR)/, $(C_SOURCES) $(CPP_SOURCES)) 
 else
-        -$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)/ctest.o test/cg
-        -$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)/tcext3.o test/cg
-        -$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)/tcext4.o test/cg
-        -$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)/tcext5.o test/cg
-        -$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)/tcext6.o test/cg
-        -$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)/cpptcl1.o test/cg
-        -$(COPY) test/cg/obj/$(TEST_OS_TARGET)/$(TEST_CPU_TARGET)/cpptcl2.o test/cg
+		$(ECHO) create_c_objects rule needs a valid C compiler in TEST_CCOMPILER variable
+		$(ECHO) TEST_CFLAGS variable is passed as options is used to compile the objects
 endif
+
+delete_c_objects:
+ifneq ($(TEST_CCOMPILER),)
+		-$(DEL) $(C_OBJECTS) $(CPP_OBJECTS)
+else
+		$(ECHO) delete_c_objects rule needs a valid C compiler in TEST_CCOMPILER variable
+		$(ECHO) to be able to recompile the objects using create_objects rule.
+endif
+
+$(C_OBJECTS) : %.o: %.c
+		$(TEST_CCOMPILER) -c $(TEST_CFLAGS) $< -o $@
+
+$(CPP_OBJECTS) : %.o: %.cpp
+		$(TEST_CCOMPILER) -c $(TEST_CFLAGS) $< -o $@
+		
+copyfiles: $(TEST_OUTPUTDIR)
+        -$(COPY) $(C_OBJECTS) $(TEST_OUTPUTDIR)/test/cg
+        -$(COPY) $(CPP_OBJECTS) $(TEST_OUTPUTDIR)/test/cg
         -$(MKDIRTREE) $(TEST_OUTPUTDIR)/test/units/system
         $(COPY) test/units/system/test*.txt $(TEST_OUTPUTDIR)/test/units/system