mirror of
https://github.com/nasa/trick.git
synced 2024-12-24 07:16:41 +00:00
Clean up duplication in makefiles
Normalize behavior of TRICK_VERBOSE_BUILD Closes #746
This commit is contained in:
parent
cf5c087ef0
commit
7b0e84e58e
25
bin/trick-CP
25
bin/trick-CP
@ -38,7 +38,7 @@ foreach $argnum (0 .. $#ARGV) {
|
||||
} elsif ($arg =~ /-t/ ) {
|
||||
$makefileAddArgs = $makefileAddArgs . " test ";
|
||||
} elsif($arg=~ /-h/ ) {
|
||||
pod2usage(-sections => "NAME|SYNOPSIS|DESCRIPTION|OPTIONS|FILES", -verbose => 99) ;
|
||||
pod2usage(-sections => "NAME|SYNOPSIS|DESCRIPTION|OPTIONS|FILES", -verbose => 99) ;
|
||||
} else {
|
||||
$ENV{TRICK_CPFLAGS} .= " $arg" ;
|
||||
}
|
||||
@ -87,7 +87,7 @@ call math models listed in the S_define file and will generate a make‐
|
||||
file to build these math models.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<-g> | B<--debug>
|
||||
@ -132,7 +132,7 @@ Set the verbose level. Valid entries are 0-3
|
||||
The simulation-specific executive source code file.
|
||||
|
||||
=item B<build/S_library_list>
|
||||
|
||||
|
||||
The simulation-specific object code link list file.
|
||||
|
||||
=item B<S_default.dat>
|
||||
@ -159,13 +159,10 @@ include ${TRICK_HOME}/share/trick/makefiles/Makefile.common
|
||||
ifndef TRICK_VERBOSE_BUILD
|
||||
PRINT_CP = $(info $(call COLOR,Running) configuration_processor)
|
||||
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_SWIG = $(info $(call COLOR,Writing) Makefile_swig)
|
||||
endif
|
||||
|
||||
MAKE_OUT := build/MAKE_out
|
||||
|
||||
all:
|
||||
$(info [32mTrick Build Process Complete[00m)
|
||||
|
||||
@ -187,39 +184,39 @@ $(TRICK_STATIC_LIB):
|
||||
# CP creates S_source.hh required for ICG and SWIG processing
|
||||
S_source.hh: S_define | build
|
||||
$(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
|
||||
$(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
|
||||
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:
|
||||
$(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
|
||||
build/Makefile_io_src: S_source.hh | build
|
||||
$(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
|
||||
#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
|
||||
$(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: ;
|
||||
|
||||
# Create makefile for SWIG code
|
||||
build/Makefile_swig: S_source.hh build/Makefile_swig_deps
|
||||
$(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: ;
|
||||
|
||||
@ -227,7 +224,7 @@ build/Makefile_swig_deps: ;
|
||||
# build process.
|
||||
.PHONY: convert_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
|
||||
.PHONY: S_define_exp
|
||||
|
@ -15,6 +15,7 @@ use Digest::MD5 qw(md5_hex) ;
|
||||
use File::Path qw(make_path) ;
|
||||
use html ;
|
||||
use get_paths ;
|
||||
use verbose_build ;
|
||||
|
||||
##
|
||||
## ================================================================================
|
||||
@ -353,7 +354,7 @@ sub process_file() {
|
||||
}
|
||||
close OUT ;
|
||||
|
||||
print "[34mWriting[0m $out_file\n" ;
|
||||
print "[34mWriting[0m $out_file\n" if not verbose_build() ;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ use Cwd ;
|
||||
use Cwd 'abs_path';
|
||||
use trick_version ;
|
||||
use get_lib_deps ;
|
||||
use verbose_build ;
|
||||
|
||||
my %processed_files ;
|
||||
my %non_lib_processed_files ;
|
||||
@ -57,7 +58,7 @@ sub read_lib_deps($@) {
|
||||
read_lib_deps($indent + 1 , @resolved_files) ;
|
||||
}
|
||||
}
|
||||
} elsif ( exists( $ENV{TRICK_VERBOSE_BUILD} ) or exists( $ENV{VERBOSE} ) ) {
|
||||
} elsif ( verbose_build() ) {
|
||||
print "[34mSkipping[0m Previously processed file \"$l\"\n" ;
|
||||
}
|
||||
}
|
||||
@ -214,7 +215,7 @@ print MAKEFILE
|
||||
#
|
||||
################################################################################
|
||||
|
||||
ifdef VERBOSE
|
||||
ifdef VERBOSE
|
||||
TRICK_VERBOSE_BUILD=1
|
||||
endif
|
||||
|
||||
@ -236,8 +237,7 @@ S_OBJECTS = build/S_source.o
|
||||
|
||||
build/S_source.o: build/S_source.cpp | build/S_source.d
|
||||
\t\$(PRINT_COMPILE)
|
||||
\t\@echo \$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -MMD -MP -c -o \$\@ \$\< >> \$(MAKE_OUT)
|
||||
\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -MMD -MP -c -o \$\@ \$\< 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}
|
||||
\t\$(call ECHO_AND_LOG,\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -MMD -MP -c -o \$\@ \$\<)
|
||||
|
||||
build/S_source.d: ;
|
||||
|
||||
@ -293,8 +293,7 @@ foreach my $extension ( keys %files_by_extension ) {
|
||||
|
||||
\${MODEL_OBJECTS$extension} : build/%.o : /%$extension | build/%.d \$\$(dir \$\$\@)
|
||||
\t\$(PRINT_COMPILE)
|
||||
\t\@echo $command >> \$(MAKE_OUT)
|
||||
\t\$(ECHO_CMD)$command 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}" ;
|
||||
\t\$(call ECHO_AND_LOG,$command)" ;
|
||||
}
|
||||
|
||||
print MAKEFILE "
|
||||
@ -324,8 +323,7 @@ all: \$(S_MAIN) S_sie.resource
|
||||
|
||||
\$(S_MAIN): S_source.hh \$(TRICK_STATIC_LIB) \$(S_OBJECTS) \$(MODEL_OBJECTS)
|
||||
\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\$(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]}
|
||||
\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))
|
||||
|
||||
# SIE ==========================================================================
|
||||
|
||||
@ -333,8 +331,7 @@ sie: S_sie.resource
|
||||
|
||||
S_sie.resource: \$(S_MAIN)
|
||||
\t\$(PRINT_SIE)
|
||||
\t\@echo ./\$(S_MAIN) sie
|
||||
\t\$(ECHO_CMD)./\$(S_MAIN) sie 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}\n" ;
|
||||
\t\$(call ECHO_AND_LOG,./\$(S_MAIN) sie)\n" ;
|
||||
|
||||
# write out the override files we have read in
|
||||
open MAKEFILEOVER, ">build/Makefile_overrides" or die "Could not open build/Makefile_overrides" ;
|
||||
|
@ -10,6 +10,7 @@ use gte ;
|
||||
use Digest::MD5 qw(md5_hex) ;
|
||||
use trick_version ;
|
||||
use html ;
|
||||
use verbose_build ;
|
||||
use strict ;
|
||||
|
||||
my @exclude_paths ;
|
||||
@ -18,7 +19,7 @@ my @ext_lib_paths ;
|
||||
my @files_to_process ;
|
||||
my @ext_lib_files ;
|
||||
my %md5s ;
|
||||
my $verbose_build = exists($ENV{'TRICK_VERBOSE_BUILD'}) ;
|
||||
my $verbose_build = verbose_build() ;
|
||||
my %trick_headers ;
|
||||
my %python_modules ;
|
||||
my %python_module_dirs ;
|
||||
@ -209,8 +210,7 @@ TRICK_FIXED_PYTHON = \\
|
||||
$swig_sim_dir/exception.py
|
||||
|
||||
\$(TRICK_FIXED_PYTHON): $swig_sim_dir/\% : \${TRICK_HOME}/share/trick/swig/\%
|
||||
\t\@echo /bin/cp -f \$< \$@ >> \$(MAKE_OUT)
|
||||
\t\$(ECHO_CMD)/bin/cp -f \$< \$@ 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}
|
||||
\t\$(call ECHO_AND_LOG,/bin/cp -f \$< \$@)
|
||||
|
||||
all: \$(TRICK_FIXED_PYTHON)
|
||||
|
||||
@ -244,16 +244,13 @@ SWIG_I_CUSTOM_OUTDIR =" ;
|
||||
|
||||
define create_convert_swig_rule
|
||||
build/%_py.i: /%.\$1
|
||||
\t\@echo \${TRICK_HOME}/\$(LIBEXEC)/trick/convert_swig \$\${TRICK_CONVERT_SWIG_FLAGS} \$\$< >> \$(MAKE_OUT)
|
||||
\t\$(ECHO_CMD)\${TRICK_HOME}/\$(LIBEXEC)/trick/convert_swig \$\${TRICK_CONVERT_SWIG_FLAGS} \$\$< 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}
|
||||
\t\$\$(call ECHO_AND_LOG,\${TRICK_HOME}/\$(LIBEXEC)/trick/convert_swig \$\${TRICK_CONVERT_SWIG_FLAGS} \$\$<)
|
||||
endef
|
||||
|
||||
EXTENSIONS := H h hh hxx h++ hpp
|
||||
\$(foreach EXTENSION,\$(EXTENSIONS),\$(eval \$(call create_convert_swig_rule,\$(EXTENSION))))
|
||||
\$(foreach EXTENSION,H h hh hxx h++ hpp,\$(eval \$(call create_convert_swig_rule,\$(EXTENSION))))
|
||||
|
||||
build/top.i: build/CP_instances
|
||||
\t\@echo \${TRICK_HOME}/\${LIBEXEC}/trick/create_top_dot_i >> \$(MAKE_OUT)
|
||||
\t\${ECHO_CMD}\${TRICK_HOME}/\${LIBEXEC}/trick/create_top_dot_i 2>&1 | \$(TEE) -a \$(MAKE_OUT) ; exit \$\${PIPESTATUS[0]}
|
||||
\t\$(call ECHO_AND_LOG,\${TRICK_HOME}/\${LIBEXEC}/trick/create_top_dot_i)
|
||||
|
||||
# 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)
|
||||
\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\$(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]}
|
||||
\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 \$@ \$<)
|
||||
|
||||
\$(SWIG_SRC:.cpp=.d): ;
|
||||
|
||||
@ -278,8 +274,7 @@ SWIG_SRC_CUSTOM_OUTDIR = \$(subst .i,.cpp,\$(SWIG_I_CUSTOM_OUTDIR))\n" ;
|
||||
print MAKEFILE "
|
||||
build$cpp_file : build$swig_file | build$dependency_file trick/$trick_headers{$file}{python_module_dir}
|
||||
\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\$(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]}
|
||||
\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 \$@ \$<)
|
||||
build$dependency_file: ;
|
||||
-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
|
||||
\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\$(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]}
|
||||
\t\$(call ECHO_AND_LOG,\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) \$(TRICK_SWIG_CFLAGS) \$(TRICK_SYSTEM_SWIG_CFLAGS) -Wno-unused-parameter -c -o \$@ \$<)
|
||||
|
||||
\$(S_MAIN): \$(SWIG_OBJECTS)
|
||||
|
||||
|
13
libexec/trick/pm/verbose_build.pm
Normal file
13
libexec/trick/pm/verbose_build.pm
Normal 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;
|
@ -1,22 +1,28 @@
|
||||
SHELL := /bin/bash
|
||||
CD := cd
|
||||
MV := /bin/mv
|
||||
RM := /bin/rm
|
||||
CP := /bin/cp
|
||||
PWD = $(shell /bin/pwd)
|
||||
SHELL := /bin/bash
|
||||
CD := cd
|
||||
MV := /bin/mv
|
||||
RM := /bin/rm
|
||||
CP := /bin/cp
|
||||
MAKE_OUT := build/MAKE_out
|
||||
|
||||
export TRICK_HOME := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))../../..)
|
||||
PWD = $(shell /bin/pwd)
|
||||
COLOR = [34m$(1)[0m
|
||||
|
||||
COLOR = [34m$(1)[0m
|
||||
|
||||
ifdef VERBOSE
|
||||
TRICK_VERBOSE_BUILD=1
|
||||
ifdef VERBOSE
|
||||
TRICK_VERBOSE_BUILD := 1
|
||||
endif
|
||||
|
||||
ifndef TRICK_VERBOSE_BUILD
|
||||
ECHO_CMD = @
|
||||
ifdef TRICK_VERBOSE_BUILD
|
||||
ECHO_TO_TERMINAL = @echo $1
|
||||
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_VERSION := $(shell $(TRICK_HOME)/bin/trick-version -v)
|
||||
export TRICK_MAJOR := $(shell $(TRICK_HOME)/bin/trick-version -y)
|
||||
|
@ -87,6 +87,7 @@
|
||||
#
|
||||
# For more information, see:
|
||||
# github.com/nasa/trick/wiki/Trickified-Project-Libraries
|
||||
|
||||
ifndef TRICKIFY_CXX_FLAGS
|
||||
$(error TRICKIFY_CXX_FLAGS must be set)
|
||||
endif
|
||||
@ -94,17 +95,16 @@ endif
|
||||
TRICKIFY_BUILD_TYPE ?= PLO
|
||||
TRICKIFY_OBJECT_NAME ?= trickified.o
|
||||
TRICKIFY_PYTHON_DIR ?= python
|
||||
TRICK_HOME := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/../../..)
|
||||
MAKE_OUT ?= build/MAKE_out
|
||||
include $(dir $(lastword $(MAKEFILE_LIST)))Makefile.common
|
||||
|
||||
ifneq ($(wildcard build),)
|
||||
SWIG_OBJECTS := $(shell cat build/S_library_swig)
|
||||
SWIG_OBJECTS := $(addprefix build,$(addsuffix _py.o,$(basename $(SWIG_OBJECTS))))
|
||||
IO_OBJECTS := $(shell find build -name "io_*.cpp")
|
||||
BUILD_DIR := $(dir $(MAKE_OUT))
|
||||
ifneq ($(wildcard $(BUILD_DIR)),)
|
||||
SWIG_OBJECTS := $(shell cat $(BUILD_DIR)S_library_swig)
|
||||
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)
|
||||
endif
|
||||
|
||||
include $(TRICK_HOME)/share/trick/makefiles/Makefile.common
|
||||
TRICK_CFLAGS += $(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))
|
||||
$(info $(call COLOR,Linking) $@)
|
||||
ifeq ($(TRICKIFY_BUILD_TYPE),PLO)
|
||||
@echo $(LD) $(LD_PARTIAL) -o $@ $^ >> $(MAKE_OUT)
|
||||
$(ECHO_CMD)ld -r -o $@ $^ 2>&1 | $(TEE) -a $(MAKE_OUT); exit $${PIPESTATUS[0]}
|
||||
$(call ECHO_AND_LOG,$(LD) $(LD_PARTIAL) -o $@ $^)
|
||||
else ifeq ($(TRICKIFY_BUILD_TYPE),SHARED)
|
||||
@echo $(TRICK_CPPC) -shared -o $@ $^ >> $(MAKE_OUT)
|
||||
$(ECHO_CMD)c++ -shared -o $@ $^ 2>&1 | $(TEE) -a $(MAKE_OUT); exit $${PIPESTATUS[0]}
|
||||
$(call ECHO_AND_LOG,$(TRICK_CPPC) -shared -o $@ $^)
|
||||
else ifeq ($(TRICKIFY_BUILD_TYPE),STATIC)
|
||||
@echo ar rcs $@ $^ >> $(MAKE_OUT)
|
||||
$(ECHO_CMD)ar rcs $@ $^ 2>&1 | $(TEE) -a $(MAKE_OUT); exit $${PIPESTATUS[0]}
|
||||
$(call ECHO_AND_LOG,ar rcs $@ $^)
|
||||
endif
|
||||
|
||||
$(dir $(TRICKIFY_OBJECT_NAME)) $(TRICKIFY_PYTHON_DIR) build:
|
||||
$(dir $(TRICKIFY_OBJECT_NAME)) $(TRICKIFY_PYTHON_DIR) $(BUILD_DIR):
|
||||
@mkdir -p $@
|
||||
|
||||
$(IO_OBJECTS): %.o: %.cpp
|
||||
$(info $(call COLOR,Compiling) $<)
|
||||
@echo $(TRICK_CPPC) $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) -std=c++11 -Wno-invalid-offsetof -MMD -MP -c -o $@ $< >> $(MAKE_OUT)
|
||||
$(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]}
|
||||
$(call ECHO_AND_LOG,$(TRICK_CPPC) $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) -std=c++11 -Wno-invalid-offsetof -MMD -MP -c -o $@ $<)
|
||||
|
||||
$(IO_OBJECTS:.o=.d): %.d: ;
|
||||
|
||||
@ -138,27 +134,22 @@ $(IO_OBJECTS:.o=.d): %.d: ;
|
||||
|
||||
$(SWIG_OBJECTS): %.o: %.cpp
|
||||
$(info $(call COLOR,Compiling) $<)
|
||||
@echo $(TRICK_CPPC) $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) $(PYTHON_INCLUDES) -Wno-unused-parameter -Wno-shadow -c -o $@ $< >> $(MAKE_OUT)
|
||||
$(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]}
|
||||
$(call ECHO_AND_LOG,$(TRICK_CPPC) $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) $(PYTHON_INCLUDES) -Wno-unused-parameter -Wno-shadow -c -o $@ $<)
|
||||
|
||||
$(SWIG_OBJECTS:.o=.cpp): %.cpp: %.i | %.d $(TRICKIFY_PYTHON_DIR) $(SWIG_OBJECTS:.o=.i)
|
||||
$(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)
|
||||
$(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]}
|
||||
$(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 $@ $<)
|
||||
|
||||
$(SWIG_OBJECTS:.o=.d): ;
|
||||
|
||||
-include $(SWIG_OBJECTS:.o=.d)
|
||||
|
||||
define create_convert_swig_rule
|
||||
build/%_py.i: /%.$1
|
||||
$$(info $$(call COLOR,Converting) $$<)
|
||||
@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]}
|
||||
$(BUILD_DIR)/%_py.i: /%.$1
|
||||
$$(call ECHO_AND_LOG,${TRICK_HOME}/$(LIBEXEC)/trick/convert_swig $${TRICK_CONVERT_SWIG_FLAGS} $$<)
|
||||
endef
|
||||
|
||||
EXTENSIONS := H h hh hxx h++ hpp
|
||||
$(foreach EXTENSION,$(EXTENSIONS),$(eval $(call create_convert_swig_rule,$(EXTENSION))))
|
||||
$(foreach EXTENSION,H h hh hxx h++ hpp,$(eval $(call create_convert_swig_rule,$(EXTENSION))))
|
||||
|
||||
# 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
|
||||
@ -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:
|
||||
# http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/
|
||||
|
||||
build/S_source.d: | $(dir $@)
|
||||
$(ECHO_CMD)$(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]}
|
||||
@echo $(TRICK_CC) -MM -MP -MT $@ -MF $@ $(TRICKIFY_CXX_FLAGS) S_source.hh >> $(MAKE_OUT)
|
||||
$(ECHO_CMD) $(TRICK_CC) -MM -MP -MT $@ -MF $@ $(TRICKIFY_CXX_FLAGS) S_source.hh 2>&1 | $(TEE) -a $(MAKE_OUT) ; exit $${PIPESTATUS[0]}
|
||||
$(BUILD_DIR)S_source.d: | $(BUILD_DIR)
|
||||
$(call ECHO_AND_LOG,$(TRICK_HOME)/bin/trick-ICG $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) $(TRICK_ICGFLAGS) S_source.hh)
|
||||
$(call ECHO_AND_LOG,$(TRICK_HOME)/$(LIBEXEC)/trick/make_makefile_swig)
|
||||
$(call ECHO_AND_LOG,$(TRICK_CC) -MM -MP -MT $@ -MF $@ $(TRICKIFY_CXX_FLAGS) S_source.hh)
|
||||
|
||||
-include build/S_source.d
|
||||
-include $(BUILD_DIR)S_source.d
|
||||
|
@ -377,8 +377,7 @@ void PrintAttributes::printIOMakefile() {
|
||||
<< std::endl
|
||||
<< "$(IO_OBJECTS): \%.o : \%.cpp | \%.d" << 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$(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
|
||||
<< "\t$(call ECHO_AND_LOG,$(TRICK_CPPC) $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) $(TRICK_IO_CXXFLAGS) -MMD -MP -c -o $@ $<)" << std::endl
|
||||
<< std::endl
|
||||
<< "$(IO_OBJECTS:.o=.d): ;" << std::endl
|
||||
<< std::endl
|
||||
|
Loading…
Reference in New Issue
Block a user