mirror of
https://github.com/nasa/trick.git
synced 2024-12-24 07:16:41 +00:00
S_overrides.mk is included twice when building #360
Moving targets to the more correct makefile like defining S_MAIN should be in make_makefile_src. Moved the makefile_overrides rules read from directories into their own makefile.
This commit is contained in:
parent
fa5d30f992
commit
b2f8c9894e
27
bin/trick-CP
27
bin/trick-CP
@ -55,12 +55,6 @@ endif
|
|||||||
ifneq ($(wildcard ${TRICK_HOME}/share/trick/makefiles/Makefile.common),)
|
ifneq ($(wildcard ${TRICK_HOME}/share/trick/makefiles/Makefile.common),)
|
||||||
include ${TRICK_HOME}/share/trick/makefiles/Makefile.common
|
include ${TRICK_HOME}/share/trick/makefiles/Makefile.common
|
||||||
|
|
||||||
S_MAIN = S_main_${TRICK_HOST_CPU}.exe
|
|
||||||
ifeq ($(MAKECMDGOALS), test)
|
|
||||||
TRICK_HOST_CPU := $(shell $(TRICK_HOME)/bin/trick-gte TRICK_HOST_CPU)_test
|
|
||||||
S_MAIN = T_main_${TRICK_HOST_CPU}.exe
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef TRICK_VERBOSE_BUILD
|
ifndef TRICK_VERBOSE_BUILD
|
||||||
PRINT_CP = $(info $(call COLOR,Running) configuration_processor)
|
PRINT_CP = $(info $(call COLOR,Running) configuration_processor)
|
||||||
PRINT_ICG = $(info $(call COLOR,Running) ICG)
|
PRINT_ICG = $(info $(call COLOR,Running) ICG)
|
||||||
@ -70,6 +64,8 @@ ifndef TRICK_VERBOSE_BUILD
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
all:
|
all:
|
||||||
|
$(info [32mTrick Build Process Complete[00m)
|
||||||
|
|
||||||
|
|
||||||
test: TRICK_SYSTEM_CFLAGS += -DTRICK_UNIT_TEST
|
test: TRICK_SYSTEM_CFLAGS += -DTRICK_UNIT_TEST
|
||||||
test: TRICK_SYSTEM_CXXFLAGS += -DTRICK_UNIT_TEST
|
test: TRICK_SYSTEM_CXXFLAGS += -DTRICK_UNIT_TEST
|
||||||
@ -86,12 +82,13 @@ $(TRICK_STATIC_LIB):
|
|||||||
@exit -1
|
@exit -1
|
||||||
|
|
||||||
# CP creates S_source.hh required for ICG and SWIG processing
|
# CP creates S_source.hh required for ICG and SWIG processing
|
||||||
S%source.hh S%source.cpp: S_define build/S_define.d | build
|
S_source.hh: S_define | build
|
||||||
$(ECHO_CMD)$(TRICK_CPPC) $(TRICK_SFLAGS) $(TRICK_SYSTEM_SFLAGS) -M -MT S_source.hh -MF build/S_define.d -x c++ S_define
|
|
||||||
$(PRINT_CP)
|
$(PRINT_CP)
|
||||||
$(ECHO_CMD)${TRICK_HOME}/$(LIBEXEC)/trick/configuration_processor $(TRICK_CPFLAGS)
|
$(ECHO_CMD)${TRICK_HOME}/$(LIBEXEC)/trick/configuration_processor $(TRICK_CPFLAGS)
|
||||||
|
|
||||||
build/S_define.d: ;
|
build/Makefile_S_define: S_source.hh
|
||||||
|
$(PRINT_S_DEF_DEPS)
|
||||||
|
$(ECHO_CMD)$(TRICK_CPPC) $(TRICK_SFLAGS) $(TRICK_SYSTEM_SFLAGS) -MM -MT S_source.hh -MF build/Makefile_S_define -x c++ S_define
|
||||||
|
|
||||||
# Automatic and manual ICG rules
|
# Automatic and manual ICG rules
|
||||||
ICG:
|
ICG:
|
||||||
@ -141,16 +138,22 @@ Simulation make options:\n\
|
|||||||
make spotless - Performs a clean\n\
|
make spotless - Performs a clean\n\
|
||||||
make apocalypse - Performs a clean"
|
make apocalypse - Performs a clean"
|
||||||
|
|
||||||
-include S_overrides.mk
|
|
||||||
CLEAN_TARGETS = tidy clean spotless distclean apocalypse
|
CLEAN_TARGETS = tidy clean spotless distclean apocalypse
|
||||||
ifeq ($(findstring ${MAKECMDGOALS},$(CLEAN_TARGETS)),)
|
ifeq ($(findstring ${MAKECMDGOALS},$(CLEAN_TARGETS)),)
|
||||||
-include build/S_define.d
|
-include build/Makefile_S_define
|
||||||
-include build/Makefile_src
|
-include build/Makefile_src
|
||||||
-include build/Makefile_src_deps
|
-include build/Makefile_src_deps
|
||||||
-include build/Makefile_io_src
|
-include build/Makefile_io_src
|
||||||
-include build/Makefile_swig
|
-include build/Makefile_swig
|
||||||
-include build/Makefile_ICG
|
-include build/Makefile_ICG
|
||||||
-include build/Makefile_convert_swig
|
endif
|
||||||
|
-include S_overrides.mk
|
||||||
|
-include build/Makefile_overrides
|
||||||
|
|
||||||
|
ifeq ($(MAKECMDGOALS),)
|
||||||
|
$(info $(call COLOR,Building with the following compilation flags:))
|
||||||
|
$(info TRICK_CFLAGS = [36m$(TRICK_CFLAGS)[0m)
|
||||||
|
$(info TRICK_CXXFLAGS = [36m$(TRICK_CXXFLAGS)[0m)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -206,32 +206,6 @@ foreach $k ( sort keys %files_by_dir ) {
|
|||||||
$_ = $k ;
|
$_ = $k ;
|
||||||
($files_by_dir{$k}{dir_num} = $_) =~ s#^/## ;
|
($files_by_dir{$k}{dir_num} = $_) =~ s#^/## ;
|
||||||
$files_by_dir{$k}{dir_num} =~ s/[\/.]/_/g ;
|
$files_by_dir{$k}{dir_num} =~ s/[\/.]/_/g ;
|
||||||
# if a particular directory had an override file, save that into memory
|
|
||||||
if (open OV_FILE, "$k/makefile_overrides") {
|
|
||||||
while ( <OV_FILE> ) {
|
|
||||||
s/(#.*)// ;
|
|
||||||
my ($comment) = $1 ;
|
|
||||||
s/\$[{(]CURDIR[})]\/(\S+)/$k\/$1/g ;
|
|
||||||
s/(?:\$[{(]CURDIR[})]\/)?(\S*)\$[{(]OBJ_DIR[})]/$k\/$1object_\${TRICK_HOST_CPU}/g ;
|
|
||||||
s/\$[{(]CURDIR[})]/$k/g ;
|
|
||||||
while ( s,/[^/]+/\.\.,, ) {}
|
|
||||||
s//$comment/ ;
|
|
||||||
if ( s/^objects\s*:\s*// ) {
|
|
||||||
foreach my $ext ( qw{c C cc cxx cpp CPLUSPLUS l y} ) {
|
|
||||||
$files_by_dir{$k}{overrides} .= "\$(MODEL_${ext}_OBJ_$files_by_dir{$k}{dir_num}): $_" ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elsif ( s/^depend\s*:\s*// ) {
|
|
||||||
$files_by_dir{$k}{overrides} .= "depend_$files_by_dir{$k}{dir_num}: $_" ;
|
|
||||||
}
|
|
||||||
elsif ( s/([cfhy]|C|cc|cxx|cpp|CPLUSPLUS)_objects\s*:\s*// ) {
|
|
||||||
$files_by_dir{$k}{overrides} .= "\$(MODEL_$1_OBJ_$files_by_dir{$k}{dir_num}): $_" ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$files_by_dir{$k}{overrides} .= $_ ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
my $wd = abs_path(cwd()) ;
|
my $wd = abs_path(cwd()) ;
|
||||||
@ -259,11 +233,12 @@ ifndef TRICK_VERBOSE_BUILD
|
|||||||
PRINT_COMPILE = \$(info \$(call COLOR,Compiling) \$<)
|
PRINT_COMPILE = \$(info \$(call COLOR,Compiling) \$<)
|
||||||
PRINT_EXE_LINK = \$(info \$(call COLOR,Linking) \$@)
|
PRINT_EXE_LINK = \$(info \$(call COLOR,Linking) \$@)
|
||||||
PRINT_SIE = \$(info \$(call COLOR,Writing) \$@)
|
PRINT_SIE = \$(info \$(call COLOR,Writing) \$@)
|
||||||
ifeq (\$(MAKECMDGOALS),)
|
endif
|
||||||
\$(info \$(call COLOR,Building with the following compilation flags:))
|
|
||||||
\$(info TRICK_CFLAGS = [36m\$(TRICK_CFLAGS)[0m)
|
S_MAIN = S_main_\${TRICK_HOST_CPU}.exe
|
||||||
\$(info TRICK_CXXFLAGS = [36m\$(TRICK_CXXFLAGS)[0m)
|
ifeq (\$(MAKECMDGOALS), test)
|
||||||
endif
|
TRICK_HOST_CPU := \$(shell \$(TRICK_HOME)/bin/trick-gte TRICK_HOST_CPU)_test
|
||||||
|
S_MAIN = T_main_\${TRICK_HOST_CPU}.exe
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# S_OBJECTS ====================================================================
|
# S_OBJECTS ====================================================================
|
||||||
@ -285,19 +260,8 @@ $num_inc_objs = 0 ;
|
|||||||
# List out all of the object files and put the list in a file that we can pass to the linker.
|
# List out all of the object files and put the list in a file that we can pass to the linker.
|
||||||
# Passing all of them directly to the linker in the command line can exceed the line limit.
|
# Passing all of them directly to the linker in the command line can exceed the line limit.
|
||||||
open MODEL_LINK_LIST, ">build/model_link_list" or die "Could not open build/model_link_list" ;
|
open MODEL_LINK_LIST, ">build/model_link_list" or die "Could not open build/model_link_list" ;
|
||||||
#foreach $k ( sort keys %files_by_dir ) {
|
|
||||||
# foreach my $ext ( qw{ c C cc cxx cpp c++ } ) {
|
|
||||||
# if ( scalar @{$files_by_dir{$k}{$ext}} ne 0 ) {
|
|
||||||
# foreach $f ( @{$files_by_dir{$k}{$ext}} ) {
|
|
||||||
# print MAKEFILE " \\\n build$k/$files_by_dir{$k}{src_dir}$f" . "o" ;
|
|
||||||
# print MODEL_LINK_LIST "build$k/$files_by_dir{$k}{src_dir}$f" . "o\n" ;
|
|
||||||
# }
|
|
||||||
# $num_inc_objs++ ;
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
#}
|
|
||||||
foreach my $ext ( qw{ c C cc cxx cpp c++ } ) {
|
foreach my $ext ( qw{ c C cc cxx cpp c++ } ) {
|
||||||
print MAKEFILE "\n\nMODEL_${ext}_OBJECTS =" ;
|
print MAKEFILE "\n\nMODEL_${ext}_OBJECTS :=" ;
|
||||||
foreach $k ( sort keys %files_by_dir ) {
|
foreach $k ( sort keys %files_by_dir ) {
|
||||||
if ( scalar @{$files_by_dir{$k}{$ext}} ne 0 ) {
|
if ( scalar @{$files_by_dir{$k}{$ext}} ne 0 ) {
|
||||||
foreach $f ( @{$files_by_dir{$k}{$ext}} ) {
|
foreach $f ( @{$files_by_dir{$k}{$ext}} ) {
|
||||||
@ -310,7 +274,7 @@ foreach my $ext ( qw{ c C cc cxx cpp c++ } ) {
|
|||||||
}
|
}
|
||||||
close MODEL_LINK_LIST ;
|
close MODEL_LINK_LIST ;
|
||||||
|
|
||||||
print MAKEFILE "\n\nMODEL_OBJECTS =" ;
|
print MAKEFILE "\n\nMODEL_OBJECTS :=" ;
|
||||||
foreach my $ext ( qw{ c C cc cxx cpp c++ } ) {
|
foreach my $ext ( qw{ c C cc cxx cpp c++ } ) {
|
||||||
print MAKEFILE " \${MODEL_${ext}_OBJECTS}" ;
|
print MAKEFILE " \${MODEL_${ext}_OBJECTS}" ;
|
||||||
}
|
}
|
||||||
@ -377,7 +341,6 @@ foreach ( @all_read_only_libs ) {
|
|||||||
print MAKEFILE "
|
print MAKEFILE "
|
||||||
|
|
||||||
all: \$(S_MAIN) S_sie.resource
|
all: \$(S_MAIN) S_sie.resource
|
||||||
\t\$(info [32mTrick Build Process Complete[00m)
|
|
||||||
|
|
||||||
\$(S_MAIN): \$(TRICK_STATIC_LIB) \$(S_OBJECTS) \$(MODEL_OBJECTS)
|
\$(S_MAIN): \$(TRICK_STATIC_LIB) \$(S_OBJECTS) \$(MODEL_OBJECTS)
|
||||||
\t\$(PRINT_EXE_LINK)
|
\t\$(PRINT_EXE_LINK)
|
||||||
@ -392,12 +355,39 @@ S_sie.resource: \$(S_MAIN)
|
|||||||
\t\$(ECHO_CMD)./\$(S_MAIN) sie\n" ;
|
\t\$(ECHO_CMD)./\$(S_MAIN) sie\n" ;
|
||||||
|
|
||||||
# write out the override files we have read in
|
# write out the override files we have read in
|
||||||
|
open MAKEFILEOVER, ">build/Makefile_overrides" or die "Could not open build/Makefile_overrides" ;
|
||||||
foreach $k ( sort keys %files_by_dir ) {
|
foreach $k ( sort keys %files_by_dir ) {
|
||||||
if ( exists $files_by_dir{$k}{overrides} ) {
|
# if a particular directory had an override file, save that into memory
|
||||||
print MAKEFILE "\n# Overrides from $k\n\n" ;
|
if (open OV_FILE, "$k/makefile_overrides") {
|
||||||
print MAKEFILE "$files_by_dir{$k}{overrides}\n" ;
|
while ( <OV_FILE> ) {
|
||||||
|
s/(#.*)// ;
|
||||||
|
my ($comment) = $1 ;
|
||||||
|
s/\$[{(]CURDIR[})]\/(\S+)/$k\/$1/g ;
|
||||||
|
s/(?:\$[{(]CURDIR[})]\/)?(\S*)\$[{(]OBJ_DIR[})]/$k\/$1object_\${TRICK_HOST_CPU}/g ;
|
||||||
|
s/\$[{(]CURDIR[})]/$k/g ;
|
||||||
|
while ( s,/[^/]+/\.\.,, ) {}
|
||||||
|
s//$comment/ ;
|
||||||
|
if ( s/^objects\s*:\s*// ) {
|
||||||
|
foreach my $ext ( qw{c C cc cxx cpp CPLUSPLUS l y} ) {
|
||||||
|
$files_by_dir{$k}{overrides} .= "\$(MODEL_${ext}_OBJ_$files_by_dir{$k}{dir_num}): $_" ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elsif ( s/^depend\s*:\s*// ) {
|
||||||
|
$files_by_dir{$k}{overrides} .= "depend_$files_by_dir{$k}{dir_num}: $_" ;
|
||||||
|
}
|
||||||
|
elsif ( s/([cfhy]|C|cc|cxx|cpp|CPLUSPLUS)_objects\s*:\s*// ) {
|
||||||
|
$files_by_dir{$k}{overrides} .= "\$(MODEL_$1_OBJ_$files_by_dir{$k}{dir_num}): $_" ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$files_by_dir{$k}{overrides} .= $_ ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close OV_FILE ;
|
||||||
|
print MAKEFILEOVER "\n# Overrides from $k\n\n" ;
|
||||||
|
print MAKEFILEOVER "$files_by_dir{$k}{overrides}\n" ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
close MAKEFILEOVER ;
|
||||||
|
|
||||||
# write out all of files we processed as dependencies to Makefile_src
|
# write out all of files we processed as dependencies to Makefile_src
|
||||||
open MAKEFILEDEPS, ">build/Makefile_src_deps" or die "Could not open build/Makefile_src_deps" ;
|
open MAKEFILEDEPS, ">build/Makefile_src_deps" or die "Could not open build/Makefile_src_deps" ;
|
||||||
|
@ -461,13 +461,6 @@ LINK_LISTS += \$(LD_FILELIST)build/py_link_list
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open MAKEFILECONV , ">build/Makefile_convert_swig" or return ;
|
|
||||||
print MAKEFILECONV "build/convert_swig_last_run:" ;
|
|
||||||
foreach $f ( @files_to_process ) {
|
|
||||||
print MAKEFILECONV " \\\n $f" ;
|
|
||||||
}
|
|
||||||
close MAKEFILECONV ;
|
|
||||||
|
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user