Merge pull request #785 from nasa/746

Clean up duplication in makefiles
This commit is contained in:
dbankieris 2019-05-30 16:27:51 -05:00 committed by GitHub
commit 35c2dacac5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 84 additions and 87 deletions

View File

@ -38,7 +38,7 @@ foreach $argnum (0 .. $#ARGV) {
} elsif ($arg =~ /-t/ ) { } elsif ($arg =~ /-t/ ) {
$makefileAddArgs = $makefileAddArgs . " test "; $makefileAddArgs = $makefileAddArgs . " test ";
} elsif($arg=~ /-h/ ) { } elsif($arg=~ /-h/ ) {
pod2usage(-sections => "NAME|SYNOPSIS|DESCRIPTION|OPTIONS|FILES", -verbose => 99) ; pod2usage(-sections => "NAME|SYNOPSIS|DESCRIPTION|OPTIONS|FILES", -verbose => 99) ;
} else { } else {
$ENV{TRICK_CPFLAGS} .= " $arg" ; $ENV{TRICK_CPFLAGS} .= " $arg" ;
} }
@ -159,13 +159,10 @@ include ${TRICK_HOME}/share/trick/makefiles/Makefile.common
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)
PRINT_CONVERT_SWIG = $(info $(call COLOR,Running) convert_swig)
PRINT_MAKEFILE_SRC = $(info $(call COLOR,Writing) Makefile_src) PRINT_MAKEFILE_SRC = $(info $(call COLOR,Writing) Makefile_src)
PRINT_MAKEFILE_SWIG = $(info $(call COLOR,Writing) Makefile_swig) PRINT_MAKEFILE_SWIG = $(info $(call COLOR,Writing) Makefile_swig)
endif endif
MAKE_OUT := build/MAKE_out
all: all:
$(info Trick Build Process Complete) $(info Trick Build Process Complete)
@ -187,39 +184,39 @@ $(TRICK_STATIC_LIB):
# 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_define | build S_source.hh: S_define | build
$(PRINT_CP) $(PRINT_CP)
$(ECHO_CMD)${TRICK_HOME}/$(LIBEXEC)/trick/configuration_processor $(TRICK_CPFLAGS) 2>&1 | $(TEE) -a $(MAKE_OUT) ; exit $${PIPESTATUS[0]} $(call ECHO_AND_LOG,${TRICK_HOME}/$(LIBEXEC)/trick/configuration_processor $(TRICK_CPFLAGS))
build/Makefile_S_define: S_source.hh build/Makefile_S_define: S_source.hh
$(PRINT_S_DEF_DEPS) $(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 2>&1 | $(TEE) -a $(MAKE_OUT) ; exit $${PIPESTATUS[0]} $(call ECHO_AND_LOG,$(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:
$(PRINT_ICG) $(PRINT_ICG)
$(ECHO_CMD)${TRICK_HOME}/bin/trick-ICG -m ${TRICK_ICGFLAGS} ${TRICK_CXXFLAGS} ${TRICK_SYSTEM_CXXFLAGS} S_source.hh $(call ECHO_AND_LOG,${TRICK_HOME}/bin/trick-ICG -m ${TRICK_ICGFLAGS} ${TRICK_CXXFLAGS} ${TRICK_SYSTEM_CXXFLAGS} S_source.hh)
force_ICG: force_ICG:
$(PRINT_ICG) $(PRINT_ICG)
$(ECHO_CMD)${TRICK_HOME}/bin/trick-ICG -f -m ${TRICK_ICGFLAGS} ${TRICK_CXXFLAGS} ${TRICK_SYSTEM_CXXFLAGS} S_source.hh $(call ECHO_AND_LOG,${TRICK_HOME}/bin/trick-ICG -f -m ${TRICK_ICGFLAGS} ${TRICK_CXXFLAGS} ${TRICK_SYSTEM_CXXFLAGS} S_source.hh)
# Create makefile for IO code # Create makefile for IO code
build/Makefile_io_src: S_source.hh | build build/Makefile_io_src: S_source.hh | build
$(PRINT_ICG) $(PRINT_ICG)
$(ECHO_CMD)${TRICK_HOME}/bin/trick-ICG -m ${TRICK_ICGFLAGS} ${TRICK_CXXFLAGS} ${TRICK_SYSTEM_CXXFLAGS} $< 2>&1 | $(TEE) -a $(MAKE_OUT) ; exit $${PIPESTATUS[0]} $(call ECHO_AND_LOG,${TRICK_HOME}/bin/trick-ICG -m ${TRICK_ICGFLAGS} ${TRICK_CXXFLAGS} ${TRICK_SYSTEM_CXXFLAGS} $<)
# Create makefile for source code # Create makefile for source code
#build/Makefile_src: build/ICG_processed build/ICG_no_found build/S_define.lib_deps #build/Makefile_src: build/ICG_processed build/ICG_no_found build/S_define.lib_deps
build/Makefile_src: build/Makefile_src_deps build/Makefile_io_src S_source.hh build/Makefile_src: build/Makefile_src_deps build/Makefile_io_src S_source.hh
$(PRINT_MAKEFILE_SRC) $(PRINT_MAKEFILE_SRC)
$(ECHO_CMD)${TRICK_HOME}/$(LIBEXEC)/trick/make_makefile_src $? 2>&1 | $(TEE) -a $(MAKE_OUT) ; exit $${PIPESTATUS[0]} $(call ECHO_AND_LOG,${TRICK_HOME}/$(LIBEXEC)/trick/make_makefile_src $? 2>&1)
build/Makefile_src_deps: ; build/Makefile_src_deps: ;
# Create makefile for SWIG code # Create makefile for SWIG code
build/Makefile_swig: S_source.hh build/Makefile_swig_deps build/Makefile_swig: S_source.hh build/Makefile_swig_deps
$(PRINT_MAKEFILE_SWIG) $(PRINT_MAKEFILE_SWIG)
$(ECHO_CMD)${TRICK_HOME}/$(LIBEXEC)/trick/make_makefile_swig 2>&1 | $(TEE) -a $(MAKE_OUT) ; exit $${PIPESTATUS[0]} $(call ECHO_AND_LOG,${TRICK_HOME}/$(LIBEXEC)/trick/make_makefile_swig)
build/Makefile_swig_deps: ; build/Makefile_swig_deps: ;
@ -227,7 +224,7 @@ build/Makefile_swig_deps: ;
# build process. # build process.
.PHONY: convert_swig .PHONY: convert_swig
convert_swig: build/S_library_swig convert_swig: build/S_library_swig
$(ECHO_CMD)${TRICK_HOME}/$(LIBEXEC)/trick/convert_swig ${TRICK_CONVERT_SWIG_FLAGS} 2>&1 | $(TEE) -a $(MAKE_OUT) ; exit $${PIPESTATUS[0]} $(call ECHO_AND_LOG,${TRICK_HOME}/$(LIBEXEC)/trick/convert_swig ${TRICK_CONVERT_SWIG_FLAGS})
# Force S_define_exp to be remade each time this rule runs # Force S_define_exp to be remade each time this rule runs
.PHONY: S_define_exp .PHONY: S_define_exp

View File

@ -15,6 +15,7 @@ use Digest::MD5 qw(md5_hex) ;
use File::Path qw(make_path) ; use File::Path qw(make_path) ;
use html ; use html ;
use get_paths ; use get_paths ;
use verbose_build ;
## ##
## ================================================================================ ## ================================================================================
@ -353,7 +354,7 @@ sub process_file() {
} }
close OUT ; close OUT ;
print "Writing $out_file\n" ; print "Writing $out_file\n" if not verbose_build() ;
} }
} }

View File

@ -9,6 +9,7 @@ use Cwd ;
use Cwd 'abs_path'; use Cwd 'abs_path';
use trick_version ; use trick_version ;
use get_lib_deps ; use get_lib_deps ;
use verbose_build ;
my %processed_files ; my %processed_files ;
my %non_lib_processed_files ; my %non_lib_processed_files ;
@ -57,7 +58,7 @@ sub read_lib_deps($@) {
read_lib_deps($indent + 1 , @resolved_files) ; read_lib_deps($indent + 1 , @resolved_files) ;
} }
} }
} elsif ( exists( $ENV{TRICK_VERBOSE_BUILD} ) or exists( $ENV{VERBOSE} ) ) { } elsif ( verbose_build() ) {
print "Skipping Previously processed file \"$l\"\n" ; print "Skipping Previously processed file \"$l\"\n" ;
} }
} }
@ -236,8 +237,7 @@ S_OBJECTS = build/S_source.o
build/S_source.o: build/S_source.cpp | build/S_source.d build/S_source.o: build/S_source.cpp | build/S_source.d
\t\$(PRINT_COMPILE) \t\$(PRINT_COMPILE)
\t\@echo \$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -MMD -MP -c -o \$\@ \$\< >> \$(MAKE_OUT) \t\$(call ECHO_AND_LOG,\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -MMD -MP -c -o \$\@ \$\<)
\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -MMD -MP -c -o \$\@ \$\< 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}
build/S_source.d: ; build/S_source.d: ;
@ -293,8 +293,7 @@ foreach my $extension ( keys %files_by_extension ) {
\${MODEL_OBJECTS$extension} : build/%.o : /%$extension | build/%.d \$\$(dir \$\$\@) \${MODEL_OBJECTS$extension} : build/%.o : /%$extension | build/%.d \$\$(dir \$\$\@)
\t\$(PRINT_COMPILE) \t\$(PRINT_COMPILE)
\t\@echo $command >> \$(MAKE_OUT) \t\$(call ECHO_AND_LOG,$command)" ;
\t\$(ECHO_CMD)$command 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}" ;
} }
print MAKEFILE " print MAKEFILE "
@ -324,8 +323,7 @@ all: \$(S_MAIN) S_sie.resource
\$(S_MAIN): S_source.hh \$(TRICK_STATIC_LIB) \$(S_OBJECTS) \$(MODEL_OBJECTS) \$(S_MAIN): S_source.hh \$(TRICK_STATIC_LIB) \$(S_OBJECTS) \$(MODEL_OBJECTS)
\t\$(PRINT_EXE_LINK) \t\$(PRINT_EXE_LINK)
\t\@echo \$(TRICK_CPPC) -o \$@ \$(TRICK_SYSTEM_LDFLAGS) \$(S_OBJECTS) \$(LINK_LISTS) \$(TRICK_LDFLAGS) \$(TRICK_USER_LINK_LIBS) \$(READ_ONLY_LIBS) \$(LD_WHOLE_ARCHIVE) \$(TRICK_LIBS) \$(LD_NO_WHOLE_ARCHIVE) \$(TRICK_EXEC_LINK_LIBS) >> \$(MAKE_OUT) \t\$(call ECHO_AND_LOG,\$(TRICK_CPPC) -o \$@ \$(TRICK_SYSTEM_LDFLAGS) \$(S_OBJECTS) \$(LINK_LISTS) \$(TRICK_LDFLAGS) \$(TRICK_USER_LINK_LIBS) \$(READ_ONLY_LIBS) \$(LD_WHOLE_ARCHIVE) \$(TRICK_LIBS) \$(LD_NO_WHOLE_ARCHIVE) \$(TRICK_EXEC_LINK_LIBS))
\t\$(ECHO_CMD)\$(TRICK_CPPC) -o \$@ \$(TRICK_SYSTEM_LDFLAGS) \$(S_OBJECTS) \$(LINK_LISTS) \$(TRICK_LDFLAGS) \$(TRICK_USER_LINK_LIBS) \$(READ_ONLY_LIBS) \$(LD_WHOLE_ARCHIVE) \$(TRICK_LIBS) \$(LD_NO_WHOLE_ARCHIVE) \$(TRICK_EXEC_LINK_LIBS) 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}
# SIE ========================================================================== # SIE ==========================================================================
@ -333,8 +331,7 @@ sie: S_sie.resource
S_sie.resource: \$(S_MAIN) S_sie.resource: \$(S_MAIN)
\t\$(PRINT_SIE) \t\$(PRINT_SIE)
\t\@echo ./\$(S_MAIN) sie \t\$(call ECHO_AND_LOG,./\$(S_MAIN) sie)\n" ;
\t\$(ECHO_CMD)./\$(S_MAIN) sie 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}\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" ; open MAKEFILEOVER, ">build/Makefile_overrides" or die "Could not open build/Makefile_overrides" ;

View File

@ -10,6 +10,7 @@ use gte ;
use Digest::MD5 qw(md5_hex) ; use Digest::MD5 qw(md5_hex) ;
use trick_version ; use trick_version ;
use html ; use html ;
use verbose_build ;
use strict ; use strict ;
my @exclude_paths ; my @exclude_paths ;
@ -18,7 +19,7 @@ my @ext_lib_paths ;
my @files_to_process ; my @files_to_process ;
my @ext_lib_files ; my @ext_lib_files ;
my %md5s ; my %md5s ;
my $verbose_build = exists($ENV{'TRICK_VERBOSE_BUILD'}) ; my $verbose_build = verbose_build() ;
my %trick_headers ; my %trick_headers ;
my %python_modules ; my %python_modules ;
my %python_module_dirs ; my %python_module_dirs ;
@ -209,8 +210,7 @@ TRICK_FIXED_PYTHON = \\
$swig_sim_dir/exception.py $swig_sim_dir/exception.py
\$(TRICK_FIXED_PYTHON): $swig_sim_dir/\% : \${TRICK_HOME}/share/trick/swig/\% \$(TRICK_FIXED_PYTHON): $swig_sim_dir/\% : \${TRICK_HOME}/share/trick/swig/\%
\t\@echo /bin/cp -f \$< \$@ >> \$(MAKE_OUT) \t\$(call ECHO_AND_LOG,/bin/cp -f \$< \$@)
\t\$(ECHO_CMD)/bin/cp -f \$< \$@ 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}
all: \$(TRICK_FIXED_PYTHON) all: \$(TRICK_FIXED_PYTHON)
@ -244,16 +244,13 @@ SWIG_I_CUSTOM_OUTDIR =" ;
define create_convert_swig_rule define create_convert_swig_rule
build/%_py.i: /%.\$1 build/%_py.i: /%.\$1
\t\@echo \${TRICK_HOME}/\$(LIBEXEC)/trick/convert_swig \$\${TRICK_CONVERT_SWIG_FLAGS} \$\$< >> \$(MAKE_OUT) \t\$\$(call ECHO_AND_LOG,\${TRICK_HOME}/\$(LIBEXEC)/trick/convert_swig \$\${TRICK_CONVERT_SWIG_FLAGS} \$\$<)
\t\$(ECHO_CMD)\${TRICK_HOME}/\$(LIBEXEC)/trick/convert_swig \$\${TRICK_CONVERT_SWIG_FLAGS} \$\$< 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}
endef endef
EXTENSIONS := H h hh hxx h++ hpp \$(foreach EXTENSION,H h hh hxx h++ hpp,\$(eval \$(call create_convert_swig_rule,\$(EXTENSION))))
\$(foreach EXTENSION,\$(EXTENSIONS),\$(eval \$(call create_convert_swig_rule,\$(EXTENSION))))
build/top.i: build/CP_instances build/top.i: build/CP_instances
\t\@echo \${TRICK_HOME}/\${LIBEXEC}/trick/create_top_dot_i >> \$(MAKE_OUT) \t\$(call ECHO_AND_LOG,\${TRICK_HOME}/\${LIBEXEC}/trick/create_top_dot_i)
\t\${ECHO_CMD}\${TRICK_HOME}/\${LIBEXEC}/trick/create_top_dot_i 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}
# SWIG_SRC ===================================================================== # SWIG_SRC =====================================================================
@ -261,8 +258,7 @@ SWIG_SRC = \$(subst .i,.cpp,\$(SWIG_I)) $swig_src_dir/top.cpp
\$(SWIG_SRC) : %.cpp: %.i | %.d \$(SWIG_I) \$(SWIG_SRC) : %.cpp: %.i | %.d \$(SWIG_I)
\t\$(PRINT_SWIG) \t\$(PRINT_SWIG)
\t\@echo \$(SWIG) \$(TRICK_INCLUDE) \$(TRICK_DEFINES) \$(TRICK_VERSIONS) \$(TRICK_SWIG_FLAGS) -c++ -python -includeall -ignoremissing -w201,303,325,362,389,401,451 -MMD -MP -outdir trick -o \$@ \$< >> \$(MAKE_OUT) \t\$(call ECHO_AND_LOG,\$(SWIG) \$(TRICK_INCLUDE) \$(TRICK_DEFINES) \$(TRICK_VERSIONS) \$(TRICK_SWIG_FLAGS) -c++ -python -includeall -ignoremissing -w201 -w303 -w325 -w362 -w389 -w401 -w451 -MMD -MP -outdir trick -o \$@ \$<)
\t\$(ECHO_CMD)\$(SWIG) \$(TRICK_INCLUDE) \$(TRICK_DEFINES) \$(TRICK_VERSIONS) \$(TRICK_SWIG_FLAGS) -c++ -python -includeall -ignoremissing -w201,303,325,362,389,401,451 -MMD -MP -outdir trick -o \$@ \$< 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}
\$(SWIG_SRC:.cpp=.d): ; \$(SWIG_SRC:.cpp=.d): ;
@ -278,8 +274,7 @@ SWIG_SRC_CUSTOM_OUTDIR = \$(subst .i,.cpp,\$(SWIG_I_CUSTOM_OUTDIR))\n" ;
print MAKEFILE " print MAKEFILE "
build$cpp_file : build$swig_file | build$dependency_file trick/$trick_headers{$file}{python_module_dir} build$cpp_file : build$swig_file | build$dependency_file trick/$trick_headers{$file}{python_module_dir}
\t\$(PRINT_SWIG) \t\$(PRINT_SWIG)
\t\@echo \$(SWIG) \$(TRICK_INCLUDE) \$(TRICK_DEFINES) \$(TRICK_VERSIONS) \$(TRICK_SWIG_FLAGS) -c++ -python -includeall -ignoremissing -w201,303,325,362,389,401,451 -MMD -MP -outdir trick/$trick_headers{$file}{python_module_dir} -o \$@ \$< >> \$(MAKE_OUT) \t\$(call ECHO_AND_LOG,\$(SWIG) \$(TRICK_INCLUDE) \$(TRICK_DEFINES) \$(TRICK_VERSIONS) \$(TRICK_SWIG_FLAGS) -c++ -python -includeall -ignoremissing -w201 -w303 -w325 -w362 -w389 -w401 -w451 -MMD -MP -outdir trick/$trick_headers{$file}{python_module_dir} -o \$@ \$<)
\t\$(ECHO_CMD)\$(SWIG) \$(TRICK_INCLUDE) \$(TRICK_DEFINES) \$(TRICK_VERSIONS) \$(TRICK_SWIG_FLAGS) -c++ -python -includeall -ignoremissing -w201,303,325,362,389,401,451 -MMD -MP -outdir trick/$trick_headers{$file}{python_module_dir} -o \$@ \$< 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}
build$dependency_file: ; build$dependency_file: ;
-include build$dependency_file\n"; -include build$dependency_file\n";
} }
@ -292,8 +287,7 @@ SWIG_OBJECTS = \$(subst .cpp,.o,\$(SWIG_SRC)) \$(subst .cpp,.o,\$(SWIG_SRC_CUSTO
\$(SWIG_OBJECTS): %.o: %.cpp \$(SWIG_OBJECTS): %.o: %.cpp
\t\$(PRINT_COMPILE_SWIG) \t\$(PRINT_COMPILE_SWIG)
\t\@echo \$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) \$(TRICK_SWIG_CFLAGS) \$(TRICK_SYSTEM_SWIG_CFLAGS) \$-Wno-unused-parameter -c -o \$@ \$< >> \$(MAKE_OUT) \t\$(call ECHO_AND_LOG,\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) \$(TRICK_SWIG_CFLAGS) \$(TRICK_SYSTEM_SWIG_CFLAGS) -Wno-unused-parameter -c -o \$@ \$<)
\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) \$(TRICK_SWIG_CFLAGS) \$(TRICK_SYSTEM_SWIG_CFLAGS) -Wno-unused-parameter -c -o \$@ \$< 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}
\$(S_MAIN): \$(SWIG_OBJECTS) \$(S_MAIN): \$(SWIG_OBJECTS)

View File

@ -0,0 +1,13 @@
package verbose_build ;
use Exporter ();
@ISA = qw(Exporter);
@EXPORT = qw(verbose_build);
use strict ;
sub verbose_build {
return exists($ENV{'TRICK_VERBOSE_BUILD'}) or exists($ENV{'VERBOSE'});
}
1;

View File

@ -1,22 +1,28 @@
SHELL := /bin/bash SHELL := /bin/bash
CD := cd CD := cd
MV := /bin/mv MV := /bin/mv
RM := /bin/rm RM := /bin/rm
CP := /bin/cp CP := /bin/cp
PWD = $(shell /bin/pwd) MAKE_OUT := build/MAKE_out
export TRICK_HOME := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))../../..) PWD = $(shell /bin/pwd)
COLOR = $(1)
COLOR = $(1)
ifdef VERBOSE ifdef VERBOSE
TRICK_VERBOSE_BUILD=1 TRICK_VERBOSE_BUILD := 1
endif endif
ifndef TRICK_VERBOSE_BUILD ifdef TRICK_VERBOSE_BUILD
ECHO_CMD = @ ECHO_TO_TERMINAL = @echo $1
endif endif
define ECHO_AND_LOG
$(call ECHO_TO_TERMINAL, $1)
@echo $1 >> $(MAKE_OUT)
@$1 2>&1 | $(TEE) -a $(MAKE_OUT) ; exit $${PIPESTATUS[0]}
endef
export TRICK_HOME := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))../../..)
export TRICK_HOST_TYPE := $(shell $(TRICK_HOME)/bin/trick-gte TRICK_HOST_TYPE) export TRICK_HOST_TYPE := $(shell $(TRICK_HOME)/bin/trick-gte TRICK_HOST_TYPE)
export TRICK_VERSION := $(shell $(TRICK_HOME)/bin/trick-version -v) export TRICK_VERSION := $(shell $(TRICK_HOME)/bin/trick-version -v)
export TRICK_MAJOR := $(shell $(TRICK_HOME)/bin/trick-version -y) export TRICK_MAJOR := $(shell $(TRICK_HOME)/bin/trick-version -y)

View File

@ -87,6 +87,7 @@
# #
# For more information, see: # For more information, see:
# github.com/nasa/trick/wiki/Trickified-Project-Libraries # github.com/nasa/trick/wiki/Trickified-Project-Libraries
ifndef TRICKIFY_CXX_FLAGS ifndef TRICKIFY_CXX_FLAGS
$(error TRICKIFY_CXX_FLAGS must be set) $(error TRICKIFY_CXX_FLAGS must be set)
endif endif
@ -94,17 +95,16 @@ endif
TRICKIFY_BUILD_TYPE ?= PLO TRICKIFY_BUILD_TYPE ?= PLO
TRICKIFY_OBJECT_NAME ?= trickified.o TRICKIFY_OBJECT_NAME ?= trickified.o
TRICKIFY_PYTHON_DIR ?= python TRICKIFY_PYTHON_DIR ?= python
TRICK_HOME := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/../../..) include $(dir $(lastword $(MAKEFILE_LIST)))Makefile.common
MAKE_OUT ?= build/MAKE_out
ifneq ($(wildcard build),) BUILD_DIR := $(dir $(MAKE_OUT))
SWIG_OBJECTS := $(shell cat build/S_library_swig) ifneq ($(wildcard $(BUILD_DIR)),)
SWIG_OBJECTS := $(addprefix build,$(addsuffix _py.o,$(basename $(SWIG_OBJECTS)))) SWIG_OBJECTS := $(shell cat $(BUILD_DIR)S_library_swig)
IO_OBJECTS := $(shell find build -name "io_*.cpp") SWIG_OBJECTS := $(addprefix $(BUILD_DIR),$(addsuffix _py.o,$(basename $(SWIG_OBJECTS))))
IO_OBJECTS := $(shell find $(BUILD_DIR) -name "io_*.cpp")
IO_OBJECTS := $(IO_OBJECTS:.cpp=.o) IO_OBJECTS := $(IO_OBJECTS:.cpp=.o)
endif endif
include $(TRICK_HOME)/share/trick/makefiles/Makefile.common
TRICK_CFLAGS += $(TRICKIFY_CXX_FLAGS) TRICK_CFLAGS += $(TRICKIFY_CXX_FLAGS)
TRICK_CXXFLAGS += $(TRICKIFY_CXX_FLAGS) TRICK_CXXFLAGS += $(TRICKIFY_CXX_FLAGS)
@ -114,23 +114,19 @@ TRICK_EXT_LIB_DIRS :=
$(TRICKIFY_OBJECT_NAME): $(SWIG_OBJECTS) $(IO_OBJECTS) | $(dir $(TRICKIFY_OBJECT_NAME)) $(TRICKIFY_OBJECT_NAME): $(SWIG_OBJECTS) $(IO_OBJECTS) | $(dir $(TRICKIFY_OBJECT_NAME))
$(info $(call COLOR,Linking) $@) $(info $(call COLOR,Linking) $@)
ifeq ($(TRICKIFY_BUILD_TYPE),PLO) ifeq ($(TRICKIFY_BUILD_TYPE),PLO)
@echo $(LD) $(LD_PARTIAL) -o $@ $^ >> $(MAKE_OUT) $(call ECHO_AND_LOG,$(LD) $(LD_PARTIAL) -o $@ $^)
$(ECHO_CMD)ld -r -o $@ $^ 2>&1 | $(TEE) -a $(MAKE_OUT); exit $${PIPESTATUS[0]}
else ifeq ($(TRICKIFY_BUILD_TYPE),SHARED) else ifeq ($(TRICKIFY_BUILD_TYPE),SHARED)
@echo $(TRICK_CPPC) -shared -o $@ $^ >> $(MAKE_OUT) $(call ECHO_AND_LOG,$(TRICK_CPPC) -shared -o $@ $^)
$(ECHO_CMD)c++ -shared -o $@ $^ 2>&1 | $(TEE) -a $(MAKE_OUT); exit $${PIPESTATUS[0]}
else ifeq ($(TRICKIFY_BUILD_TYPE),STATIC) else ifeq ($(TRICKIFY_BUILD_TYPE),STATIC)
@echo ar rcs $@ $^ >> $(MAKE_OUT) $(call ECHO_AND_LOG,ar rcs $@ $^)
$(ECHO_CMD)ar rcs $@ $^ 2>&1 | $(TEE) -a $(MAKE_OUT); exit $${PIPESTATUS[0]}
endif endif
$(dir $(TRICKIFY_OBJECT_NAME)) $(TRICKIFY_PYTHON_DIR) build: $(dir $(TRICKIFY_OBJECT_NAME)) $(TRICKIFY_PYTHON_DIR) $(BUILD_DIR):
@mkdir -p $@ @mkdir -p $@
$(IO_OBJECTS): %.o: %.cpp $(IO_OBJECTS): %.o: %.cpp
$(info $(call COLOR,Compiling) $<) $(info $(call COLOR,Compiling) $<)
@echo $(TRICK_CPPC) $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) -std=c++11 -Wno-invalid-offsetof -MMD -MP -c -o $@ $< >> $(MAKE_OUT) $(call ECHO_AND_LOG,$(TRICK_CPPC) $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) -std=c++11 -Wno-invalid-offsetof -MMD -MP -c -o $@ $<)
$(ECHO_CMD)$(TRICK_CPPC) $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) -std=c++11 -Wno-invalid-offsetof -MMD -MP -c -o $@ $< 2>&1 | $(TEE) -a $(MAKE_OUT) ; exit $${PIPESTATUS[0]}
$(IO_OBJECTS:.o=.d): %.d: ; $(IO_OBJECTS:.o=.d): %.d: ;
@ -138,27 +134,22 @@ $(IO_OBJECTS:.o=.d): %.d: ;
$(SWIG_OBJECTS): %.o: %.cpp $(SWIG_OBJECTS): %.o: %.cpp
$(info $(call COLOR,Compiling) $<) $(info $(call COLOR,Compiling) $<)
@echo $(TRICK_CPPC) $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) $(PYTHON_INCLUDES) -Wno-unused-parameter -Wno-shadow -c -o $@ $< >> $(MAKE_OUT) $(call ECHO_AND_LOG,$(TRICK_CPPC) $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) $(PYTHON_INCLUDES) -Wno-unused-parameter -Wno-shadow -c -o $@ $<)
$(ECHO_CMD)$(TRICK_CPPC) $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) $(PYTHON_INCLUDES) -Wno-unused-parameter -Wno-shadow -c -o $@ $< 2>&1 | $(TEE) -a $(MAKE_OUT) ; exit $${PIPESTATUS[0]}
$(SWIG_OBJECTS:.o=.cpp): %.cpp: %.i | %.d $(TRICKIFY_PYTHON_DIR) $(SWIG_OBJECTS:.o=.i) $(SWIG_OBJECTS:.o=.cpp): %.cpp: %.i | %.d $(TRICKIFY_PYTHON_DIR) $(SWIG_OBJECTS:.o=.i)
$(info $(call COLOR,SWIGing) $<) $(info $(call COLOR,SWIGing) $<)
@echo $(SWIG) $(TRICK_INCLUDE) $(TRICK_DEFINES) $(TRICK_VERSIONS) $(TRICK_SWIG_FLAGS) -c++ -python -includeall -ignoremissing -w201,303,325,362,389,401,451 -MMD -MP -outdir $(TRICKIFY_PYTHON_DIR) -o $@ $< >> $(MAKE_OUT) $(call ECHO_AND_LOG,$(SWIG) $(TRICK_INCLUDE) $(TRICK_DEFINES) $(TRICK_VERSIONS) $(TRICK_SWIG_FLAGS) -c++ -python -includeall -ignoremissing -w201 -w303 -w325 -w362 -w389 -w401 -w451 -MMD -MP -outdir $(TRICKIFY_PYTHON_DIR) -o $@ $<)
$(ECHO_CMD)$(SWIG) $(TRICK_INCLUDE) $(TRICK_DEFINES) $(TRICK_VERSIONS) $(TRICK_SWIG_FLAGS) -c++ -python -includeall -ignoremissing -w201,303,325,362,389,401,451 -MMD -MP -outdir $(TRICKIFY_PYTHON_DIR) -o $@ $< 2>&1 | $(TEE) -a $(MAKE_OUT) ; exit $${PIPESTATUS[0]}
$(SWIG_OBJECTS:.o=.d): ; $(SWIG_OBJECTS:.o=.d): ;
-include $(SWIG_OBJECTS:.o=.d) -include $(SWIG_OBJECTS:.o=.d)
define create_convert_swig_rule define create_convert_swig_rule
build/%_py.i: /%.$1 $(BUILD_DIR)/%_py.i: /%.$1
$$(info $$(call COLOR,Converting) $$<) $$(call ECHO_AND_LOG,${TRICK_HOME}/$(LIBEXEC)/trick/convert_swig $${TRICK_CONVERT_SWIG_FLAGS} $$<)
@echo ${TRICK_HOME}/$(LIBEXEC)/trick/convert_swig ${TRICK_CONVERT_SWIG_FLAGS} $$< >> $(MAKE_OUT)
$(ECHO_CMD)${TRICK_HOME}/$(LIBEXEC)/trick/convert_swig ${TRICK_CONVERT_SWIG_FLAGS} $$< 2>&1 | $(TEE) -a $(MAKE_OUT) ; exit $$${PIPESTATUS[0]}
endef endef
EXTENSIONS := H h hh hxx h++ hpp $(foreach EXTENSION,H h hh hxx h++ hpp,$(eval $(call create_convert_swig_rule,$(EXTENSION))))
$(foreach EXTENSION,$(EXTENSIONS),$(eval $(call create_convert_swig_rule,$(EXTENSION))))
# SWIG_OBJECTS and IO_OBJECTS are meant to contain all of the *_py and io_* # SWIG_OBJECTS and IO_OBJECTS are meant to contain all of the *_py and io_*
# object file names, respectively, by looking at products of ICG and # object file names, respectively, by looking at products of ICG and
@ -191,10 +182,9 @@ $(foreach EXTENSION,$(EXTENSIONS),$(eval $(call create_convert_swig_rule,$(EXTEN
# dependency list. The method is laid out in more detail here: # dependency list. The method is laid out in more detail here:
# http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/ # http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
build/S_source.d: | $(dir $@) $(BUILD_DIR)S_source.d: | $(BUILD_DIR)
$(ECHO_CMD)$(TRICK_HOME)/bin/trick-ICG $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) $(TRICK_ICGFLAGS) S_source.hh $(call ECHO_AND_LOG,$(TRICK_HOME)/bin/trick-ICG $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) $(TRICK_ICGFLAGS) S_source.hh)
$(ECHO_CMD)$(TRICK_HOME)/$(LIBEXEC)/trick/make_makefile_swig 2>&1 | $(TEE) -a $(MAKE_OUT) ; exit $${PIPESTATUS[0]} $(call ECHO_AND_LOG,$(TRICK_HOME)/$(LIBEXEC)/trick/make_makefile_swig)
@echo $(TRICK_CC) -MM -MP -MT $@ -MF $@ $(TRICKIFY_CXX_FLAGS) S_source.hh >> $(MAKE_OUT) $(call ECHO_AND_LOG,$(TRICK_CC) -MM -MP -MT $@ -MF $@ $(TRICKIFY_CXX_FLAGS) S_source.hh)
$(ECHO_CMD) $(TRICK_CC) -MM -MP -MT $@ -MF $@ $(TRICKIFY_CXX_FLAGS) S_source.hh 2>&1 | $(TEE) -a $(MAKE_OUT) ; exit $${PIPESTATUS[0]}
-include build/S_source.d -include $(BUILD_DIR)S_source.d

View File

@ -377,8 +377,7 @@ void PrintAttributes::printIOMakefile() {
<< std::endl << std::endl
<< "$(IO_OBJECTS): \%.o : \%.cpp | \%.d" << std::endl << "$(IO_OBJECTS): \%.o : \%.cpp | \%.d" << std::endl
<< "\t$(PRINT_COMPILE)" << std::endl << "\t$(PRINT_COMPILE)" << std::endl
<< "\t@echo $(TRICK_CPPC) $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) $(TRICK_IO_CXXFLAGS) -MMD -MP -c -o $@ $< >> $(MAKE_OUT)" << std::endl << "\t$(call ECHO_AND_LOG,$(TRICK_CPPC) $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) $(TRICK_IO_CXXFLAGS) -MMD -MP -c -o $@ $<)" << std::endl
<< "\t$(ECHO_CMD)$(TRICK_CPPC) $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) $(TRICK_IO_CXXFLAGS) -MMD -MP -c -o $@ $< 2>&1 | $(TEE) -a $(MAKE_OUT) ; exit $${PIPESTATUS[0]}" << std::endl
<< std::endl << std::endl
<< "$(IO_OBJECTS:.o=.d): ;" << std::endl << "$(IO_OBJECTS:.o=.d): ;" << std::endl
<< std::endl << std::endl