< prev index next >

make/common/TestFilesCompilation.gmk

Print this page
rev 52919 : 8189861: Refactor CacheFind
Reviewed-by: sgehwolf
   1 #
   2 # Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any


  58   # The list to depend on starts out empty
  59   $1 :=
  60   ifeq ($$($1_TYPE), LIBRARY)
  61     $1_PREFIX = lib
  62     $1_OUTPUT_SUBDIR := lib
  63     $1_CFLAGS := $(CFLAGS_TESTLIB)
  64     $1_LDFLAGS := $(LDFLAGS_TESTLIB) $(call SET_SHARED_LIBRARY_ORIGIN)
  65     $1_COMPILATION_TYPE := LIBRARY
  66   else ifeq ($$($1_TYPE), PROGRAM)
  67     $1_PREFIX = exe
  68     $1_OUTPUT_SUBDIR := bin
  69     $1_CFLAGS := $(CFLAGS_TESTEXE)
  70     $1_LDFLAGS := $(LDFLAGS_TESTEXE)
  71     $1_COMPILATION_TYPE := EXECUTABLE
  72   else
  73     $$(error Unknown type: $$($1_TYPE))
  74   endif
  75 
  76   # Locate all files with the matching prefix
  77   $1_FILE_LIST := \
  78       $$(shell $$(FIND) $$($1_SOURCE_DIRS) -type f -name "$$($1_PREFIX)*.c")
  79 
  80   $1_EXCLUDE_PATTERN := $$(addprefix %/, $$($1_EXCLUDE))
  81   $1_FILTERED_FILE_LIST := $$(filter-out $$($1_EXCLUDE_PATTERN), $$($1_FILE_LIST))
  82 
  83   # Setup a compilation for each and every one of them
  84   $$(foreach file, $$($1_FILTERED_FILE_LIST),\
  85     $$(eval name := $$(strip $$(basename $$(notdir $$(file))))) \
  86     $$(eval unprefixed_name := $$(patsubst $$($1_PREFIX)%, %, $$(name))) \
  87     $$(eval $$(call SetupNativeCompilation, BUILD_TEST_$$(name), \
  88         NAME := $$(unprefixed_name), \
  89         TYPE := $$($1_COMPILATION_TYPE), \
  90         SRC := $$(patsubst %/,%,$$(dir $$(file))), \
  91         INCLUDE_FILES := $$(notdir $$(file)), \
  92         OBJECT_DIR := $$($1_OUTPUT_DIR)/support/$$(name), \
  93         OUTPUT_DIR := $$($1_OUTPUT_DIR)/$$($1_OUTPUT_SUBDIR), \
  94         CFLAGS := $$($1_CFLAGS) $$($1_CFLAGS_$$(name)), \
  95         LDFLAGS := $$($1_LDFLAGS) $$($1_LDFLAGS_$$(name)), \
  96         LIBS := $$($1_LIBS_$$(name)), \
  97         OPTIMIZATION := $$(if $$($1_OPTIMIZATION_$$(name)),$$($1_OPTIMIZATION_$$(name)),LOW), \
  98         COPY_DEBUG_SYMBOLS := false, \
   1 #
   2 # Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any


  58   # The list to depend on starts out empty
  59   $1 :=
  60   ifeq ($$($1_TYPE), LIBRARY)
  61     $1_PREFIX = lib
  62     $1_OUTPUT_SUBDIR := lib
  63     $1_CFLAGS := $(CFLAGS_TESTLIB)
  64     $1_LDFLAGS := $(LDFLAGS_TESTLIB) $(call SET_SHARED_LIBRARY_ORIGIN)
  65     $1_COMPILATION_TYPE := LIBRARY
  66   else ifeq ($$($1_TYPE), PROGRAM)
  67     $1_PREFIX = exe
  68     $1_OUTPUT_SUBDIR := bin
  69     $1_CFLAGS := $(CFLAGS_TESTEXE)
  70     $1_LDFLAGS := $(LDFLAGS_TESTEXE)
  71     $1_COMPILATION_TYPE := EXECUTABLE
  72   else
  73     $$(error Unknown type: $$($1_TYPE))
  74   endif
  75 
  76   # Locate all files with the matching prefix
  77   $1_FILE_LIST := \
  78       $$(call FindFiles, $$($1_SOURCE_DIRS), $$($1_PREFIX)*.c)
  79 
  80   $1_EXCLUDE_PATTERN := $$(addprefix %/, $$($1_EXCLUDE))
  81   $1_FILTERED_FILE_LIST := $$(filter-out $$($1_EXCLUDE_PATTERN), $$($1_FILE_LIST))
  82 
  83   # Setup a compilation for each and every one of them
  84   $$(foreach file, $$($1_FILTERED_FILE_LIST),\
  85     $$(eval name := $$(strip $$(basename $$(notdir $$(file))))) \
  86     $$(eval unprefixed_name := $$(patsubst $$($1_PREFIX)%, %, $$(name))) \
  87     $$(eval $$(call SetupNativeCompilation, BUILD_TEST_$$(name), \
  88         NAME := $$(unprefixed_name), \
  89         TYPE := $$($1_COMPILATION_TYPE), \
  90         SRC := $$(patsubst %/,%,$$(dir $$(file))), \
  91         INCLUDE_FILES := $$(notdir $$(file)), \
  92         OBJECT_DIR := $$($1_OUTPUT_DIR)/support/$$(name), \
  93         OUTPUT_DIR := $$($1_OUTPUT_DIR)/$$($1_OUTPUT_SUBDIR), \
  94         CFLAGS := $$($1_CFLAGS) $$($1_CFLAGS_$$(name)), \
  95         LDFLAGS := $$($1_LDFLAGS) $$($1_LDFLAGS_$$(name)), \
  96         LIBS := $$($1_LIBS_$$(name)), \
  97         OPTIMIZATION := $$(if $$($1_OPTIMIZATION_$$(name)),$$($1_OPTIMIZATION_$$(name)),LOW), \
  98         COPY_DEBUG_SYMBOLS := false, \
< prev index next >