mirror of
https://github.com/nasa/trick.git
synced 2024-12-18 20:57:55 +00:00
Merge pull request #827 from nasa/672
Add makefile function for target-specific variable
This commit is contained in:
commit
4f1ba26411
@ -245,6 +245,11 @@ build/S_source.d: ;
|
||||
|
||||
# MODEL_OBJECTS ================================================================
|
||||
|
||||
# This function allows users to specify target-specific variables for individual
|
||||
# or groups of source files. For example:
|
||||
# \$(call FIND_MODEL_OBJECTS, /path/to/file /path/to/directory \$(LIST_OF_PATHS)): TRICK_CXXFLAGS += -Werror
|
||||
FIND_MODEL_OBJECTS = \$(foreach PATH, \$1, \$(filter \$(addprefix build, \$(addsuffix %, \$(PATH))), \$(MODEL_OBJECTS)))
|
||||
|
||||
" ;
|
||||
|
||||
# List out all of the object files and put the list in a file that we can pass to the linker.
|
||||
|
11
test/SIM_target_specific_variables/S_define
Normal file
11
test/SIM_target_specific_variables/S_define
Normal file
@ -0,0 +1,11 @@
|
||||
#include "sim_objects/default_trick_sys.sm"
|
||||
|
||||
##include "one/1.hh"
|
||||
##include "many/a.hh"
|
||||
##include "many/b.hh"
|
||||
##include "many/c.hh"
|
||||
##include "nested/x.hh"
|
||||
##include "nested/y/y.hh"
|
||||
##include "nested/z/z.hh"
|
||||
|
||||
class Sandbox : public Trick::SimObject {};
|
16
test/SIM_target_specific_variables/S_overrides.mk
Normal file
16
test/SIM_target_specific_variables/S_overrides.mk
Normal file
@ -0,0 +1,16 @@
|
||||
MODELS :=$(CURDIR)/models
|
||||
|
||||
# Warn about comment markers /* within comments and make them errors, causing
|
||||
# the build to fail.
|
||||
TRICK_CXXFLAGS += -I$(MODELS) -Wcomment -Werror
|
||||
|
||||
PATHS := $(MODELS)/many $(MODELS)/nested
|
||||
|
||||
# The zero directory contains no files, so FIND_MODEL_OBJECTS should return an
|
||||
# empty list, resulting in a rule that is never run. If it is, the invalid
|
||||
# "not_a_flag" should cause the build to fail.
|
||||
$(call FIND_MODEL_OBJECTS, $(MODELS)/zero): TRICK_CXXFLAGS += not_a_flag
|
||||
|
||||
# By turning off warnings about comment markers within comments in all the
|
||||
# offending files, this sim should build without error.
|
||||
$(call FIND_MODEL_OBJECTS, $(MODELS)/one/1 $(PATHS)): TRICK_CXXFLAGS += -Wno-comment
|
1
test/SIM_target_specific_variables/models/many/a.cpp
Normal file
1
test/SIM_target_specific_variables/models/many/a.cpp
Normal file
@ -0,0 +1 @@
|
||||
/* /* */
|
1
test/SIM_target_specific_variables/models/many/a.hh
Normal file
1
test/SIM_target_specific_variables/models/many/a.hh
Normal file
@ -0,0 +1 @@
|
||||
// @trick_link_dependency{many/a.cpp}
|
1
test/SIM_target_specific_variables/models/many/b.cpp
Normal file
1
test/SIM_target_specific_variables/models/many/b.cpp
Normal file
@ -0,0 +1 @@
|
||||
/* /* */
|
1
test/SIM_target_specific_variables/models/many/b.hh
Normal file
1
test/SIM_target_specific_variables/models/many/b.hh
Normal file
@ -0,0 +1 @@
|
||||
// @trick_link_dependency{many/b.cpp}
|
1
test/SIM_target_specific_variables/models/many/c.cpp
Normal file
1
test/SIM_target_specific_variables/models/many/c.cpp
Normal file
@ -0,0 +1 @@
|
||||
/* /* */
|
1
test/SIM_target_specific_variables/models/many/c.hh
Normal file
1
test/SIM_target_specific_variables/models/many/c.hh
Normal file
@ -0,0 +1 @@
|
||||
// @trick_link_dependency{many/c.cpp}
|
1
test/SIM_target_specific_variables/models/nested/x.cpp
Normal file
1
test/SIM_target_specific_variables/models/nested/x.cpp
Normal file
@ -0,0 +1 @@
|
||||
/* /* */
|
1
test/SIM_target_specific_variables/models/nested/x.hh
Normal file
1
test/SIM_target_specific_variables/models/nested/x.hh
Normal file
@ -0,0 +1 @@
|
||||
// @trick_link_dependency{nested/x.cpp}
|
1
test/SIM_target_specific_variables/models/nested/y/y.cpp
Normal file
1
test/SIM_target_specific_variables/models/nested/y/y.cpp
Normal file
@ -0,0 +1 @@
|
||||
/* /* */
|
1
test/SIM_target_specific_variables/models/nested/y/y.hh
Normal file
1
test/SIM_target_specific_variables/models/nested/y/y.hh
Normal file
@ -0,0 +1 @@
|
||||
// @trick_link_dependency{nested/y/y.cpp}
|
1
test/SIM_target_specific_variables/models/nested/z/z.cpp
Normal file
1
test/SIM_target_specific_variables/models/nested/z/z.cpp
Normal file
@ -0,0 +1 @@
|
||||
/* /* */
|
1
test/SIM_target_specific_variables/models/nested/z/z.hh
Normal file
1
test/SIM_target_specific_variables/models/nested/z/z.hh
Normal file
@ -0,0 +1 @@
|
||||
// @trick_link_dependency{nested/z/z.cpp}
|
1
test/SIM_target_specific_variables/models/one/1.cpp
Normal file
1
test/SIM_target_specific_variables/models/one/1.cpp
Normal file
@ -0,0 +1 @@
|
||||
/* /* */
|
1
test/SIM_target_specific_variables/models/one/1.hh
Normal file
1
test/SIM_target_specific_variables/models/one/1.hh
Normal file
@ -0,0 +1 @@
|
||||
// @trick_link_dependency{one/1.cpp}
|
@ -8,6 +8,7 @@ COMPILE_DIRS = \
|
||||
SIM_python_namespace \
|
||||
SIM_rti \
|
||||
SIM_stls \
|
||||
SIM_target_specific_variables \
|
||||
SIM_test_dp \
|
||||
SIM_test_dr \
|
||||
SIM_test_io \
|
||||
|
Loading…
Reference in New Issue
Block a user