mirror of
https://github.com/nasa/trick.git
synced 2025-02-19 16:56:39 +00:00
Made everything about Trick's build process better
This commit is contained in:
parent
edbac4cc11
commit
f161ddb18c
@ -64,27 +64,29 @@ if ( $sim{args}{p} == 0 ) {
|
||||
#--------------------------------------------------------------
|
||||
# Parse the S_define file
|
||||
|
||||
trick_print($sim{fh}, "Parsing S_define..." , "title_cyan" , $sim{args}{v}) ;
|
||||
trick_print($sim{fh}, "Parsing " , "title_blue" , $sim{args}{v}) ;
|
||||
trick_print($sim{fh}, "S_define" , "title_white" , $sim{args}{v}) ;
|
||||
trick_print($sim{fh}, "\n" , "title_white" , $sim{args}{v}) if ( $sim{args}{v} != 1 ) ;
|
||||
|
||||
parse_s_define(\%sim) ;
|
||||
|
||||
trick_print( $sim{fh}, "\nCompleted parsing S_define\n\n" , "normal_green" , $ sim{args}{v} ) ;
|
||||
trick_print( $sim{fh}, "Finished " , "normal_blue" , $ sim{args}{v} ) ;
|
||||
trick_print( $sim{fh}, "S_define\n" , "normal_white" , $ sim{args}{v} ) ;
|
||||
|
||||
#--------------------------------------------------------------
|
||||
# Make S_source.c
|
||||
# Make S_source.c
|
||||
|
||||
trick_print($sim{fh}, "Creating S_source.c...", "title_cyan", $sim{args}{v});
|
||||
trick_print($sim{fh}, "Writing ", "title_blue", $sim{args}{v});
|
||||
trick_print($sim{fh}, "S_source.c\n", "title_white", $sim{args}{v});
|
||||
s_source( \%sim ) ;
|
||||
trick_print($sim{fh}, " Complete\n", "title_green", $sim{args}{v}) ;
|
||||
|
||||
#--------------------------------------------------------------
|
||||
# Make Default Data
|
||||
|
||||
chdir ($cwd) ;
|
||||
trick_print($sim{fh}, "Creating Default_data...", "title_cyan" , $sim{args}{v}) ;
|
||||
trick_print($sim{fh}, "Writing ", "title_blue" , $sim{args}{v}) ;
|
||||
trick_print($sim{fh}, "Default_data\n", "title_white" , $sim{args}{v}) ;
|
||||
make_default_data( \%sim ) ;
|
||||
trick_print($sim{fh}, " Complete\n", "title_green", $sim{args}{v}) ;
|
||||
|
||||
close OUTFILE ;
|
||||
|
||||
|
@ -360,7 +360,7 @@ sub process_file() {
|
||||
}
|
||||
close OUT ;
|
||||
|
||||
print "Writing swig_file $out_file\n" ;
|
||||
print "[34mWriting[0m $out_file\n" ;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,458 +0,0 @@
|
||||
#! /usr/bin/perl
|
||||
|
||||
################################################################################
|
||||
# Program: make_build
|
||||
#
|
||||
# This program constructs Makefiles for model directories in
|
||||
# <include_path>/<model_dir>.
|
||||
#
|
||||
# Command Syntax: make_build
|
||||
#
|
||||
#*******************************************************************
|
||||
|
||||
use lib $ENV{"TRICK_HOME"} . "/bin/pm" ;
|
||||
use Cwd ;
|
||||
use File::Basename ;
|
||||
use trick_version ;
|
||||
|
||||
###############################################################################
|
||||
# Process command line options
|
||||
###############################################################################
|
||||
|
||||
$lib_file = "";
|
||||
|
||||
# Check calling args.
|
||||
if ( @ARGV[0] ne "") {
|
||||
if ( @ARGV[0] eq "lib" and @ARGV[1] ne "" ) {
|
||||
$lib_file = @ARGV[1];
|
||||
if ( $lib_file !~ /\.a$/ ) {
|
||||
print "USAGE: make_build lib lib_file_name.a\n";
|
||||
exit;
|
||||
}
|
||||
$lib_file =~ s/lib.*?\/// ;
|
||||
$lib_file = "lib_\${TRICK_HOST_CPU}/$lib_file";
|
||||
}
|
||||
elsif ( @ARGV[0] eq "sharedlib" and @ARGV[1] ne "" ) {
|
||||
$sharedlib_file = @ARGV[1];
|
||||
if ( $sharedlib_file !~ /\.so$/ ) {
|
||||
print "USAGE: make_build sharedlib lib_file_name.so\n";
|
||||
exit;
|
||||
}
|
||||
$sharedlib_file =~ s/lib.*?\/// ;
|
||||
$sharedlib_file = "lib_\${TRICK_HOST_CPU}/$sharedlib_file";
|
||||
$lib_file = $sharedlib_file ;
|
||||
$lib_file =~ s/\.so/\.a/ ;
|
||||
}
|
||||
else {
|
||||
print "USAGE: make_build [lib <lib_file_name>]\n";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
# Get the full path of the current working directory
|
||||
$wd = cwd();
|
||||
if ($ENV{TRICK_HOME} eq "") {
|
||||
print "TRICK_HOME is not set... cannot continue\n" ;
|
||||
exit (1)
|
||||
}
|
||||
|
||||
# If this is a /src, /include, /xml, /io_src, /catalog, or /object_*
|
||||
# directory, then start make_build in the ../ directory.
|
||||
if ( $wd =~ /\/include/ and $wd !~ /\/sim_services\// ) {
|
||||
|
||||
$wd = dirname($wd);
|
||||
|
||||
} elsif ( $wd =~ /\/src/ or $wd =~ /\/xml/ or $wd =~ /\/io_src/
|
||||
or $wd =~ /\/catalog/ or $wd =~ /\/object_/ ) {
|
||||
|
||||
$wd = dirname($wd);
|
||||
}
|
||||
|
||||
# Let user know what's going on.
|
||||
print "[36mProcessing $wd[00m\n";
|
||||
print "Building Makefile...\n";
|
||||
|
||||
# Open the file "Makefile"
|
||||
my ($all_lines) = do { local $/; <main::DATA> };
|
||||
open MAKEFILE , ">Makefile";
|
||||
|
||||
$date = `date` ;
|
||||
chomp $date ;
|
||||
|
||||
my ($trick_ver, $trick_thread) = get_trick_version() ;
|
||||
my ($trick_major , $trick_minor ) ;
|
||||
($trick_major , $trick_minor ) = $trick_ver =~ /(\d+)\.([^\.]+)/ ;
|
||||
|
||||
#$trick_ver = `trick_version -f` ;
|
||||
#chomp $trick_ver ;
|
||||
|
||||
$all_lines =~ s/DATE/$date/ ;
|
||||
$all_lines =~ s/REPLACE_TRICK_MAJOR/$trick_major/g ;
|
||||
$all_lines =~ s/REPLACE_TRICK_MINOR/$trick_minor/g ;
|
||||
$all_lines =~ s/REPLACE_TRICK_THREAD/$trick_thread/g ;
|
||||
$all_lines =~ s/LIB_FILE/$lib_file/ ;
|
||||
$all_lines =~ s/SHARED_LIB_FILE/$sharedlib_file/ ;
|
||||
print MAKEFILE $all_lines ;
|
||||
|
||||
close MAKEFILE ;
|
||||
|
||||
# If this directory has a '/src' directory, create a Makefile for
|
||||
# /src as well.
|
||||
if ( -e "$wd/src" ) {
|
||||
|
||||
# Open the file "src/Makefile"
|
||||
open MAKEFILE , ">src/Makefile";
|
||||
|
||||
print MAKEFILE "# Go up to parent directory and run make from there\
|
||||
default:\
|
||||
\tcd .. ; make\
|
||||
ICG:\
|
||||
\tcd .. ; make ICG\
|
||||
depend:\
|
||||
\tcd .. ; make depend\
|
||||
io_clean:\
|
||||
\tcd .. ; make io_clean\
|
||||
catalog_clean:\
|
||||
\tcd .. ; make catalog_clean\
|
||||
clean:\
|
||||
\tcd .. ; make clean\
|
||||
real_clean:\
|
||||
\tcd .. ; make real_clean" ;
|
||||
|
||||
close MAKEFILE ;
|
||||
|
||||
}
|
||||
|
||||
print "Adding file dependencies in Makefile...\n" ;
|
||||
system "make depend";
|
||||
print "[32mmake_build complete[00m\n" ;
|
||||
|
||||
__END__
|
||||
#############################################################################
|
||||
#
|
||||
# This make file was automatically generated by:
|
||||
#
|
||||
# /user2/lin/trick_dev/03/bin/make_build
|
||||
#
|
||||
# Trick ver: REPLACE_TRICK_MAJOR.REPLACE_TRICK_MINOR-REPLACE_TRICK_THREAD
|
||||
#
|
||||
# Date: DATE
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# To get a desription of the arguments accepted by this makefile,
|
||||
# type 'make help'
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
|
||||
#############################################################################
|
||||
## DIRECTORY DEFINITIONS ##
|
||||
#############################################################################
|
||||
|
||||
ifeq ($(wildcard src),src)
|
||||
SRC_DIR := src/
|
||||
CD_CMD := cd src ;
|
||||
UP_DIR := ../
|
||||
else
|
||||
SRC_DIR :=
|
||||
CD_CMD :=
|
||||
UP_DIR :=
|
||||
endif
|
||||
|
||||
PWD = $(shell pwd)
|
||||
|
||||
IO_SRC_DIR = io_src/
|
||||
OBJ_DIR = lib_${TRICK_HOST_CPU}
|
||||
LIB = LIB_FILE
|
||||
SHARED_LIB = SHARED_LIB_FILE
|
||||
|
||||
ifndef TRICK_CC
|
||||
TRICK_CC = cc
|
||||
endif
|
||||
|
||||
ifndef TRICK_CPPC
|
||||
TRICK_CPPC = c++
|
||||
endif
|
||||
|
||||
ifndef TRICK_FC
|
||||
TRICK_FC = f90
|
||||
endif
|
||||
|
||||
TRICK_CFLAGS += -I${TRICK_HOME}/trick_source -I../include -fPIC
|
||||
ifdef TRICK_CXXFLAGS
|
||||
TRICK_CXXFLAGS += -DTRICK_VER=REPLACE_TRICK_MAJOR -DTRICK_MINOR=REPLACE_TRICK_MINOR -I${TRICK_HOME}/trick_source -I../include -fPIC
|
||||
else
|
||||
TRICK_CXXFLAGS = ${TRICK_CFLAGS} -DTRICK_VER=REPLACE_TRICK_MAJOR -DTRICK_MINOR=REPLACE_TRICK_MINOR -I${TRICK_HOME}/trick_source -I../include -fPIC
|
||||
endif
|
||||
TRICK_FTNFLAGS += -I${TRICK_HOME}/trick_source -I../include
|
||||
|
||||
ifeq ($(TRICK_HOST_TYPE), Linux)
|
||||
MAKEDEP_CPP_INC = -Iinclude -I/usr/include/g++-3
|
||||
TRICK_CFLAGS += -I/usr/X11R6/include
|
||||
endif
|
||||
|
||||
ifeq ($(TRICK_HOST_TYPE), QNX)
|
||||
MAKEDEP_CPP_INC = -Iinclude
|
||||
TRICK_EXEC_LINK_LIBS += -lm -lsocket
|
||||
endif
|
||||
|
||||
ifeq ($(TRICK_HOST_TYPE), LynxOS)
|
||||
TRICK_CFLAGS += -mthreads
|
||||
TRICK_CXXFLAGS += -mthreads
|
||||
endif
|
||||
|
||||
ifeq ($(TRICK_HOST_TYPE), Darwin)
|
||||
MAKEDEP_CPP_INC = -Iinclude -I/usr/include/gcc/darwin/3.1/g++-v3 \
|
||||
-I/usr/include/gcc/darwin/3.1/g++-v3/ppc-darwin \
|
||||
-I/usr/include/gcc/darwin/default/g++-v3/backward \
|
||||
-I/usr/include/gcc/darwin/3.1
|
||||
TRICK_RANLIB = /usr/bin/ranlib
|
||||
TRICK_CFLAGS += -I/usr/X11R6/include -I/usr/local/include
|
||||
endif
|
||||
|
||||
ifeq ($(TRICK_HOST_TYPE), SunOS_5.6_plus)
|
||||
# These are specific to our gcc 2.95 installation in /opt/sfw
|
||||
MAKEDEP_CPP_INC = -Iinclude -I/opt/sfw/include/g++-3 \
|
||||
-I/opt/sfw/sparc-sun-solaris2.8/include \
|
||||
-I/opt/sfw/lib/gcc-lib/sparc-sun-solaris2.8/2.95.3/include
|
||||
endif
|
||||
|
||||
ifeq ($(TRICK_HOST_TYPE), IRIX_6.x)
|
||||
MAKEDEP_CPP_INC = -Iinclude -I/usr/include/CC
|
||||
endif
|
||||
|
||||
ifeq ($(TRICK_HOST_TYPE), Interix)
|
||||
TRICK_CFLAGS += -D_ALL_SOURCE
|
||||
TRICK_CXXFLAGS += -D_ALL_SOURCE
|
||||
TRICK_EXEC_LINK_LIBS += -lm
|
||||
endif
|
||||
|
||||
|
||||
#############################################################################
|
||||
## UTILITY DEFINITIONS ##
|
||||
#############################################################################
|
||||
SHELL = /bin/sh
|
||||
AWK = awk
|
||||
SED = sed
|
||||
LEX = /usr/bin/flex
|
||||
YACC = /usr/bin/bison
|
||||
PERL = /usr/bin/perl
|
||||
CD = cd
|
||||
MV = mv
|
||||
RM = rm
|
||||
|
||||
#
|
||||
# Make information
|
||||
#
|
||||
MAKEFILE = $(PWD)/Makefile
|
||||
DEPFILE = $(PWD)/Makefile_deps
|
||||
DEPTEMPFILE = Makefile_temp_depends
|
||||
|
||||
#############################################################################
|
||||
## FILE NAME DEFINITIONS ##
|
||||
#############################################################################
|
||||
|
||||
L_SRC = $(wildcard $(SRC_DIR)*.l)
|
||||
L_OUT = $(subst .l,.clex,$(L_SRC))
|
||||
|
||||
Y_SRC = $(wildcard $(SRC_DIR)*.y)
|
||||
Y_OUT = $(subst .y,.c,$(Y_SRC))
|
||||
Y_OBJS = $(addprefix $(OBJ_DIR)/,$(notdir $(subst .y,.o,$(Y_SRC))))
|
||||
|
||||
C_SRC = $(wildcard $(SRC_DIR)*.c)
|
||||
C_OBJS = $(filter-out $(Y_OBJS), $(addprefix $(OBJ_DIR)/,$(notdir $(subst .c,.o,$(C_SRC)))))
|
||||
|
||||
CPP_C_SRC = $(wildcard $(SRC_DIR)*.C)
|
||||
CPP_CC_SRC = $(wildcard $(SRC_DIR)*.cc)
|
||||
CPP_CPP_SRC = $(wildcard $(SRC_DIR)*.cpp)
|
||||
CPP_CXX_SRC = $(wildcard $(SRC_DIR)*.cxx)
|
||||
CPP_CPLUS_SRC = $(wildcard $(SRC_DIR)*.c++)
|
||||
CPP_SRC = $(CPP_C_SRC) $(CPP_CC_SRC) $(CPP_CPP_SRC) $(CPP_CXX_SRC) $(CPP_CPLUS_SRC)
|
||||
CPP_C_OBJS = $(addprefix $(OBJ_DIR)/,$(notdir $(subst .C,.o,$(CPP_C_SRC))))
|
||||
CPP_CC_OBJS = $(addprefix $(OBJ_DIR)/,$(notdir $(subst .cc,.o,$(CPP_CC_SRC))))
|
||||
CPP_CPP_OBJS = $(addprefix $(OBJ_DIR)/,$(notdir $(subst .cpp,.o,$(CPP_CPP_SRC))))
|
||||
CPP_CXX_OBJS = $(addprefix $(OBJ_DIR)/,$(notdir $(subst .cxx,.o,$(CPP_CXX_SRC))))
|
||||
CPP_CPLUS_OBJS = $(addprefix $(OBJ_DIR)/,$(notdir $(subst .c++,.o,$(CPP_CPLUS_SRC))))
|
||||
CPP_OBJS = $(CPP_C_OBJS) $(CPP_CC_OBJS) $(CPP_CPP_OBJS) $(CPP_CXX_OBJS) $(CPP_CPLUS_OBJS)
|
||||
|
||||
F_SRC = $(wildcard $(SRC_DIR)*.f)
|
||||
F_OBJS = $(addprefix $(OBJ_DIR)/,$(notdir $(subst .f,.o,$(F_SRC))))
|
||||
|
||||
IO_C_SRC = $(wildcard $(IO_SRC_DIR)*.c)
|
||||
IO_C_OBJS =$(subst io_src,$(OBJ_DIR),$(subst .c,.o,$(IO_C_SRC)))
|
||||
|
||||
IO_CPP_SRC = $(wildcard $(IO_SRC_DIR)*.cpp)
|
||||
IO_CPP_OBJS =$(subst io_src,$(OBJ_DIR),$(subst .cpp,.o,$(IO_CPP_SRC)))
|
||||
|
||||
IO_SRC = $(IO_C_SRC) $(IO_CPP_SRC)
|
||||
IO_OBJS = $(IO_C_OBJS) $(IO_CPP_OBJS)
|
||||
|
||||
OBJECT_FILES = $(IO_OBJS) $(Y_OBJS) $(C_OBJS) $(CPP_OBJS) $(F_OBJS)
|
||||
|
||||
#############################################################################
|
||||
## MODEL TARGETS ##
|
||||
#############################################################################
|
||||
|
||||
ifneq ($(LIB),"")
|
||||
default: objects $(LIB) $(SHARED_LIB)
|
||||
else
|
||||
default: objects
|
||||
endif
|
||||
|
||||
trick: objects
|
||||
|
||||
object_dir: $(OBJ_DIR)
|
||||
|
||||
objects: y_objects c_objects cpp_objects f_objects h_objects
|
||||
@ echo "[32m$(CURDIR) object files up to date[00m"
|
||||
|
||||
c_objects: $(OBJ_DIR) $(C_OBJS)
|
||||
|
||||
cpp_objects: $(OBJ_DIR) $(CPP_OBJS)
|
||||
|
||||
f_objects: $(OBJ_DIR) $(F_OBJS)
|
||||
|
||||
h_objects: $(OBJ_DIR) $(IO_OBJS)
|
||||
|
||||
y_objects: $(OBJ_DIR) $(L_OUT) $(Y_OUT) $(Y_OBJS)
|
||||
|
||||
$(LIB) : $(OBJECT_FILES)
|
||||
ar cr $(LIB) $?
|
||||
@ if [ "${TRICK_RANLIB}" != "" ] ; then \
|
||||
echo ${TRICK_RANLIB} $(LIB) ; \
|
||||
${TRICK_RANLIB} $(LIB) ; \
|
||||
fi
|
||||
|
||||
$(SHARED_LIB) : $(OBJECT_FILES)
|
||||
gcc -shared -o $(SHARED_LIB) $(OBJECT_FILES)
|
||||
|
||||
$(OBJ_DIR):
|
||||
@ mkdir -p $(OBJ_DIR)
|
||||
@ echo "Created $(OBJ_DIR)"
|
||||
|
||||
#
|
||||
# IO_OBJS
|
||||
#
|
||||
|
||||
$(IO_C_OBJS): $(OBJ_DIR)/%.o : $(IO_SRC_DIR)%.c
|
||||
$(TRICK_CC) $(TRICK_CFLAGS) -c $< -o $@
|
||||
|
||||
$(IO_CPP_OBJS): $(OBJ_DIR)/%.o : $(IO_SRC_DIR)%.cpp
|
||||
$(TRICK_CPPC) $(TRICK_CXXFLAGS) -c $< -o $@
|
||||
|
||||
#
|
||||
#
|
||||
# C_OBJS
|
||||
#
|
||||
|
||||
$(C_OBJS): $(OBJ_DIR)/%.o : $(SRC_DIR)%.c
|
||||
$(CD_CMD) $(TRICK_CC) $(TRICK_CFLAGS) -c ${<F} -o $(UP_DIR)$@
|
||||
|
||||
#
|
||||
# CPP_OBJS
|
||||
#
|
||||
|
||||
$(CPP_C_OBJS): $(OBJ_DIR)/%.o : $(SRC_DIR)%.C
|
||||
$(CD_CMD) $(TRICK_CPPC) $(TRICK_CFLAGS) -c ${<F} -o $(UP_DIR)$@
|
||||
|
||||
$(CPP_CC_OBJS): $(OBJ_DIR)/%.o : $(SRC_DIR)%.cc
|
||||
$(CD_CMD) $(TRICK_CPPC) $(TRICK_CXXFLAGS) -c ${<F} -o $(UP_DIR)$@
|
||||
|
||||
$(CPP_CPP_OBJS): $(OBJ_DIR)/%.o : $(SRC_DIR)%.cpp
|
||||
$(CD_CMD) $(TRICK_CPPC) $(TRICK_CXXFLAGS) -c ${<F} -o $(UP_DIR)$@
|
||||
|
||||
$(CPP_CXX_OBJS): $(OBJ_DIR)/%.o : $(SRC_DIR)%.cxx
|
||||
$(CD_CMD) $(TRICK_CPPC) $(TRICK_CXXFLAGS) -c ${<F} -o $(UP_DIR)$@
|
||||
|
||||
$(CPP_CPLUS_OBJS): $(OBJ_DIR)/%.o : $(SRC_DIR)%.c++
|
||||
$(CD_CMD) $(TRICK_CPPC) $(TRICK_CXXFLAGS) -c ${<F} -o $(UP_DIR)$@
|
||||
|
||||
#
|
||||
# LEX/YACC SOURCE
|
||||
#
|
||||
|
||||
$(L_OUT) : $(SRC_DIR)%.clex : $(SRC_DIR)%.l
|
||||
$(CD_CMD) $(LEX) -o${@F} ${<F}
|
||||
|
||||
$(Y_OUT) : $(SRC_DIR)%.c : $(SRC_DIR)%.y
|
||||
$(CD_CMD) $(YACC) -o${@F} ${<F}
|
||||
|
||||
$(Y_OBJS) : $(OBJ_DIR)/%.o : $(SRC_DIR)%.c $(SRC_DIR)%.clex
|
||||
$(CD_CMD) $(TRICK_CC) $(TRICK_CFLAGS) -c ${<F} -o $(UP_DIR)$@
|
||||
|
||||
#
|
||||
#
|
||||
# F_OBJS
|
||||
#
|
||||
|
||||
$(F_OBJS): $(OBJ_DIR)/%.o : $(SRC_DIR)%.f
|
||||
$(CD_CMD) $(TRICK_FC) $(FTN_PRE_DEFS) $(TRICK_FTNFLAGS) $(FTN_POST_DEFS) -c ${<F} -o $(UP_DIR)$@
|
||||
|
||||
#
|
||||
# ICG Target
|
||||
#
|
||||
|
||||
ICG: io_clean $(OBJ_DIR) $(IO_OBJS)
|
||||
@ echo "IO files are up to date!"
|
||||
|
||||
#############################################################################
|
||||
## MAINTENANCE TARGETS ##
|
||||
#############################################################################
|
||||
|
||||
depend:
|
||||
@ $(TRICK_CC) -MM $(TRICK_CXXFLAGS) $(MAKEDEP_CPP_INC) $(C_SRC) >> $(DEPTEMPFILE)
|
||||
@ $(PERL) ${TRICK_HOME}/bin/depend_cp $(DEPTEMPFILE) > $(DEPFILE)
|
||||
@ $(RM) $(DEPTEMPFILE)
|
||||
@ echo "Created dependency file $(DEPFILE)"
|
||||
|
||||
io_clean:
|
||||
$(RM) -rf io_src
|
||||
|
||||
real_clean: clean io_clean catalog_clean
|
||||
$(RM) -rf xml *~ *.bak core
|
||||
@ echo "Directory is really clean!"
|
||||
|
||||
clean:
|
||||
ifeq ($(notdir $(LIB)),libtrick.a)
|
||||
$(RM) -rf $(OBJ_DIR) $(L_OUT) $(Y_OUT)
|
||||
else
|
||||
$(RM) -rf $(LIB) $(OBJ_DIR) $(L_OUT) $(Y_OUT)
|
||||
endif
|
||||
@ echo "Object files successfully removed"
|
||||
|
||||
catalog_clean :
|
||||
@ echo y | catalog -dp $(CURDIR)
|
||||
@ echo "Catalog purged"
|
||||
|
||||
catalog : catalog_clean $(IO_SRC)
|
||||
MIS
|
||||
@ echo "$(CURDIR) Catalog rebuilt"
|
||||
|
||||
help :
|
||||
@ echo -e "\n\
|
||||
Source Directory Make Options:\n\
|
||||
make - Compiles are source files\n\
|
||||
\n\
|
||||
make ICG - Deletes the io_src directory and runs ICG\n\
|
||||
on all pertinent *.h files\n\
|
||||
\n\
|
||||
make catalog - Deletes the local catalog and builds a new one\n\
|
||||
\n\
|
||||
make depend - Adds file dependencies to Makefile\n\
|
||||
\n\
|
||||
make io_clean - Deletes the local io_src directory\n\
|
||||
\n\
|
||||
make catalog_clean - Deletes the local catalog directory\n\
|
||||
\n\
|
||||
make clean - Deletes the object code directory\n\
|
||||
\n\
|
||||
make real_clean - Deletes xml/, io_src/,\n\
|
||||
and lib_${TRICK_HOST_CPU}/ directories\n"
|
||||
|
||||
ifeq ($(wildcard makefile_overrides),makefile_overrides)
|
||||
include makefile_overrides
|
||||
endif
|
||||
|
||||
-include Makefile_deps
|
||||
|
@ -31,7 +31,7 @@ sub read_lib_deps($@) {
|
||||
chomp @all_lines ;
|
||||
read_lib_deps($indent + 1 , @all_lines) ;
|
||||
} else {
|
||||
print "Getting Dependencies for " , " " x $indent, "$l\n" ;
|
||||
print "[34mTracing[0m " , " " x $indent, "$l\n" ;
|
||||
if ( -e $l ) {
|
||||
my $deps_changed ;
|
||||
my @resolved_files ;
|
||||
@ -41,7 +41,7 @@ sub read_lib_deps($@) {
|
||||
}
|
||||
}
|
||||
} elsif ( exists $ENV{TRICK_VERBOSE_BUILD} ) {
|
||||
print "Previously processed " , " " x $indent, "$l\n" ;
|
||||
print "[34mSkipping[0m Previously processed file \"$l\"\n" ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -213,52 +213,45 @@ chomp $trick_ver ;
|
||||
|
||||
open MAKEFILE , ">build/Makefile_src" or return ;
|
||||
|
||||
print MAKEFILE "\
|
||||
#############################################################################
|
||||
print MAKEFILE
|
||||
"################################################################################
|
||||
# Makefile:
|
||||
# This is a makefile for maintaining the
|
||||
# '$wd'
|
||||
# simulation directory. This make file was automatically generated by trick-CP
|
||||
# simulation directory. This makefile was automatically generated by trick-CP
|
||||
#
|
||||
#############################################################################
|
||||
################################################################################
|
||||
# Creation:
|
||||
# Author: Trick Configuration Processor - trick-CP Version $trick_ver
|
||||
# Date: $dt
|
||||
#
|
||||
#############################################################################
|
||||
################################################################################
|
||||
|
||||
include \${TRICK_HOME}/share/trick/makefiles/Makefile.common
|
||||
|
||||
S_MAIN = \$(CURDIR)/S_main_\${TRICK_HOST_CPU}.exe
|
||||
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 = \$(CURDIR)/T_main_\${TRICK_HOST_CPU}.exe
|
||||
TRICK_HOST_CPU := \$(shell \$(TRICK_HOME)/bin/trick-gte TRICK_HOST_CPU)_test
|
||||
S_MAIN = T_main_\${TRICK_HOST_CPU}.exe
|
||||
endif
|
||||
|
||||
LIB_DIR = \$(CURDIR)/build/lib
|
||||
LIB_DIR = build/lib
|
||||
|
||||
ifdef TRICK_VERBOSE_BUILD
|
||||
PRINT_COMPILE =
|
||||
PRINT_INC_LINK =
|
||||
PRINT_EXE_LINK =
|
||||
PRINT_S_DEF_DEPS =
|
||||
ECHO_CMD =
|
||||
else
|
||||
PRINT_COMPILE = \@echo \"[34mCompiling [0m \$(subst \$(CURDIR)/build,build,\$<)\"
|
||||
PRINT_INC_LINK = \@echo \"[34mPartial link[0m \$(subst \$(CURDIR)/build,build,\${<D})\"
|
||||
PRINT_EXE_LINK = \@echo \"[34mFinal link [0m \$(subst \$(CURDIR)/,,\$(S_MAIN))\"
|
||||
PRINT_S_DEF_DEPS = \@echo \"[34mGet depends [0m S_define\"
|
||||
ECHO_CMD = \@
|
||||
ifeq (\$(MAKECMDGOALS), all)
|
||||
\$(info [34mPerforming build with these compilation flags[0m)
|
||||
\$(info [33mTRICK_CFLAGS = \$(TRICK_CFLAGS)[0m)
|
||||
\$(info [33mTRICK_CXXFLAGS = \$(TRICK_CXXFLAGS)[0m)
|
||||
endif
|
||||
ifndef TRICK_VERBOSE_BUILD
|
||||
PRINT_COMPILE = \$(info \$(call COLOR,Compiling) \$<)
|
||||
PRINT_INC_LINK = \$(info \$(call COLOR,Linking) Contents of \$(dir \$<))
|
||||
PRINT_EXE_LINK = \$(info \$(call COLOR,Linking) \$(S_MAIN))
|
||||
PRINT_S_DEF_DEPS = \$(info \$(call COLOR,Tracing) S_define)
|
||||
ifeq (\$(MAKECMDGOALS), all)
|
||||
\$(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
|
||||
|
||||
S_OBJECT_FILES = \$(CURDIR)/build/S_source.o
|
||||
S_OBJECT_FILES = build/S_source.o
|
||||
|
||||
\$(S_OBJECT_FILES) : | \$(LIB_DIR)\n\n" ;
|
||||
\$(S_OBJECT_FILES): | \$(LIB_DIR)\n\n" ;
|
||||
|
||||
my %object_files_by_type ;
|
||||
my %model_build_dirs ;
|
||||
@ -275,34 +268,34 @@ foreach $k ( sort keys %files_by_dir ) {
|
||||
if ( scalar @{$files_by_dir{$k}{$ext}} ne 0 ) {
|
||||
print MAKEFILE "MODEL_${print_ext}_OBJ_$files_by_dir{$k}{dir_num} =" ;
|
||||
foreach $f ( @{$files_by_dir{$k}{$ext}} ) {
|
||||
print MAKEFILE " \\\n \$(CURDIR)/build$k/$files_by_dir{$k}{src_dir}$f" . "o" ;
|
||||
print MAKEFILE " \\\n build$k/$files_by_dir{$k}{src_dir}$f" . "o" ;
|
||||
}
|
||||
push @{$object_files_by_type{$ext}}, "MODEL_${print_ext}_OBJ_$files_by_dir{$k}{dir_num}" ;
|
||||
|
||||
print MAKEFILE "\n\n\$(MODEL_${print_ext}_OBJ_$files_by_dir{$k}{dir_num}) : | \$(CURDIR)/build$k/$files_by_dir{$k}{src_dir}\n" ;
|
||||
print MAKEFILE "\n\n\$(MODEL_${print_ext}_OBJ_$files_by_dir{$k}{dir_num}): | build$k/$files_by_dir{$k}{src_dir}\n" ;
|
||||
if ( ! exists $model_build_dirs{"build$k/$files_by_dir{$k}{src_dir}"}) {
|
||||
$model_build_dirs{"build$k/$files_by_dir{$k}{src_dir}"} = 1 ;
|
||||
print MAKEFILE "\$(CURDIR)/build$k/$files_by_dir{$k}{src_dir} :\n" ;
|
||||
print MAKEFILE "\t@ mkdir -p \$\@\n\n" ;
|
||||
print MAKEFILE "\nbuild$k/$files_by_dir{$k}{src_dir}:\n" ;
|
||||
print MAKEFILE "\t\@mkdir -p \$\@\n\n" ;
|
||||
}
|
||||
|
||||
print MAKEFILE "\$(CURDIR)/build/lib/o_${print_ext}_$files_by_dir{$k}{dir_num}.o : \$(MODEL_${print_ext}_OBJ_$files_by_dir{$k}{dir_num})\n" ;
|
||||
print MAKEFILE "build/lib/o_${print_ext}_$files_by_dir{$k}{dir_num}.o: \$(MODEL_${print_ext}_OBJ_$files_by_dir{$k}{dir_num})\n" ;
|
||||
print MAKEFILE "\t\$(PRINT_INC_LINK)\n" ;
|
||||
print MAKEFILE "\t\$(ECHO_CMD)cd \${<D} ; \$(LD) \$(LD_PARTIAL) -o \$\@ \$(notdir \$^)\n\n" ;
|
||||
print MAKEFILE "\t\$(ECHO_CMD)\$(LD) \$(LD_PARTIAL) -o \$\@ \$^\n\n" ;
|
||||
$num_inc_objs++ ;
|
||||
}
|
||||
}
|
||||
if ( scalar @{$files_by_dir{$k}{l}} ne 0 ) {
|
||||
print MAKEFILE "MODEL_clex_SRC_$files_by_dir{$k}{dir_num} =" ;
|
||||
foreach $f ( @{$files_by_dir{$k}{l}} ) {
|
||||
print MAKEFILE " \\\n \$(CURDIR)/build$k/$files_by_dir{$k}{src_dir}$f" . "clex" ;
|
||||
print MAKEFILE " \\\n build$k/$files_by_dir{$k}{src_dir}$f" . "clex" ;
|
||||
}
|
||||
print MAKEFILE "\n\n" ;
|
||||
}
|
||||
if ( scalar @{$files_by_dir{$k}{y}} ne 0 ) {
|
||||
print MAKEFILE "MODEL_y_c_SRC_$files_by_dir{$k}{dir_num} =" ;
|
||||
foreach $f ( @{$files_by_dir{$k}{y}} ) {
|
||||
print MAKEFILE " \\\n \$(CURDIR)/build$k/$files_by_dir{$k}{src_dir}$f" . "y.c" ;
|
||||
print MAKEFILE " \\\n build$k/$files_by_dir{$k}{src_dir}$f" . "y.c" ;
|
||||
}
|
||||
print MAKEFILE "\n\n" ;
|
||||
}
|
||||
@ -317,55 +310,56 @@ foreach my $ext ( sort keys %object_files_by_type ) {
|
||||
}
|
||||
print MAKEFILE "MODEL_${print_ext}_OBJ =" ;
|
||||
foreach $f ( @{$object_files_by_type{$print_ext}} ) {
|
||||
print MAKEFILE " \\\n \$($f)" ;
|
||||
print MAKEFILE " \\\n \$($f)" ;
|
||||
}
|
||||
print MAKEFILE "\n\n" ;
|
||||
}
|
||||
|
||||
# Write out the compile rules for each type of file.
|
||||
print MAKEFILE "\${MODEL_c_OBJ} : \$(CURDIR)/build\%.o : \%.c\n" ;
|
||||
print MAKEFILE "\t\$(PRINT_COMPILE)\n" ;
|
||||
print MAKEFILE "\t\$(ECHO_CMD)\$(TRICK_CC) \$(TRICK_CFLAGS) \$(TRICK_SYSTEM_CFLAGS) -I\${<D} -I\${<D}/../include -MMD -MP -c \$< -o \$\@\n\n" ;
|
||||
print MAKEFILE
|
||||
"\${MODEL_c_OBJ}: build\%.o : \%.c
|
||||
\t\$(PRINT_COMPILE)
|
||||
\t\$(ECHO_CMD)\$(TRICK_CC) \$(TRICK_CFLAGS) \$(TRICK_SYSTEM_CFLAGS) -MMD -MP -c \$< -o \$\@
|
||||
|
||||
print MAKEFILE "\${MODEL_C_OBJ} : \$(CURDIR)/build\%.o : \%.C\n" ;
|
||||
print MAKEFILE "\t\$(PRINT_COMPILE)\n" ;
|
||||
print MAKEFILE "\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -I\${<D} -I\${<D}/../include -MMD -MP -c \$< -o \$\@\n\n" ;
|
||||
\${MODEL_C_OBJ}: build\%.o : \%.C
|
||||
\t\$(PRINT_COMPILE)
|
||||
\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -MMD -MP -c \$< -o \$\@
|
||||
|
||||
print MAKEFILE "\${MODEL_cc_OBJ} : \$(CURDIR)/build\%.o : \%.cc\n" ;
|
||||
print MAKEFILE "\t\$(PRINT_COMPILE)\n" ;
|
||||
print MAKEFILE "\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -I\${<D} -I\${<D}/../include -MMD -MP -c \$< -o \$\@\n\n" ;
|
||||
\${MODEL_cc_OBJ}: build\%.o : \%.cc
|
||||
\t\$(PRINT_COMPILE)
|
||||
\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -MMD -MP -c \$< -o \$\@
|
||||
|
||||
print MAKEFILE "\${MODEL_cpp_OBJ} : \$(CURDIR)/build\%.o : \%.cpp\n" ;
|
||||
print MAKEFILE "\t\$(PRINT_COMPILE)\n" ;
|
||||
print MAKEFILE "\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -I\${<D} -I\${<D}/../include -MMD -MP -c \$< -o \$\@\n\n" ;
|
||||
\${MODEL_cpp_OBJ}: build\%.o : \%.cpp
|
||||
\t\$(PRINT_COMPILE)
|
||||
\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -MMD -MP -c \$< -o \$\@
|
||||
|
||||
print MAKEFILE "\${MODEL_cxx_OBJ} : \$(CURDIR)/build\%.o : \%.cxx\n" ;
|
||||
print MAKEFILE "\t\$(PRINT_COMPILE)\n" ;
|
||||
print MAKEFILE "\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -I\${<D} -I\${<D}/../include -MMD -MP -c \$< -o \$\@\n\n" ;
|
||||
\${MODEL_cxx_OBJ}: build\%.o : \%.cxx
|
||||
\t\$(PRINT_COMPILE)
|
||||
\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -MMD -MP -c \$< -o \$\@
|
||||
|
||||
print MAKEFILE "\${MODEL_CPLUSPLUS_OBJ} : \$(CURDIR)/build\%.o : \%.c++\n" ;
|
||||
print MAKEFILE "\t\$(PRINT_COMPILE)\n" ;
|
||||
print MAKEFILE "\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -I\${<D} -I\${<D}/../include -MMD -MP -c \$< -o \$\@\n\n" ;
|
||||
\${MODEL_CPLUSPLUS_OBJ}: build\%.o : \%.c++
|
||||
\t\$(PRINT_COMPILE)
|
||||
\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -MMD -MP -c \$< -o \$\@
|
||||
|
||||
print MAKEFILE "\${MODEL_clex_SRC} : \$(CURDIR)/build\%.clex : \%.l\n" ;
|
||||
print MAKEFILE "\t\$(LEX) -o\$\@ \$<\n\n" ;
|
||||
\${MODEL_clex_SRC}: build\%.clex : \%.l
|
||||
\t\$(LEX) -o\$\@ \$<
|
||||
|
||||
print MAKEFILE "\${MODEL_y_c_SRC} : \$(CURDIR)/build\%.y.c : \%.y\n" ;
|
||||
print MAKEFILE "\t\$(YACC) -o\$\@ \$<\n\n" ;
|
||||
\${MODEL_y_c_SRC}: build\%.y.c : \%.y
|
||||
\t\$(YACC) -o\$\@ \$<
|
||||
|
||||
print MAKEFILE "\${MODEL_y_OBJ} : \$(CURDIR)/build\%.o : \%.y.c\n" ;
|
||||
print MAKEFILE "\t\$(PRINT_COMPILE)\n" ;
|
||||
print MAKEFILE "\t\$(ECHO_CMD)cd \$(<D) ; \$(TRICK_CC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -MMD -MP -c \${<F} -o \$\@\n\n" ;
|
||||
\${MODEL_y_OBJ}: build\%.o : \%.y.c
|
||||
\t\$(PRINT_COMPILE)
|
||||
\t\$(ECHO_CMD)cd \$(<D) ; \$(TRICK_CC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -MMD -MP -c \${<F} -o \$\@
|
||||
|
||||
# Include all of the dependency files for each object code file
|
||||
print MAKEFILE "-include \$(MODEL_c_OBJ:.o=.d)\n" ;
|
||||
print MAKEFILE "-include \$(MODEL_C_OBJ:.o=.d)\n" ;
|
||||
print MAKEFILE "-include \$(MODEL_cc_OBJ:.o=.d)\n" ;
|
||||
print MAKEFILE "-include \$(MODEL_cpp_OBJ:.o=.d)\n" ;
|
||||
print MAKEFILE "-include \$(MODEL_cxx_OBJ:.o=.d)\n" ;
|
||||
print MAKEFILE "-include \$(MODEL_CPLUSPLUS_OBJ:.o=.d)\n\n" ;
|
||||
-include \$(MODEL_c_OBJ:.o=.d)
|
||||
-include \$(MODEL_C_OBJ:.o=.d)
|
||||
-include \$(MODEL_cc_OBJ:.o=.d)
|
||||
-include \$(MODEL_cpp_OBJ:.o=.d)
|
||||
-include \$(MODEL_cxx_OBJ:.o=.d)
|
||||
-include \$(MODEL_CPLUSPLUS_OBJ:.o=.d)
|
||||
|
||||
OBJECTS =" ;
|
||||
|
||||
printf MAKEFILE "\n\nOBJECTS =" ;
|
||||
foreach $k ( sort keys %files_by_dir ) {
|
||||
foreach my $ext ( qw{ c C cc cxx cpp c++ l y} ) {
|
||||
my $print_ext ;
|
||||
@ -375,28 +369,27 @@ foreach $k ( sort keys %files_by_dir ) {
|
||||
$print_ext = $ext ;
|
||||
}
|
||||
if ( scalar @{$files_by_dir{$k}{$ext}} ne 0 ) {
|
||||
print MAKEFILE "\\\n\t\$(CURDIR)/build/lib/o_${print_ext}_$files_by_dir{$k}{dir_num}.o" ;
|
||||
print MAKEFILE " \\\n build/lib/o_${print_ext}_$files_by_dir{$k}{dir_num}.o" ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# print out the libraries we link
|
||||
print MAKEFILE "\n\nREAD_ONLY_LIBS = ";
|
||||
print MAKEFILE "\n\nREAD_ONLY_LIBS =";
|
||||
foreach ( @all_read_only_libs ) {
|
||||
print MAKEFILE " \\\n\t$_" ;
|
||||
print MAKEFILE " \\\n $_" ;
|
||||
}
|
||||
|
||||
print MAKEFILE "\n\n
|
||||
print MAKEFILE "
|
||||
|
||||
all: S_main
|
||||
|
||||
test: all
|
||||
test: TRICK_SYSTEM_CXXFLAGS += -DTRICK_UNIT_TEST
|
||||
test: TRICK_SYSTEM_CFLAGS += -DTRICK_UNIT_TEST
|
||||
test: all
|
||||
|
||||
S_main : \$(S_MAIN) S_sie.resource
|
||||
\t@ echo \"\"
|
||||
\t@ echo \"[32m=== Simulation make complete ===[00m\"
|
||||
S_main: \$(S_MAIN) S_sie.resource
|
||||
\t\$(info [32mTrick Build Process Complete[00m)
|
||||
|
||||
\$(S_MAIN): \${TRICK_STATIC_LIB} \$(OBJECTS) \$(S_OBJECT_FILES)
|
||||
\t\$(PRINT_EXE_LINK)
|
||||
@ -406,12 +399,12 @@ S_main : \$(S_MAIN) S_sie.resource
|
||||
\t\t\$(LD_WHOLE_ARCHIVE) \${TRICK_LIBS} \$(LD_NO_WHOLE_ARCHIVE)\\
|
||||
\t\t\${TRICK_EXEC_LINK_LIBS}
|
||||
|
||||
\$(OBJECTS) : | \$(LIB_DIR)
|
||||
\$(OBJECTS): | \$(LIB_DIR)
|
||||
|
||||
\$(LIB_DIR) :
|
||||
\t@ mkdir -p \$@
|
||||
\$(LIB_DIR):
|
||||
\t\@mkdir -p \$@
|
||||
|
||||
\$(CURDIR)/build/S_source.o: \$(CURDIR)/build/S_source.cpp
|
||||
build/S_source.o: build/S_source.cpp
|
||||
\t\$(PRINT_COMPILE)
|
||||
\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) -MMD -MP -c \$\< -o \$\@
|
||||
|
||||
@ -420,8 +413,8 @@ S_main : \$(S_MAIN) S_sie.resource
|
||||
sie: S_sie.resource
|
||||
|
||||
S_sie.resource: \$(S_MAIN)
|
||||
\t@ echo \"[34mGenerating S_sie.resource...[0m\"
|
||||
\t\$(ECHO_CMD)\$(S_MAIN) sie\n\n" ;
|
||||
\t\$(info [34mWriting[0m S_sie.resource)
|
||||
\t\$(ECHO_CMD)\$(S_MAIN) sie\n" ;
|
||||
|
||||
# write out the override files we have read in
|
||||
foreach $k ( sort keys %files_by_dir ) {
|
||||
@ -455,7 +448,7 @@ close LINKOBJS ;
|
||||
|
||||
# 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" ;
|
||||
print MAKEFILEDEPS "\$(CURDIR)/build/Makefile_src :" ;
|
||||
print MAKEFILEDEPS "build/Makefile_src:" ;
|
||||
print MAKEFILEDEPS map {"\\\n $_"} (sort keys %non_lib_processed_files) ;
|
||||
print MAKEFILEDEPS "\n" ;
|
||||
close MAKEFILEDEPS ;
|
||||
|
@ -141,8 +141,8 @@ sub make_swig_makefile() {
|
||||
my $s_source_full_path = abs_path("S_source.hh") ;
|
||||
my $s_source_md5 = md5_hex($s_source_full_path) ;
|
||||
|
||||
$swig_sim_dir = "\$(CURDIR)/trick" ;
|
||||
$swig_src_dir = "\$(CURDIR)/build" ;
|
||||
$swig_sim_dir = "trick" ;
|
||||
$swig_src_dir = "build" ;
|
||||
|
||||
foreach $n (@files_to_process) {
|
||||
# check to see if the parent directory of each file is writable.
|
||||
@ -168,27 +168,20 @@ sub make_swig_makefile() {
|
||||
print LINK_PY_OBJS "build/init_swig_modules.o\n" ;
|
||||
print LINK_PY_OBJS "build/py_top.o\n" ;
|
||||
|
||||
print MAKEFILE "\
|
||||
# SWIG rule
|
||||
SWIG_FLAGS ?=
|
||||
SWIG_CFLAGS := -I../include \${PYTHON_INCLUDES} -Wno-shadow -Wno-missing-field-initializers
|
||||
print MAKEFILE "SWIG_CFLAGS := -I../include \${PYTHON_INCLUDES} -Wno-shadow -Wno-missing-field-initializers
|
||||
ifeq (\$(IS_CC_CLANG), 1)
|
||||
SWIG_CFLAGS += -Wno-self-assign -Wno-sometimes-uninitialized -Wno-deprecated-register
|
||||
SWIG_CFLAGS += -Wno-self-assign -Wno-sometimes-uninitialized -Wno-deprecated-register
|
||||
endif
|
||||
|
||||
ifdef TRICK_VERBOSE_BUILD
|
||||
PRINT_SWIG =
|
||||
PRINT_COMPILE_SWIG =
|
||||
PRINT_SWIG_INC_LINK =
|
||||
#PRINT_CONVERT_SWIG =
|
||||
else
|
||||
PRINT_SWIG = \@echo \"[34mSwig [0m \$(subst \$(CURDIR)/build,build,\$<)\"
|
||||
PRINT_COMPILE_SWIG = \@echo \"[34mCompiling [0m \$(subst .o,.cpp,\$(subst \$(CURDIR)/build,build,\$@))\"
|
||||
PRINT_SWIG_INC_LINK = \@echo \"[34mPartial link[0m swig objects\"
|
||||
#PRINT_CONVERT_SWIG = \@echo \"[34mRunning convert_swig[0m\"
|
||||
ifndef TRICK_VERBOSE_BUILD
|
||||
PRINT_SWIG = \$(info \$(call COLOR,SWIGing) \$<)
|
||||
PRINT_COMPILE_SWIG = \$(info \$(call COLOR,Compiling) \$<)
|
||||
PRINT_SWIG_INC_LINK = \$(info \$(call COLOR,Linking) SWIG objects)
|
||||
endif
|
||||
|
||||
SWIG_MODULE_OBJECTS = \$(LIB_DIR)/swig_python.o
|
||||
OBJECTS += \$(SWIG_MODULE_OBJECTS)
|
||||
LINK_OBJECTS += \$(SWIG_MODULE_OBJECTS)
|
||||
|
||||
SWIG_PY_OBJECTS =" ;
|
||||
|
||||
@ -197,14 +190,21 @@ SWIG_PY_OBJECTS =" ;
|
||||
my ($swig_f) = $f ;
|
||||
$swig_object_dir = dirname($f) ;
|
||||
($swig_file_only) = ($f =~ /([^\/]*)(?:\.h|\.H|\.hh|\.h\+\+|\.hxx|\.hpp)$/) ;
|
||||
print MAKEFILE" \\\n \$(CURDIR)/build$swig_object_dir/py_${swig_file_only}.o" ;
|
||||
print MAKEFILE" \\\n build$swig_object_dir/py_${swig_file_only}.o" ;
|
||||
}
|
||||
print MAKEFILE "\\\n $swig_src_dir/init_swig_modules.o" ;
|
||||
print MAKEFILE "\\\n $swig_src_dir/py_top.o\n\n" ;
|
||||
print MAKEFILE "\\\n $swig_src_dir/init_swig_modules.o" ;
|
||||
print MAKEFILE "\\\n $swig_src_dir/py_top.o\n" ;
|
||||
|
||||
print MAKEFILE "\$(SWIG_PY_OBJECTS) : | trick\n" ;
|
||||
print MAKEFILE "trick :\n" ;
|
||||
print MAKEFILE "\t\@mkdir \$\@\n" ;
|
||||
print MAKEFILE "
|
||||
TRICK_FIXED_PYTHON = \\
|
||||
$swig_sim_dir/swig_double.py \\
|
||||
$swig_sim_dir/swig_int.py \\
|
||||
$swig_sim_dir/swig_ref.py \\
|
||||
$swig_sim_dir/shortcuts.py \\
|
||||
$swig_sim_dir/unit_test.py \\
|
||||
$swig_sim_dir/sim_services.py \\
|
||||
$swig_sim_dir/exception.py
|
||||
" ;
|
||||
|
||||
my %swig_dirs ;
|
||||
my %python_modules ;
|
||||
@ -237,16 +237,11 @@ SWIG_PY_OBJECTS =" ;
|
||||
$swig_f =~ s/([^\/]*)(?:\.h|\.H|\.hh|\.h\+\+|\.hxx|\.hpp)$/$1.i/ ;
|
||||
$swig_file_only = $1 ;
|
||||
my $link_py_obj = "build" . dirname($swig_f) . "/py_${swig_file_only}.o";
|
||||
$swig_f = "\$(CURDIR)/build" . $swig_f ;
|
||||
$swig_f = "build" . $swig_f ;
|
||||
$swig_dir = dirname($swig_f) ;
|
||||
$swig_object_dir = dirname($swig_f) ;
|
||||
$swig_dirs{$swig_dir} = 1 ;
|
||||
|
||||
print MAKEFILE "$swig_object_dir/py_${swig_file_only}.o : $swig_f\n" ;
|
||||
print MAKEFILE "\t\$(PRINT_SWIG)\n" ;
|
||||
print MAKEFILE "\t\$(ECHO_CMD)\$(SWIG) \$(TRICK_INCLUDE) \$(TRICK_DEFINES) \$(TRICK_VERSIONS) \$(SWIG_FLAGS) -c++ -python -includeall -ignoremissing -w201,303,362,389,401,451 -outdir trick -o $swig_dir/py_${swig_file_only}.cpp \$<\n" ;
|
||||
print MAKEFILE "\t\$(PRINT_COMPILE_SWIG)\n" ;
|
||||
print MAKEFILE "\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) \$(SWIG_CFLAGS) -c $swig_dir/py_${swig_file_only}.cpp -o \$@\n\n" ;
|
||||
print LINK_PY_OBJS "$link_py_obj\n" ;
|
||||
|
||||
$ii++ ;
|
||||
@ -263,48 +258,30 @@ SWIG_PY_OBJECTS =" ;
|
||||
my $wd = abs_path(cwd()) ;
|
||||
|
||||
print MAKEFILE "
|
||||
\$(SWIG_MODULE_OBJECTS) : TRICK_SYSTEM_CXXFLAGS += -Wno-unused-parameter -Wno-redundant-decls
|
||||
|
||||
OBJECTS += \$(SWIG_MODULE_OBJECTS)
|
||||
LINK_OBJECTS += \$(SWIG_MODULE_OBJECTS)
|
||||
\$(S_MAIN): \$(SWIG_MODULE_OBJECTS)
|
||||
|
||||
\$(SWIG_MODULE_OBJECTS) : \$(SWIG_PY_OBJECTS) | \$(LIB_DIR)
|
||||
\$(SWIG_MODULE_OBJECTS): TRICK_SYSTEM_CXXFLAGS += -Wno-unused-parameter -Wno-redundant-decls
|
||||
\$(SWIG_MODULE_OBJECTS): \$(SWIG_PY_OBJECTS) | \$(LIB_DIR)
|
||||
\t\$(PRINT_SWIG_INC_LINK)
|
||||
\t\$(ECHO_CMD)\$(LD) \$(LD_PARTIAL) -o \$\@ \$(LD_FILELIST)build/link_py_objs
|
||||
\n\n" ;
|
||||
|
||||
print MAKEFILE "$swig_src_dir/py_top.cpp : $swig_src_dir/top.i\n" ;
|
||||
print MAKEFILE "\t\$(PRINT_SWIG)\n" ;
|
||||
print MAKEFILE "\t\$(ECHO_CMD)\$(SWIG) \$(TRICK_INCLUDE) \$(TRICK_DEFINES) \$(TRICK_VERSIONS) -c++ -python -includeall -ignoremissing -w201,303,362,389,401,451 -outdir $swig_sim_dir -o \$@ \$<\n\n" ;
|
||||
S_main: \$(TRICK_FIXED_PYTHON)
|
||||
|
||||
print MAKEFILE "$swig_src_dir/py_top.o : $swig_src_dir/py_top.cpp\n" ;
|
||||
print MAKEFILE "\t\$(PRINT_COMPILE_SWIG)\n" ;
|
||||
print MAKEFILE "\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) \$(SWIG_CFLAGS) -c \$< -o \$@\n\n" ;
|
||||
\$(TRICK_FIXED_PYTHON): $swig_sim_dir/\% : \${TRICK_HOME}/share/trick/swig/\%
|
||||
\t\$(ECHO_CMD)/bin/cp -f \$< \$@
|
||||
|
||||
print MAKEFILE "$swig_src_dir/init_swig_modules.o : $swig_src_dir/init_swig_modules.cpp\n" ;
|
||||
print MAKEFILE "\t\$(PRINT_COMPILE_SWIG)\n" ;
|
||||
print MAKEFILE "\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) \$(SWIG_CFLAGS) -c \$< -o \$@\n\n" ;
|
||||
py_%.cpp: %.i
|
||||
\t\$(PRINT_SWIG)
|
||||
\t\$(ECHO_CMD)\$(SWIG) \$(TRICK_INCLUDE) \$(TRICK_DEFINES) \$(TRICK_VERSIONS) \$(SWIG_FLAGS) -c++ -python -includeall -ignoremissing -w201,303,362,389,401,451 -outdir trick -o \$@ \$<
|
||||
|
||||
print MAKEFILE "TRICK_FIXED_PYTHON = \\
|
||||
$swig_sim_dir/swig_double.py \\
|
||||
$swig_sim_dir/swig_int.py \\
|
||||
$swig_sim_dir/swig_ref.py \\
|
||||
$swig_sim_dir/shortcuts.py \\
|
||||
$swig_sim_dir/unit_test.py \\
|
||||
$swig_sim_dir/sim_services.py \\
|
||||
$swig_sim_dir/exception.py\n\n" ;
|
||||
print MAKEFILE "S_main: \$(TRICK_FIXED_PYTHON)\n\n" ;
|
||||
%.o: %.cpp
|
||||
\t\$(PRINT_COMPILE_SWIG)
|
||||
\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) \$(SWIG_CFLAGS) -c -o \$@ \$<
|
||||
|
||||
print MAKEFILE "\$(TRICK_FIXED_PYTHON) : $swig_sim_dir/\% : \${TRICK_HOME}/share/trick/swig/\%\n" ;
|
||||
print MAKEFILE "\t\$(ECHO_CMD)/bin/cp -f \$< \$@\n\n" ;
|
||||
# We don't really need to keep these, but make prints out a huge \"rm -f\" when it automatically
|
||||
# deletes intermediate files, and I don't know how to silence that.
|
||||
.PRECIOUS: py_%.cpp" ;
|
||||
|
||||
foreach (keys %swig_dirs) {
|
||||
print MAKEFILE "$_:\n" ;
|
||||
print MAKEFILE "\tmkdir -p $_\n\n" ;
|
||||
}
|
||||
|
||||
print MAKEFILE "\n" ;
|
||||
close MAKEFILE ;
|
||||
close LINK_PY_OBJS ;
|
||||
|
||||
@ -491,9 +468,9 @@ LINK_OBJECTS += \$(SWIG_MODULE_OBJECTS)
|
||||
}
|
||||
|
||||
open MAKEFILECONV , ">build/Makefile_convert_swig" or return ;
|
||||
print MAKEFILECONV "\$(CURDIR)/build/convert_swig_last_run :" ;
|
||||
print MAKEFILECONV "build/convert_swig_last_run:" ;
|
||||
foreach $f ( @files_to_process ) {
|
||||
print MAKEFILECONV " \\\n $f" ;
|
||||
print MAKEFILECONV " \\\n $f" ;
|
||||
}
|
||||
close MAKEFILECONV ;
|
||||
|
||||
|
@ -145,10 +145,11 @@ sub get_lib_deps ($$) {
|
||||
$l .= "o" ;
|
||||
}
|
||||
if ( $found == 0 ) {
|
||||
print STDERR "[1m[33mWarning [39m$source_file_name[0m\n " ;
|
||||
if ( $l =~ /^(sim_services)/ or $l =~ /^(er7_utils)/ ) {
|
||||
print STDERR "[33mWarning: Not necessary to list $1 dependencies $l[0m\n" ;
|
||||
print STDERR "It is not necessary to list dependencies found in $1: \"[1m$l[0m\"\n" ;
|
||||
} else {
|
||||
print STDERR "[33mWarning: Could not find dependency $l[0m\n" ;
|
||||
print STDERR "Could not find dependency \"[1m$l[0m\"\n" ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -524,7 +524,8 @@ sub handle_sim_class ($$$$) {
|
||||
$template_args =~ s/class|typename//g ;
|
||||
$template_args =~ s/\s//g ;
|
||||
|
||||
trick_print($$sim_ref{fh}, "Processing sim_class $class_name\n" , "normal white" , $$sim_ref{args}{v});
|
||||
trick_print($$sim_ref{fh}, "Processing " , "normal_blue" , $$sim_ref{args}{v});
|
||||
trick_print($$sim_ref{fh}, "$class_name\n" , "normal_white" , $$sim_ref{args}{v});
|
||||
|
||||
# grab the entire contents of the class out of the S_define file.
|
||||
($class_contents, $$file_contents) = extract_bracketed($$file_contents,"{}");
|
||||
@ -814,9 +815,11 @@ sub handle_line_tag($$) {
|
||||
trick_print($$sim_ref{fh},"Line: $s\n", "debug_yellow", $$sim_ref{args}{v}) ;
|
||||
if ( $file_name !~ /^\</ and $file_name ne $$sim_ref{last_file} ) {
|
||||
if ( exists $$sim_ref{files_visited}{$file_name} ) {
|
||||
trick_print($$sim_ref{fh},"Continuing $file_name\n", "normal_cyan", $$sim_ref{args}{v}) ;
|
||||
trick_print($$sim_ref{fh},"Continuing ", "normal_blue", $$sim_ref{args}{v}) ;
|
||||
trick_print($$sim_ref{fh},"$file_name\n", "normal_white", $$sim_ref{args}{v}) ;
|
||||
} else {
|
||||
trick_print($$sim_ref{fh},"Processing $file_name\n", "normal_cyan", $$sim_ref{args}{v}) ;
|
||||
trick_print($$sim_ref{fh},"Processing ", "normal_blue", $$sim_ref{args}{v}) ;
|
||||
trick_print($$sim_ref{fh},"$file_name\n", "normal_white", $$sim_ref{args}{v}) ;
|
||||
$$sim_ref{files_visited}{$file_name} = 1 ;
|
||||
}
|
||||
$$sim_ref{last_file} = $file_name ;
|
||||
|
1
share/trick/env/Trick.profile
vendored
1
share/trick/env/Trick.profile
vendored
@ -92,7 +92,6 @@ if [ -f ${TRICK_HOME}/bin/gte ] && [ -f "${PERL}" ] ; then
|
||||
alias ftn_depend=' $trick_perl $trick_bin/ftn_depend'
|
||||
alias gte=' $trick_perl $trick_bin/gte'
|
||||
alias icg_dep=' $trick_perl $trick_bin/icg_dep'
|
||||
alias make_build=' $trick_perl $trick_bin/make_build'
|
||||
alias mis_dep=' $trick_perl $trick_bin/mis_dep'
|
||||
alias trick_version='$trick_perl $trick_bin/trick_version'
|
||||
if [ x$TRICK_MAKE = x ] ; then
|
||||
|
@ -1,31 +1,38 @@
|
||||
SHELL := /bin/sh
|
||||
CD := cd
|
||||
MV := /bin/mv
|
||||
RM := /bin/rm
|
||||
CP := /bin/cp
|
||||
PWD = $(shell /bin/pwd)
|
||||
|
||||
SHELL := /bin/sh
|
||||
CD := cd
|
||||
MV := /bin/mv
|
||||
RM := /bin/rm
|
||||
CP := /bin/cp
|
||||
PWD = $(shell /bin/pwd)
|
||||
COLOR = [34m$(1)[0m
|
||||
|
||||
ifndef TRICK_VERBOSE_BUILD
|
||||
ECHO_CMD = @
|
||||
endif
|
||||
|
||||
export TRICK_HOST_TYPE := $(shell export TRICK_HOME=$(TRICK_HOME) && $(TRICK_HOME)/bin/trick-gte TRICK_HOST_TYPE)
|
||||
export TRICK_VERSION := $(shell export TRICK_HOME=$(TRICK_HOME) && $(TRICK_HOME)/bin/trick-version -v)
|
||||
export TRICK_MAJOR := $(shell export TRICK_HOME=$(TRICK_HOME) && $(TRICK_HOME)/bin/trick-version -y)
|
||||
export TRICK_MINOR := $(shell export TRICK_HOME=$(TRICK_HOME) && $(TRICK_HOME)/bin/trick-version -m)
|
||||
export TRICK_VERSION := $(shell export TRICK_HOME=$(TRICK_HOME) && $(TRICK_HOME)/bin/trick-version -v)
|
||||
export TRICK_MAJOR := $(shell export TRICK_HOME=$(TRICK_HOME) && $(TRICK_HOME)/bin/trick-version -y)
|
||||
export TRICK_MINOR := $(shell export TRICK_HOME=$(TRICK_HOME) && $(TRICK_HOME)/bin/trick-version -m)
|
||||
|
||||
include $(TRICK_HOME)/share/trick/makefiles/config_${TRICK_HOST_TYPE}.mk
|
||||
-include $(TRICK_HOME)/share/trick/makefiles/config_user.mk
|
||||
|
||||
ifndef TRICK_CC
|
||||
export TRICK_CC := $(CC)
|
||||
export TRICK_CC := $(CC)
|
||||
endif
|
||||
|
||||
ifndef TRICK_CPPC
|
||||
export TRICK_CPPC := $(CXX)
|
||||
export TRICK_CPPC := $(CXX)
|
||||
endif
|
||||
|
||||
ifndef TRICK_LD
|
||||
export TRICK_LD := $(LD)
|
||||
export TRICK_LD := $(LD)
|
||||
endif
|
||||
|
||||
ifndef TRICK_SFLAGS
|
||||
export TRICK_SFLAGS :=
|
||||
export TRICK_SFLAGS :=
|
||||
endif
|
||||
|
||||
export TRICK_CFLAGS
|
||||
@ -46,19 +53,19 @@ export TRICK_SYSTEM_CFLAGS
|
||||
export TRICK_SYSTEM_CXXFLAGS
|
||||
export TRICK_SYSTEM_SFLAGS
|
||||
|
||||
IO_SRC_DIR := io_src/
|
||||
OBJ_DIR := object_${TRICK_HOST_CPU}
|
||||
IO_SRC_DIR := io_src/
|
||||
OBJ_DIR := object_${TRICK_HOST_CPU}
|
||||
TRICK_STATIC_LIB := ${TRICK_LIB_DIR}/libtrick.a
|
||||
TRICK_RANLIB =
|
||||
TRICK_RANLIB =
|
||||
|
||||
ifndef CONFIG_MK
|
||||
ifneq ($(MAKECMDGOALS), clean)
|
||||
$(error Please run $(TRICK_HOME)/configure before running make)
|
||||
endif
|
||||
ifneq ($(MAKECMDGOALS), clean)
|
||||
$(error Please run $(TRICK_HOME)/configure before running make)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Where are the libexec executables
|
||||
ifneq ("$(wildcard $(TRICK_HOME)/libexec)","")
|
||||
ifneq ($(wildcard $(TRICK_HOME)/libexec),)
|
||||
LIBEXEC = libexec
|
||||
else
|
||||
LIBEXEC = lib
|
||||
@ -67,86 +74,78 @@ endif
|
||||
TRICK_INCLUDES := -I${TRICK_HOME}/trick_source -I${TRICK_HOME}/include -I${TRICK_HOME}/include/trick/compat
|
||||
TRICK_VERSIONS := -DTRICK_VER=$(TRICK_MAJOR) -DTRICK_MINOR=$(TRICK_MINOR)
|
||||
|
||||
TRICK_SYSTEM_CFLAGS = $(TRICK_INCLUDES) $(TRICK_VERSIONS) -fpic
|
||||
TRICK_SYSTEM_CXXFLAGS = $(TRICK_INCLUDES) $(TRICK_VERSIONS) -fpic
|
||||
TRICK_SYSTEM_SFLAGS = -I${TRICK_HOME}/share/trick -I${TRICK_HOME}/share $(TRICK_INCLUDES) $(TRICK_VERSIONS)
|
||||
|
||||
# append additional c and cxx flags defined in config_*.mk files.
|
||||
TRICK_SYSTEM_CFLAGS += $(TRICK_ADDITIONAL_CFLAGS) $(UDUNITS_INCLUDES)
|
||||
TRICK_SYSTEM_CXXFLAGS += $(TRICK_ADDITIONAL_CXXFLAGS) $(UDUNITS_INCLUDES)
|
||||
|
||||
# -fexceptions is included to propogate execptions through C code.
|
||||
TRICK_SYSTEM_CFLAGS += -fexceptions
|
||||
TRICK_SYSTEM_CXXFLAGS = $(TRICK_INCLUDES) $(TRICK_VERSIONS) -fpic $(UDUNITS_INCLUDES)
|
||||
TRICK_SYSTEM_SFLAGS = -I${TRICK_HOME}/share/trick -I${TRICK_HOME}/share $(TRICK_INCLUDES) $(TRICK_VERSIONS)
|
||||
|
||||
HAVE_ZEROCONF ?= 0
|
||||
ifeq ($(HAVE_ZEROCONF),1)
|
||||
TRICK_SYSTEM_CFLAGS += -DHAVE_ZEROCONF
|
||||
TRICK_SYSTEM_CXXFLAGS += -DHAVE_ZEROCONF
|
||||
TRICK_SYSTEM_CXXFLAGS += -DHAVE_ZEROCONF
|
||||
endif
|
||||
|
||||
ifeq ($(USE_ER7_UTILS), 1)
|
||||
ER7_UTILS_HOME := $(TRICK_HOME)/trick_source/er7_utils
|
||||
TRICK_SYSTEM_CFLAGS += -DUSE_ER7_UTILS_INTEGRATORS
|
||||
TRICK_SYSTEM_CXXFLAGS += -DUSE_ER7_UTILS_INTEGRATORS
|
||||
TRICK_LIBS += -ler7_utils
|
||||
ifneq ($(wildcard ${ER7_UTILS_HOME}/CheckpointHelper),)
|
||||
USE_ER7_UTILS_CHECKPOINTHELPER = 1
|
||||
TRICK_SYSTEM_CFLAGS += -DUSE_ER7_UTILS_CHECKPOINTHELPER
|
||||
TRICK_SYSTEM_CXXFLAGS += -DUSE_ER7_UTILS_CHECKPOINTHELPER
|
||||
endif
|
||||
ER7_UTILS_HOME := $(TRICK_HOME)/trick_source/er7_utils
|
||||
TRICK_SYSTEM_CXXFLAGS += -DUSE_ER7_UTILS_INTEGRATORS
|
||||
TRICK_LIBS += -ler7_utils
|
||||
ifneq ($(wildcard ${ER7_UTILS_HOME}/CheckpointHelper),)
|
||||
USE_ER7_UTILS_CHECKPOINTHELPER = 1
|
||||
TRICK_SYSTEM_CXXFLAGS += -DUSE_ER7_UTILS_CHECKPOINTHELPER
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(TRICK_FORCE_32BIT), 1)
|
||||
TRICK_SYSTEM_CFLAGS += -m32
|
||||
TRICK_SYSTEM_CXXFLAGS += -m32
|
||||
TRICK_LDFLAGS += -m32
|
||||
LD_PARTIAL += -melf_i386
|
||||
TRICK_SYSTEM_CXXFLAGS += -m32
|
||||
TRICK_LDFLAGS += -m32
|
||||
LD_PARTIAL += -melf_i386
|
||||
endif
|
||||
|
||||
IS_CC_CLANG = $(shell ${TRICK_CPPC} -xc /dev/null -dM -E | grep -c __clang__)
|
||||
ifeq ($(IS_CC_CLANG), 1)
|
||||
TRICK_SYSTEM_CFLAGS += -fcolor-diagnostics
|
||||
TRICK_SYSTEM_CXXFLAGS += -fcolor-diagnostics
|
||||
TRICK_SYSTEM_CXXFLAGS += -fcolor-diagnostics
|
||||
else
|
||||
GCC_MAJOR:=$(shell $(TRICK_CC) -dumpversion | cut -f1 -d.)
|
||||
GCC_MINOR:=$(shell $(TRICK_CC) -dumpversion | cut -f2 -d.)
|
||||
GCC_MAJOR := $(shell $(TRICK_CC) -dumpversion | cut -f1 -d.)
|
||||
GCC_MINOR := $(shell $(TRICK_CC) -dumpversion | cut -f2 -d.)
|
||||
endif
|
||||
|
||||
ifneq ($(HDF5),)
|
||||
ifneq ($(HDF5),/usr)
|
||||
HDF5_LIB := -L$(HDF5)/lib -lhdf5_hl -lhdf5 -lsz
|
||||
HAVE_HDF5_HOME_LIB64 := $(shell test -e ${HDF5}/lib64 && echo "1")
|
||||
ifeq ($(HAVE_HDF5_HOME_LIB64),1)
|
||||
HDF5_LIB = -L$(HDF5)/lib64 $(HDF5_LIB)
|
||||
endif
|
||||
else
|
||||
HDF5_LIB = -lhdf5_hl -lhdf5
|
||||
endif
|
||||
TRICK_EXEC_LINK_LIBS += ${HDF5_LIB}
|
||||
ifneq ($(HDF5),/usr)
|
||||
HDF5_LIB := -L$(HDF5)/lib -lhdf5_hl -lhdf5 -lsz
|
||||
HAVE_HDF5_HOME_LIB64 := $(shell test -e ${HDF5}/lib64 && echo "1")
|
||||
ifeq ($(HAVE_HDF5_HOME_LIB64),1)
|
||||
HDF5_LIB = -L$(HDF5)/lib64 $(HDF5_LIB)
|
||||
endif
|
||||
else
|
||||
HDF5_LIB = -lhdf5_hl -lhdf5
|
||||
endif
|
||||
TRICK_EXEC_LINK_LIBS += ${HDF5_LIB}
|
||||
endif
|
||||
|
||||
ifneq ($(GSL_HOME),)
|
||||
ifneq ($(GSL_HOME),/usr)
|
||||
HAVE_GSL_HOME_LIB64 := $(shell test -e ${GSL_HOME}/lib64 && echo "1")
|
||||
ifeq ($(HAVE_GSL_HOME_LIB64),1)
|
||||
TRICK_EXEC_LINK_LIBS += -L$(GSL_HOME)/lib64
|
||||
ifneq ($(GSL_HOME),/usr)
|
||||
HAVE_GSL_HOME_LIB64 := $(shell test -e ${GSL_HOME}/lib64 && echo "1")
|
||||
ifeq ($(HAVE_GSL_HOME_LIB64),1)
|
||||
TRICK_EXEC_LINK_LIBS += -L$(GSL_HOME)/lib64
|
||||
endif
|
||||
TRICK_EXEC_LINK_LIBS += -L$(GSL_HOME)/lib
|
||||
ifneq ($(GSL_HOME),/usr/local)
|
||||
TRICK_SYSTEM_CXXFLAGS += -I$(GSL_HOME)/include
|
||||
endif
|
||||
endif
|
||||
TRICK_EXEC_LINK_LIBS += -L$(GSL_HOME)/lib
|
||||
ifneq ($(GSL_HOME),/usr/local)
|
||||
TRICK_SYSTEM_CFLAGS += -I$(GSL_HOME)/include
|
||||
TRICK_SYSTEM_CXXFLAGS += -I$(GSL_HOME)/include
|
||||
endif
|
||||
endif
|
||||
TRICK_EXEC_LINK_LIBS += -lgsl -lgslcblas
|
||||
TRICK_SYSTEM_CFLAGS += -D_HAVE_GSL
|
||||
TRICK_SYSTEM_CXXFLAGS += -D_HAVE_GSL
|
||||
TRICK_EXEC_LINK_LIBS += -lgsl -lgslcblas
|
||||
TRICK_SYSTEM_CXXFLAGS += -D_HAVE_GSL
|
||||
endif
|
||||
|
||||
TRICK_INCLUDE = $(shell $(PERL) -e '@inc_paths = "${TRICK_CFLAGS}" =~ /-I\s*(\S+)/g ; foreach $$i (@inc_paths) { print "-I$$i " if (-e $$i)}')
|
||||
TRICK_INCLUDE += $(shell $(PERL) -e '@inc_paths = "${TRICK_SYSTEM_CFLAGS}" =~ /-I\s*(\S+)/g ; foreach $$i (@inc_paths) { print "-I$$i " if (-e $$i)}')
|
||||
TRICK_DEFINES = $(shell $(PERL) -e '@defines = "${TRICK_CFLAGS}" =~ /-D\s*(\S+)/g ; foreach $$i (@defines) { print "-D$$i "}')
|
||||
TRICK_DEFINES += $(shell $(PERL) -e '@defines = "${TRICK_SYSTEM_CFLAGS}" =~ /-D\s*(\S+)/g ; foreach $$i (@defines) { print "-D$$i "}')
|
||||
# -fexceptions is included to propogate execptions through C code.
|
||||
TRICK_SYSTEM_CFLAGS = $(TRICK_SYSTEM_CXXFLAGS) -fexceptions
|
||||
|
||||
# append additional c and cxx flags defined in config_*.mk files.
|
||||
TRICK_SYSTEM_CFLAGS += $(TRICK_ADDITIONAL_CFLAGS)
|
||||
TRICK_SYSTEM_CXXFLAGS += $(TRICK_ADDITIONAL_CXXFLAGS)
|
||||
|
||||
TRICK_INCLUDE = $(shell $(PERL) -e '@inc_paths = "${TRICK_CFLAGS}" =~ /-I\s*(\S+)/g ; foreach $$i (@inc_paths) { print "-I$$i " if (-e $$i)}') \
|
||||
$(shell $(PERL) -e '@inc_paths = "${TRICK_SYSTEM_CFLAGS}" =~ /-I\s*(\S+)/g ; foreach $$i (@inc_paths) { print "-I$$i " if (-e $$i)}')
|
||||
|
||||
TRICK_DEFINES = $(shell $(PERL) -e '@defines = "${TRICK_CFLAGS}" =~ /-D\s*(\S+)/g ; foreach $$i (@defines) { print "-D$$i "}') \
|
||||
$(shell $(PERL) -e '@defines = "${TRICK_SYSTEM_CFLAGS}" =~ /-D\s*(\S+)/g ; foreach $$i (@defines) { print "-D$$i "}')
|
||||
|
||||
DEPFILE = $(PWD)/Makefile_deps
|
||||
DEPTEMPFILE = $(PWD)/Makefile_temp_depends
|
||||
|
||||
|
@ -1,22 +1,12 @@
|
||||
|
||||
include ${TRICK_HOME}/share/trick/makefiles/Makefile.common
|
||||
|
||||
ifdef TRICK_VERBOSE_BUILD
|
||||
PRINT_CP =
|
||||
PRINT_ICG =
|
||||
PRINT_S_DEF_DEPS =
|
||||
PRINT_CONVERT_SWIG =
|
||||
PRINT_MAKEFILE_SRC =
|
||||
PRINT_MAKEFILE_SWIG =
|
||||
ECHO_CMD =
|
||||
else
|
||||
PRINT_CP = @echo "[34mRunning configuration_processor[0m"
|
||||
PRINT_ICG = @echo "[34mRunning ICG[0m"
|
||||
PRINT_S_DEF_DEPS = @echo "[34mGet depends for S_define[0m"
|
||||
PRINT_CONVERT_SWIG = @echo "[34mRunning convert_swig[0m"
|
||||
PRINT_MAKEFILE_SRC = @echo "[34mCreating/updating source Makefile[0m"
|
||||
PRINT_MAKEFILE_SWIG = @echo "[34mCreating/updating swig Makefile[0m"
|
||||
ECHO_CMD = @
|
||||
ifndef TRICK_VERBOSE_BUILD
|
||||
PRINT_CP = $(info $(call COLOR,Running) configuration_processor)
|
||||
PRINT_ICG = $(info $(call COLOR,Running) ICG)
|
||||
PRINT_S_DEF_DEPS = $(info $(call COLOR,Tracing) S_define)
|
||||
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
|
||||
|
||||
.NOTPARALLEL:
|
||||
@ -26,31 +16,31 @@ export TRICK_ICG_EXCLUDE
|
||||
# Use /bin/bash as the shell so we can use PIPESTATUS
|
||||
SHELL = /bin/bash
|
||||
|
||||
all test : ${TRICK_LIB_DIR}/libtrick.a S_source.hh \
|
||||
$(CURDIR)/build/S_define.deps \
|
||||
$(CURDIR)/build/Makefile_io_src \
|
||||
$(CURDIR)/build/Makefile_src \
|
||||
$(CURDIR)/build/Makefile_swig \
|
||||
$(CURDIR)/build/convert_swig_last_run
|
||||
all test: $(TRICK_STATIC_LIB) S_source.hh \
|
||||
build/S_define.deps \
|
||||
build/Makefile_io_src \
|
||||
build/Makefile_src \
|
||||
build/Makefile_swig \
|
||||
build/convert_swig_last_run
|
||||
@$(MAKE) --no-print-directory -f build/Makefile_src $@ 2>&1 | tee build/MAKE_out ; exit $${PIPESTATUS[0]}
|
||||
|
||||
build:
|
||||
mkdir $@
|
||||
|
||||
debug : all
|
||||
debug : TRICK_CPFLAGS += --debug
|
||||
debug: all
|
||||
debug: TRICK_CPFLAGS += --debug
|
||||
|
||||
${TRICK_LIB_DIR}/libtrick.a:
|
||||
@echo "Cannot find $@. Please build Trick for this platfrom"
|
||||
$(TRICK_STATIC_LIB):
|
||||
$(info Cannot find $@. Please build Trick for this platform.)
|
||||
@exit -1
|
||||
|
||||
# CP creates S_source.hh required for ICG and SWIG processing
|
||||
S_source.hh $(CURDIR)/build/S_define.lib_deps : S_define | build
|
||||
S_source.hh build/S_define.lib_deps: S_define | build
|
||||
$(PRINT_CP)
|
||||
$(ECHO_CMD)${TRICK_HOME}/$(LIBEXEC)/trick/configuration_processor $(TRICK_CPFLAGS)
|
||||
|
||||
# Automatic and manual ICG rules
|
||||
$(CURDIR)/build/Makefile_io_src : | S_source.hh
|
||||
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} S_source.hh
|
||||
|
||||
@ -63,30 +53,30 @@ force_ICG:
|
||||
$(ECHO_CMD)${TRICK_HOME}/bin/trick-ICG -f -m ${TRICK_ICGFLAGS} ${TRICK_CXXFLAGS} ${TRICK_SYSTEM_CXXFLAGS} S_source.hh
|
||||
|
||||
# Build dependencies for recreating S_source.hh
|
||||
$(CURDIR)/build/S_define.deps :
|
||||
build/S_define.deps: | build
|
||||
$(PRINT_S_DEF_DEPS)
|
||||
$(ECHO_CMD)$(TRICK_CPPC) $(TRICK_SFLAGS) $(TRICK_SYSTEM_SFLAGS) -M -MT S_source.hh -MF build/S_define.deps -x c++ S_define
|
||||
|
||||
# Create makefile for source code
|
||||
$(CURDIR)/build/Makefile_src: | $(CURDIR)/build/Makefile_io_src $(CURDIR)/build/S_define.lib_deps
|
||||
build/Makefile_src: | build/Makefile_io_src build/S_define.lib_deps
|
||||
$(PRINT_MAKEFILE_SRC)
|
||||
$(ECHO_CMD)${TRICK_HOME}/$(LIBEXEC)/trick/make_makefile_src $?
|
||||
|
||||
# Create makefile for SWIG code
|
||||
$(CURDIR)/build/Makefile_swig : | $(CURDIR)/build/Makefile_io_src
|
||||
build/Makefile_swig: | build/Makefile_io_src
|
||||
$(PRINT_MAKEFILE_SWIG)
|
||||
$(ECHO_CMD)${TRICK_HOME}/$(LIBEXEC)/trick/make_makefile_swig $?
|
||||
|
||||
# Automatic and manual convert_swig rules
|
||||
$(CURDIR)/build/convert_swig_last_run : | $(CURDIR)/build/Makefile_swig
|
||||
build/convert_swig_last_run: | build/Makefile_swig
|
||||
$(PRINT_CONVERT_SWIG)
|
||||
$(ECHO_CMD)${TRICK_HOME}/$(LIBEXEC)/trick/convert_swig ${TRICK_CONVERT_SWIG_FLAGS}
|
||||
@ touch $@
|
||||
@touch $@
|
||||
|
||||
convert_swig:
|
||||
$(PRINT_CONVERT_SWIG)
|
||||
$(ECHO_CMD)${TRICK_HOME}/$(LIBEXEC)/trick/convert_swig ${TRICK_CONVERT_SWIG_FLAGS}
|
||||
@ touch $(CURDIR)/build/convert_swig_last_run
|
||||
@touch build/convert_swig_last_run
|
||||
|
||||
# prints the value of a makefile variable, example invocation "make print-TRICK_CXXFLAGS"
|
||||
# This rule is used by trick-config
|
||||
@ -95,6 +85,7 @@ print-%:
|
||||
|
||||
# Force S_define_exp to be remade each time this rule runs
|
||||
.PHONY: S_define_exp
|
||||
|
||||
S_define_exp:
|
||||
$(TRICK_CC) -E -C -xc++ ${TRICK_SFLAGS} $(TRICK_SYSTEM_SFLAGS) S_define > $@
|
||||
|
||||
@ -103,7 +94,7 @@ sie:
|
||||
@if [ -f build/Makefile_src ] ; then $(MAKE) --no-print-directory -f build/Makefile_src $@ ; else echo "No build/Makefile_src found" ; fi
|
||||
|
||||
help:
|
||||
@ echo -e "\
|
||||
@echo -e "\
|
||||
Simulation make options:\n\
|
||||
make [debug] [TRICK_VERBOSE_BUILD=1] - Makes everything: S_main and S_sie.resource\n\
|
||||
make sie - Builds the S_sie.resource file.\n\
|
||||
@ -121,12 +112,11 @@ clean: tidy
|
||||
-rm -f DP_Product/DP_rt_frame DP_Product/DP_rt_itimer
|
||||
-rm -f DP_Product/DP_rt_jobs DP_Product/DP_rt_timeline DP_Product/DP_mem_stats
|
||||
-rm -rf build trick
|
||||
@ echo "Removed build directory"
|
||||
|
||||
spotless: clean
|
||||
|
||||
apocalypse: clean
|
||||
@echo "[31mI love the smell of napalm in the morning[0m"
|
||||
$(info [31mI love the smell of napalm in the morning[0m)
|
||||
|
||||
CLEAN_RULES_DEFINED = 1
|
||||
|
||||
@ -135,4 +125,3 @@ CLEAN_RULES_DEFINED = 1
|
||||
-include build/Makefile_ICG
|
||||
-include build/Makefile_convert_swig
|
||||
-include build/Makefile_src_deps
|
||||
|
||||
|
@ -98,8 +98,8 @@ TRICK_EXT_LIB_DIRS :=
|
||||
# .NOTPARALLEL (a file-wide flag), significantly slowing the build process.
|
||||
|
||||
$(TRICKIFY_LIB_NAME): $(OBJECTS) | $(dir $(TRICKIFY_LIB_NAME))
|
||||
$(info $(call COLOR,Linking) $@)
|
||||
@ar rsc $@ $?
|
||||
$(info Built $@)
|
||||
|
||||
# $(OBJECTS) is meant to contain all of the py_* and io_* object file names. We can't construct
|
||||
# those until we run ICG and convert_swig. But we can't run the rules for ICG and convert_swig
|
||||
@ -159,9 +159,9 @@ $(dir $(TRICKIFY_LIB_NAME)) $(TRICKIFY_PYTHON_DIR):
|
||||
@mkdir -p $@
|
||||
|
||||
py_%.cpp: %.i | $(TRICKIFY_PYTHON_DIR)
|
||||
$(info SWIGing $<)
|
||||
$(info $(call COLOR,SWIGing) $<)
|
||||
@$(SWIG) $(TRICK_INCLUDE) $(TRICK_DEFINES) $(TRICK_VERSIONS) -c++ -python -includeall -ignoremissing -w201,362,389,451 -outdir $(TRICKIFY_PYTHON_DIR) -o $@ $<
|
||||
|
||||
%.o: %.cpp
|
||||
$(info Compiling $<)
|
||||
$(info $(call COLOR,Compiling) $<)
|
||||
@$(TRICK_CC) $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) $(PYTHON_INCLUDES) -std=c++11 -Wno-invalid-offsetof -Wno-shadow -Wno-unused-but-set-variable -c -o $@ $<
|
||||
|
@ -242,16 +242,16 @@ void FieldDescription::parseComment(std::string comment) {
|
||||
std::string new_units = map_trick_units_to_udunits(units) ;
|
||||
if ( units.compare(new_units) ) {
|
||||
if ( ! units_truth_is_scary ) {
|
||||
std::cout << "\033[33mUnits converted from [" << units << "] to [" << new_units << "] "
|
||||
<< file_name << ":" << line_no << "\033[0m" << std::endl ;
|
||||
std::cout << bold(color(WARNING, "Warning ") + file_name + ":" + std::to_string(line_no)) << std::endl
|
||||
<< " Units converted from " << quote(units) << " to " << quote(new_units) << std::endl;
|
||||
}
|
||||
units = new_units ;
|
||||
}
|
||||
ut_unit * test_units = ut_parse(u_system, units.c_str() , UT_ASCII) ;
|
||||
if ( test_units == NULL ) {
|
||||
// If the units are invalid write an error message and change the units to "1"
|
||||
std::cout << "\033[31mBad units specification [" << units << "] " << file_name << ":" << line_no
|
||||
<< "\033[0m" << std::endl ;
|
||||
std::cout << bold(color(WARNING, "Warning ") + file_name + ":" + std::to_string(line_no)) << std::endl
|
||||
<< " Invalid units specification. Changing " << quote(units) << " to " << quote("1") << std::endl;
|
||||
units = "1" ;
|
||||
} else {
|
||||
// If the units are valid, free the memory allocated by new_units.
|
||||
@ -262,8 +262,8 @@ void FieldDescription::parseComment(std::string comment) {
|
||||
}
|
||||
|
||||
if ( io == 4 ) {
|
||||
std::cout << "\033[33mWarning: " << file_name << ": line " << line_no << ": " <<
|
||||
"\"--\" is not a valid trick_io value. Setting to *io (3)\033[0m" << std::endl ;
|
||||
std::cout << bold(color(WARNING, "Warning ") + file_name + ":" + std::to_string(line_no)) << std::endl
|
||||
<< " -- is not a valid trick_io value. Setting to *io" << std::endl ;
|
||||
io = 3 ;
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ void HeaderSearchDirs::AddICGExcludeDirs () {
|
||||
icg_exclude_dirs.push_back(std::string(resolved_path));
|
||||
}
|
||||
} else {
|
||||
std::cout << "Cannot find TRICK_ICG_EXCLUDE directory " << item << std::endl ;
|
||||
std::cout << bold(color(WARNING, "Warning")) << " Cannot find TRICK_ICG_EXCLUDE directory " << quote(bold(item)) << std::endl ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -188,7 +188,7 @@ void HeaderSearchDirs::AddExcludeDirs () {
|
||||
exclude_dirs.push_back(std::string(resolved_path));
|
||||
}
|
||||
} else {
|
||||
std::cout << "Cannot find TRICK_ICG_EXCLUDE directory " << item << std::endl ;
|
||||
std::cout << bold(color(WARNING, "Warning")) << " Cannot find TRICK_EXCLUDE directory " << quote(bold(item)) << std::endl ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -210,7 +210,7 @@ void HeaderSearchDirs::AddExtLibDirs () {
|
||||
if ( resolved_path ) {
|
||||
ext_lib_dirs.push_back(std::string(resolved_path) + std::string("/"));
|
||||
} else {
|
||||
std::cout << "Cannot find TRICK_EXT_LIB_DIRS directory " << item << std::endl ;
|
||||
std::cout << bold(color(WARNING, "Warning")) << " Cannot find TRICK_EXT_LIB_DIRS directory " << quote(bold(item)) << std::endl ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -232,7 +232,7 @@ void HeaderSearchDirs::AddICGNoCommentDirs () {
|
||||
if ( resolved_path ) {
|
||||
icg_nocomment_dirs.push_back(std::string(resolved_path) + std::string("/"));
|
||||
} else {
|
||||
std::cout << "Cannot find TRICK_ICG_NOCOMMENT directory " << item << std::endl ;
|
||||
std::cout << bold(color(WARNING, "Warning")) << " Cannot find TRICK_ICG_NOCOMMENT directory " << quote(bold(item)) << std::endl ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -267,7 +267,7 @@ void HeaderSearchDirs::addSearchDirs ( std::vector<std::string> & include_dirs )
|
||||
ApplyHeaderSearchOptions() ;
|
||||
}
|
||||
|
||||
bool HeaderSearchDirs::isPathInUserDir (std::string in_dir ) {
|
||||
bool HeaderSearchDirs::isPathInUserDir (const std::string& in_dir ) {
|
||||
|
||||
clang::HeaderSearch::search_dir_iterator sdi ;
|
||||
for ( sdi = hs.system_dir_begin() ; sdi != hs.system_dir_end() ; sdi++ ) {
|
||||
@ -285,7 +285,7 @@ bool HeaderSearchDirs::isPathInUserDir (std::string in_dir ) {
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool HeaderSearchDirs::isPathInUserOrTrickDir (std::string in_dir ) {
|
||||
bool HeaderSearchDirs::isPathInUserOrTrickDir (const std::string& in_dir ) {
|
||||
|
||||
clang::HeaderSearch::search_dir_iterator sdi ;
|
||||
for ( sdi = hs.system_dir_begin() ; sdi != hs.system_dir_end() ; sdi++ ) {
|
||||
@ -297,7 +297,7 @@ bool HeaderSearchDirs::isPathInUserOrTrickDir (std::string in_dir ) {
|
||||
return true ;
|
||||
}
|
||||
|
||||
bool HeaderSearchDirs::isPathInExclude (std::string in_dir ) {
|
||||
bool HeaderSearchDirs::isPathInExclude (const std::string& in_dir ) {
|
||||
|
||||
std::vector<std::string>::iterator vit ;
|
||||
for ( vit = exclude_dirs.begin() ; vit != exclude_dirs.end() ; vit++ ) {
|
||||
@ -309,7 +309,7 @@ bool HeaderSearchDirs::isPathInExclude (std::string in_dir ) {
|
||||
return false ;
|
||||
}
|
||||
|
||||
bool HeaderSearchDirs::isPathInICGExclude (std::string in_dir ) {
|
||||
bool HeaderSearchDirs::isPathInICGExclude (const std::string& in_dir ) {
|
||||
|
||||
std::vector<std::string>::iterator vit ;
|
||||
for ( vit = icg_exclude_dirs.begin() ; vit != icg_exclude_dirs.end() ; vit++ ) {
|
||||
@ -321,7 +321,7 @@ bool HeaderSearchDirs::isPathInICGExclude (std::string in_dir ) {
|
||||
return false ;
|
||||
}
|
||||
|
||||
bool HeaderSearchDirs::isPathInExtLib (std::string in_dir ) {
|
||||
bool HeaderSearchDirs::isPathInExtLib (const std::string& in_dir ) {
|
||||
|
||||
std::vector<std::string>::iterator vit ;
|
||||
for ( vit = ext_lib_dirs.begin() ; vit != ext_lib_dirs.end() ; vit++ ) {
|
||||
@ -333,7 +333,7 @@ bool HeaderSearchDirs::isPathInExtLib (std::string in_dir ) {
|
||||
return false ;
|
||||
}
|
||||
|
||||
bool HeaderSearchDirs::isPathInICGNoComment (std::string in_file ) {
|
||||
bool HeaderSearchDirs::isPathInICGNoComment (const std::string& in_file ) {
|
||||
|
||||
char * resolved_path = almostRealPath(in_file.c_str() ) ;
|
||||
|
||||
@ -357,7 +357,7 @@ bool HeaderSearchDirs::isPathInICGNoComment (std::string in_file ) {
|
||||
return false ;
|
||||
}
|
||||
|
||||
std::string HeaderSearchDirs::getPathInExclude (std::string in_dir ) {
|
||||
std::string HeaderSearchDirs::getPathInExclude (const std::string& in_dir ) {
|
||||
|
||||
std::vector<std::string>::iterator vit ;
|
||||
for ( vit = exclude_dirs.begin() ; vit != exclude_dirs.end() ; vit++ ) {
|
||||
@ -369,7 +369,7 @@ std::string HeaderSearchDirs::getPathInExclude (std::string in_dir ) {
|
||||
return std::string() ;
|
||||
}
|
||||
|
||||
std::string HeaderSearchDirs::getPathInICGExclude (std::string in_dir ) {
|
||||
std::string HeaderSearchDirs::getPathInICGExclude (const std::string& in_dir ) {
|
||||
|
||||
std::vector<std::string>::iterator vit ;
|
||||
for ( vit = icg_exclude_dirs.begin() ; vit != icg_exclude_dirs.end() ; vit++ ) {
|
||||
@ -381,7 +381,7 @@ std::string HeaderSearchDirs::getPathInICGExclude (std::string in_dir ) {
|
||||
return std::string() ;
|
||||
}
|
||||
|
||||
std::string HeaderSearchDirs::getPathInExtLib (std::string in_dir ) {
|
||||
std::string HeaderSearchDirs::getPathInExtLib (const std::string& in_dir ) {
|
||||
|
||||
std::vector<std::string>::iterator vit ;
|
||||
for ( vit = ext_lib_dirs.begin() ; vit != ext_lib_dirs.end() ; vit++ ) {
|
||||
|
@ -39,59 +39,59 @@ class HeaderSearchDirs {
|
||||
@param path = directory path to be checked
|
||||
@return true = path is in user directory, false = path is not in a user dir.
|
||||
*/
|
||||
bool isPathInUserDir (std::string path) ;
|
||||
bool isPathInUserDir (const std::string& path) ;
|
||||
|
||||
/** Returns true if the path argument is in a user model or Trick directory
|
||||
@param path = directory path to be checked
|
||||
@return true = path is in user directory, false = path is not in a user dir.
|
||||
*/
|
||||
bool isPathInUserOrTrickDir (std::string path) ;
|
||||
bool isPathInUserOrTrickDir (const std::string& path) ;
|
||||
|
||||
/** Returns true if directory is a subdirectory of an excluded directory listed
|
||||
in the TRICK_EXCLUDE environment variable.
|
||||
@param path = directory path to be checked
|
||||
@return true = path is in a system directory, false = not in system directory.
|
||||
*/
|
||||
bool isPathInExclude (std::string path) ;
|
||||
bool isPathInExclude (const std::string& path) ;
|
||||
|
||||
/** Returns true if directory is a subdirectory of an excluded directory listed
|
||||
in the TRICK_ICG_EXCLUDE environment variable.
|
||||
@param path = directory path to be checked
|
||||
@return true = path is in a system directory, false = not in system directory.
|
||||
*/
|
||||
bool isPathInICGExclude (std::string path) ;
|
||||
bool isPathInICGExclude (const std::string& path) ;
|
||||
|
||||
/** Returns true if directory is a subdirectory of an external library directory listed
|
||||
in the TRICK_EXT_LIB_DIRS environment variable.
|
||||
@param path = directory path to be checked
|
||||
@return true = path is in a system directory, false = not in system directory.
|
||||
*/
|
||||
bool isPathInExtLib (std::string path) ;
|
||||
bool isPathInExtLib (const std::string& path) ;
|
||||
|
||||
/** Returns true if directory is a subdirectory of a no comment directory
|
||||
in the TRICK_ICG_NOCOMMENT environment variable.
|
||||
@param path = directory path to be checked
|
||||
@return true = path is in a system directory, false = not in system directory.
|
||||
*/
|
||||
bool isPathInICGNoComment (std::string path) ;
|
||||
bool isPathInICGNoComment (const std::string& path) ;
|
||||
|
||||
/** Returns the TRICK_EXCLUDE directory that contains the path argument.
|
||||
@param path = path to be checked
|
||||
@return string from TRICK_EXCLUDE that contains the path.
|
||||
*/
|
||||
std::string getPathInExclude (std::string path) ;
|
||||
std::string getPathInExclude (const std::string& path) ;
|
||||
|
||||
/** Returns the TRICK_ICG_EXCLUDE directory that contains the path argument.
|
||||
@param path = path to be checked
|
||||
@return string from TRICK_ICG_EXCLUDE that contains the path.
|
||||
*/
|
||||
std::string getPathInICGExclude (std::string path) ;
|
||||
std::string getPathInICGExclude (const std::string& path) ;
|
||||
|
||||
/** Returns the TRICK_EXT_LIB_DIRS directory that contains the path argument.
|
||||
@param path = path to be checked
|
||||
@return string from TRICK_ICG_EXCLUDE that contains the path.
|
||||
*/
|
||||
std::string getPathInExtLib (std::string path) ;
|
||||
std::string getPathInExtLib (const std::string& path) ;
|
||||
|
||||
/** Add all #defines from the command line and built in default predefines
|
||||
@param defines = a list of all -D<define> arguments on the command line.
|
||||
|
@ -78,45 +78,33 @@ static void _mkdir(const char *dir) {
|
||||
if(*p == '/') {
|
||||
*p = 0;
|
||||
if ( stat( tmp , &buf ) != 0 ) {
|
||||
if ( mkdir(tmp, S_IRWXU | S_IRWXG | S_IRWXO ) != 0 ) {
|
||||
std::cout << "[31mUnable to create " << tmp << " for writing.[00m" << std::endl ;
|
||||
int returnValue = mkdir(tmp, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
if (returnValue) {
|
||||
std::cout << bold(color(ERROR, "Error")) << " Unable to create " << quote(bold(tmp)) << " for writing: " << strerror(errno) << std::endl;
|
||||
return ;
|
||||
}
|
||||
}
|
||||
*p = '/';
|
||||
}
|
||||
if ( stat( tmp , &buf ) != 0 ) {
|
||||
if ( mkdir(tmp, S_IRWXU | S_IRWXG | S_IRWXO) ) {
|
||||
std::cout << "[31mUnable to create " << tmp << " for writing.[00m" << std::endl ;
|
||||
int returnValue = mkdir(tmp, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
if (returnValue) {
|
||||
std::cout << bold(color(ERROR, "Error")) << " Unable to create " << quote(bold(tmp)) << " for writing: " << strerror(errno) << std::endl;
|
||||
return ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool PrintAttributes::doesIODirectoryExist(std::string io_file_name) {
|
||||
// dirname alters the string so make a temporary copy of io_file_name
|
||||
char * temp_name = strdup(io_file_name.c_str()) ;
|
||||
char * dir_name ;
|
||||
struct stat buf ;
|
||||
bool ret = true ;
|
||||
|
||||
dir_name = dirname((char *)temp_name) ;
|
||||
|
||||
_mkdir(dir_name) ;
|
||||
free(temp_name) ;
|
||||
return ret ;
|
||||
}
|
||||
|
||||
// this is a subset of tests on the header file to determine if this file is not excluded for any reason.
|
||||
bool PrintAttributes::isFileIncluded(std::string header_file_name) {
|
||||
// several tests require the real path of the header file.
|
||||
char * rp = almostRealPath(header_file_name.c_str()) ;
|
||||
char * realPath = almostRealPath(header_file_name.c_str()) ;
|
||||
|
||||
if ( rp != NULL ) {
|
||||
if ( realPath != NULL ) {
|
||||
// Only include user directories (not system dirs like /usr/include)
|
||||
if ( hsd.isPathInUserDir(rp) ) {
|
||||
if ( hsd.isPathInUserDir(realPath) ) {
|
||||
// Don't process files in excluded directories
|
||||
if ( (hsd.isPathInExclude(rp) == false) and (hsd.isPathInICGExclude(rp) == false) ) {
|
||||
if ( (hsd.isPathInExclude(realPath) == false) and (hsd.isPathInICGExclude(realPath) == false) ) {
|
||||
// Only include files that do not have ICG: (No)
|
||||
// hasICGNo uses original header name, not the real path
|
||||
if ( ! cs.hasICGNo(header_file_name) ) {
|
||||
@ -128,84 +116,109 @@ bool PrintAttributes::isFileIncluded(std::string header_file_name) {
|
||||
return false ;
|
||||
}
|
||||
|
||||
bool PrintAttributes::openIOFile(std::string header_file_name) {
|
||||
// There are a lot of conditions to be met in order to open an io_src file. We store
|
||||
// the file names we have visited so we don't have to retest the file each time a new
|
||||
// class/enum is processed.
|
||||
if ( visited_files.find(header_file_name) == visited_files.end() ) {
|
||||
visited_files.insert(header_file_name) ;
|
||||
|
||||
// several tests require the real path of the header file.
|
||||
char * rp = almostRealPath(header_file_name.c_str()) ;
|
||||
|
||||
if ( rp != NULL ) {
|
||||
// Only include user directories (not system dirs like /usr/include)
|
||||
if ( hsd.isPathInUserDir(rp) ) {
|
||||
// Don't process files in excluded directories
|
||||
if ( hsd.isPathInExclude(rp) == false ) {
|
||||
if ( hsd.isPathInICGExclude(rp) == false ) {
|
||||
// Only include files that do not have ICG: (No)
|
||||
// hasICGNo uses original header name, not the real path
|
||||
if ( ! cs.hasICGNo(header_file_name) ) {
|
||||
// Don't process files in external library directories
|
||||
if ( hsd.isPathInExtLib(rp) == false ) {
|
||||
std::string io_file_name = createIOFileName(std::string(rp)) ;
|
||||
all_io_files[header_file_name] = io_file_name ;
|
||||
// Does the io_src directory exist or can we successfully mkdir it?
|
||||
if ( doesIODirectoryExist(io_file_name) ) {
|
||||
// Is the io_src file out of date or does not exist yet
|
||||
if ( isIOFileOutOfDate(rp, io_file_name) ) {
|
||||
// All conditions have been met. Store the io_src file name in out_of_date_io_files.
|
||||
out_of_date_io_files[header_file_name] = io_file_name ;
|
||||
free(rp) ;
|
||||
/* This is the first time we are visiting the file,
|
||||
open the file and write header information */
|
||||
outfile.open(out_of_date_io_files[header_file_name].c_str()) ;
|
||||
printer->printIOHeader(outfile, header_file_name) ;
|
||||
if ( ! cs.hasTrickHeader(header_file_name) ) {
|
||||
std::cout << "[33mNo Trick header comment found in " << header_file_name << "[00m" << std::endl ;
|
||||
}
|
||||
std::cout << "[35mWriting " << out_of_date_io_files[header_file_name] << "[00m" << std::endl ;
|
||||
// Get all of the ignored types from this file.
|
||||
ignored_types[header_file_name] = cs.getIgnoreTypes(header_file_name) ;
|
||||
return true ;
|
||||
}
|
||||
} else {
|
||||
std::cout << "[33mICG skipping " << rp << " (cannot create io_src dir)[00m" << std::endl ;
|
||||
}
|
||||
} else {
|
||||
std::cout << "[33mICG skipping " << rp << " (ext lib dir " <<
|
||||
hsd.getPathInExtLib(rp) << ")[00m" << std::endl ;
|
||||
ext_lib_io_files.insert(header_file_name) ;
|
||||
}
|
||||
} else {
|
||||
std::cout << "[33mICG skipping " << rp << " (ICG No found)[00m" << std::endl ;
|
||||
icg_no_files.push_back(rp) ;
|
||||
}
|
||||
} else {
|
||||
std::cout << "[33mICG skipping " << rp << " (ICG exclude " <<
|
||||
hsd.getPathInICGExclude(rp) << ")[00m" << std::endl ;
|
||||
}
|
||||
} else {
|
||||
std::cout << "[33mICG skipping " << rp << " (exclude " <<
|
||||
hsd.getPathInExclude(rp) << ")[00m" << std::endl ;
|
||||
}
|
||||
} else {
|
||||
//std::cout << "[33mICG skipping " << rp << " (not in user path) " << std::endl ;
|
||||
}
|
||||
free(rp) ;
|
||||
} else {
|
||||
std::cout << "[33mICG could not resolve realpath of " << header_file_name << "[00m" << std::endl ;
|
||||
}
|
||||
} else {
|
||||
/* We have visited this file before, if there is a valid io_file name, append to the io_file */
|
||||
if ( out_of_date_io_files.find(header_file_name) != out_of_date_io_files.end() ) {
|
||||
outfile.open(out_of_date_io_files[header_file_name].c_str(), std::fstream::app) ;
|
||||
bool PrintAttributes::openIOFile(const std::string& header_file_name) {
|
||||
/**
|
||||
* There are a lot of conditions to be met in order to open an IO file. We store the headers
|
||||
* we have visited so we don't have to retest the them each time a new class/enum is processed.
|
||||
*/
|
||||
if (visited_files.find(header_file_name) != visited_files.end()) {
|
||||
// We have visited this header before. If there is a valid name, append to the existing IO file.
|
||||
if (out_of_date_io_files.find(header_file_name) != out_of_date_io_files.end()) {
|
||||
outfile.open(out_of_date_io_files[header_file_name].c_str(), std::fstream::app);
|
||||
return true ;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// No io_file was opened.
|
||||
return false ;
|
||||
|
||||
// add it to the list of visited files
|
||||
visited_files.insert(header_file_name) ;
|
||||
|
||||
// several tests require the real path of the header file
|
||||
char* temp = almostRealPath(header_file_name.c_str());
|
||||
|
||||
if (!temp) {
|
||||
std::cout << bold(color(WARNING, "Warning")) << " ICG could not resolve realpath of " << quote(bold(header_file_name)) << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::string realPath = std::string(temp);
|
||||
const bool verboseBuild = getenv("TRICK_VERBOSE_BUILD");
|
||||
|
||||
/**
|
||||
* Exclude files:
|
||||
* - in system directories
|
||||
* - in TRICK_EXCLUDE directories
|
||||
* - in TRICK_ICG_EXCLUDE directories
|
||||
* - in TRICK_EXT_LIB_DIRS directories
|
||||
* - whose Trick header comments preclude ICG
|
||||
*/
|
||||
const std::string skipping = color(INFO, "Skipping ");
|
||||
|
||||
if (!hsd.isPathInUserDir(realPath)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (hsd.isPathInExclude(realPath)) {
|
||||
if (verboseBuild) {
|
||||
std::cout << skipping << "TRICK_EXCLUDE: " << underline(realPath, hsd.getPathInExclude(realPath).size()) << std::endl;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (hsd.isPathInICGExclude(realPath)) {
|
||||
if (verboseBuild) {
|
||||
std::cout << skipping << "TRICK_ICG_EXCLUDE: " << underline(realPath, hsd.getPathInICGExclude(realPath).size()) << std::endl;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (hsd.isPathInExtLib(realPath)) {
|
||||
if (verboseBuild) {
|
||||
std::cout << skipping << "TRICK_EXT_LIB_DIRS: " << underline(realPath, hsd.getPathInExtLib(realPath).size()) << std::endl;
|
||||
}
|
||||
ext_lib_io_files.insert(header_file_name) ;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cs.hasICGNo(header_file_name)) {
|
||||
if (verboseBuild) {
|
||||
std::cout << skipping << "ICG: (NO): " << realPath << std::endl;
|
||||
}
|
||||
icg_no_files.push_back(realPath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// map the header to its IO file
|
||||
const std::string io_file_name = createIOFileName(realPath) ;
|
||||
all_io_files[header_file_name] = io_file_name ;
|
||||
|
||||
// make the parent directories
|
||||
char* name = strdup(io_file_name.c_str());
|
||||
_mkdir(dirname(name));
|
||||
free(name);
|
||||
|
||||
// no further processing is required if it's not out of date
|
||||
if (!isIOFileOutOfDate(realPath, io_file_name)) {
|
||||
std::cout << "Not out of date: " << io_file_name << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// add it to the map of out of date IO files
|
||||
out_of_date_io_files[header_file_name] = io_file_name ;
|
||||
|
||||
// write header information
|
||||
std::cout << color(INFO, "Writing ") << out_of_date_io_files[header_file_name] << std::endl;
|
||||
outfile.open(out_of_date_io_files[header_file_name].c_str());
|
||||
printer->printIOHeader(outfile, header_file_name);
|
||||
if (!cs.hasTrickHeader(header_file_name) ) {
|
||||
std::cout << bold(color(WARNING, "Warning ") + header_file_name) << std::endl
|
||||
<< " No Trick header comment found" << std::endl;
|
||||
}
|
||||
|
||||
// get the ignored types from this header
|
||||
ignored_types[header_file_name] = cs.getIgnoreTypes(header_file_name) ;
|
||||
|
||||
return true ;
|
||||
}
|
||||
|
||||
/** Determines the io_file_name based on the given header file name */
|
||||
@ -280,12 +293,12 @@ void PrintAttributes::printClass( ClassValues * cv ) {
|
||||
}
|
||||
|
||||
// if we are successful in opening the map file
|
||||
char * rp = almostRealPath(cv->getFileName().c_str()) ;
|
||||
if ( rp != NULL ) {
|
||||
if ( isFileIncluded( cv->getFileName()) or hsd.isPathInExtLib(rp)) {
|
||||
char * realPath = almostRealPath(cv->getFileName().c_str()) ;
|
||||
if ( realPath != NULL ) {
|
||||
if ( isFileIncluded( cv->getFileName()) or hsd.isPathInExtLib(realPath)) {
|
||||
printer->printClassMap(class_map_outfile, cv) ;
|
||||
}
|
||||
free(rp) ;
|
||||
free(realPath) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -341,7 +354,7 @@ void PrintAttributes::createMapFiles() {
|
||||
if ( stat( map_dir.c_str() , &buf ) != 0 ) {
|
||||
if ( mkdir( map_dir.c_str() , 0755 ) != 0 ) {
|
||||
// dir does not exist and cannot make the directory.
|
||||
std::cout << "\033[31mUnable to create " << map_dir.c_str() << " for writing.\033[00m" << std::endl ;
|
||||
std::cout << bold(color(WARNING, "Warning")) << " Unable to create " << quote(bold(map_dir)) << " for writing" << std::endl ;
|
||||
}
|
||||
}
|
||||
|
||||
@ -381,27 +394,27 @@ void PrintAttributes::addEmptyFiles() {
|
||||
if ( visited_files.find(header_file_name) == visited_files.end() ) {
|
||||
visited_files.insert(header_file_name) ;
|
||||
// several tests require the real path of the header file.
|
||||
char * rp = almostRealPath(header_file_name.c_str()) ;
|
||||
if ( rp != NULL ) {
|
||||
char * realPath = almostRealPath(header_file_name.c_str()) ;
|
||||
if ( realPath != NULL ) {
|
||||
// Only include user directories (not system dirs like /usr/include)
|
||||
if ( hsd.isPathInUserDir(rp) ) {
|
||||
if ( hsd.isPathInExclude(rp) == false ) {
|
||||
if ( hsd.isPathInICGExclude(rp) == false ) {
|
||||
if ( hsd.isPathInUserDir(realPath) ) {
|
||||
if ( hsd.isPathInExclude(realPath) == false ) {
|
||||
if ( hsd.isPathInICGExclude(realPath) == false ) {
|
||||
// Only include files that do not have ICG: (No)
|
||||
// hasICGNo uses original header name, not the real path
|
||||
if ( ! cs.hasICGNo(header_file_name) ) {
|
||||
// Don't process files in excluded directories
|
||||
if ( hsd.isPathInExtLib(rp) == false ) {
|
||||
std::string io_file_name = createIOFileName(std::string(rp)) ;
|
||||
empty_header_files.insert(rp) ;
|
||||
if ( hsd.isPathInExtLib(realPath) == false ) {
|
||||
std::string io_file_name = createIOFileName(std::string(realPath)) ;
|
||||
empty_header_files.insert(realPath) ;
|
||||
} else {
|
||||
ext_lib_io_files.insert(rp) ;
|
||||
ext_lib_io_files.insert(realPath) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
free(rp) ;
|
||||
free(realPath) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -421,59 +434,50 @@ void PrintAttributes::printIOMakefile() {
|
||||
return ;
|
||||
}
|
||||
|
||||
std::cout << "[34mCreating/updating io_src Makefile[0m" << std::endl ;
|
||||
std::cout << color(INFO, "Writing") << " Makefile_io_src" << std::endl ;
|
||||
|
||||
makefile_io_src.open("build/Makefile_io_src") ;
|
||||
|
||||
makefile_io_src << "TRICK_SYSTEM_CXXFLAGS += -std=c++11" << std::endl ;
|
||||
makefile_io_src << "TRICK_SYSTEM_CXXFLAGS += \\" << std::endl ;
|
||||
makefile_io_src << " -Wno-invalid-offsetof \\" << std::endl ;
|
||||
makefile_io_src << " -Wno-old-style-cast \\" << std::endl ;
|
||||
makefile_io_src << " -Wno-write-strings \\" << std::endl ;
|
||||
makefile_io_src << " -Wno-unused-variable" << std::endl ;
|
||||
makefile_io_src << std::endl ;
|
||||
makefile_io_src << "ifeq ($(IS_CC_CLANG), 0)" << std::endl ;
|
||||
makefile_io_src << " TRICK_SYSTEM_CXXFLAGS += -Wno-unused-local-typedefs" << std::endl ;
|
||||
makefile_io_src << " TRICK_SYSTEM_CXXFLAGS += -Wno-unused-but-set-variable" << std::endl ;
|
||||
makefile_io_src << "endif" << std::endl ;
|
||||
makefile_io_src << std::endl ;
|
||||
makefile_io_src << "ifdef TRICK_VERBOSE_BUILD" << std::endl ;
|
||||
makefile_io_src << "PRINT_ICG =" << std::endl ;
|
||||
makefile_io_src << "PRINT_IO_COMPILE =" << std::endl ;
|
||||
makefile_io_src << "PRINT_IO_INC_LINK =" << std::endl ;
|
||||
makefile_io_src << "else" << std::endl ;
|
||||
makefile_io_src << "PRINT_ICG = @echo \"[34mRunning ICG[0m\"" << std::endl ;
|
||||
makefile_io_src << "PRINT_IO_COMPILE = @echo \"[34mCompiling [0m $(subst $(CURDIR)/build,build,$<)\"" << std::endl ;
|
||||
makefile_io_src << "PRINT_IO_INC_LINK = @echo \"[34mPartial link[0m io objects\"" << std::endl ;
|
||||
makefile_io_src << "endif" << std::endl ;
|
||||
makefile_io_src << std::endl ;
|
||||
|
||||
makefile_io_src << "IO_OBJ_FILES =" ;
|
||||
makefile_io_src << "TRICK_SYSTEM_CXXFLAGS += \\" << std::endl
|
||||
<< " -std=c++11 \\" << std::endl
|
||||
<< " -Wno-invalid-offsetof \\" << std::endl
|
||||
<< " -Wno-old-style-cast \\" << std::endl
|
||||
<< " -Wno-write-strings \\" << std::endl
|
||||
<< " -Wno-unused-variable" << std::endl
|
||||
<< std::endl
|
||||
<< "ifeq ($(IS_CC_CLANG), 0)" << std::endl
|
||||
<< " TRICK_SYSTEM_CXXFLAGS += -Wno-unused-local-typedefs -Wno-unused-but-set-variable" << std::endl
|
||||
<< "endif" << std::endl
|
||||
<< std::endl
|
||||
<< "ifndef TRICK_VERBOSE_BUILD" << std::endl
|
||||
<< " PRINT_IO_INC_LINK = @echo \"$(call COLOR,Linking) IO objects\"" << std::endl
|
||||
<< "endif" << std::endl
|
||||
<< std::endl
|
||||
<< "IO_OBJ_FILES =" ;
|
||||
|
||||
std::map< std::string , std::string >::iterator mit ;
|
||||
for ( mit = all_io_files.begin() ; mit != all_io_files.end() ; mit++ ) {
|
||||
size_t found ;
|
||||
found = (*mit).second.find_last_of(".") ;
|
||||
makefile_io_src << " \\\n $(CURDIR)/" << (*mit).second.substr(0,found) << ".o" ;
|
||||
makefile_io_src << " \\\n $(CURDIR)/" << (*mit).second.substr(0,found) << ".o" ;
|
||||
}
|
||||
|
||||
makefile_io_src << " \\\n $(CURDIR)/build/class_map.o" << std::endl ;
|
||||
makefile_io_src << std::endl ;
|
||||
|
||||
makefile_io_src << "$(IO_OBJ_FILES) : \%.o : \%.cpp" << std::endl ;
|
||||
makefile_io_src << "\t$(PRINT_IO_COMPILE)" << std::endl ;
|
||||
makefile_io_src << "\t$(ECHO_CMD)$(TRICK_CPPC) $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) -MMD -MP -c $< -o $@" << std::endl ;
|
||||
makefile_io_src << std::endl ;
|
||||
makefile_io_src << "-include $(IO_OBJ_FILES:.o=.d)" << std::endl ;
|
||||
makefile_io_src << std::endl ;
|
||||
|
||||
makefile_io_src << "OBJECTS += $(LIB_DIR)/io_src.o" << std::endl ;
|
||||
makefile_io_src << "LINK_OBJECTS += $(LIB_DIR)/io_src.o" << std::endl ;
|
||||
makefile_io_src << "$(S_MAIN) : $(LIB_DIR)/io_src.o" << std::endl ;
|
||||
makefile_io_src << std::endl ;
|
||||
makefile_io_src << "$(LIB_DIR)/io_src.o : $(IO_OBJ_FILES) | $(LIB_DIR)" << std::endl ;
|
||||
makefile_io_src << "\t$(PRINT_IO_INC_LINK)" << std::endl ;
|
||||
makefile_io_src << "\t$(ECHO_CMD)$(LD) $(LD_PARTIAL) -o $@ $(LD_FILELIST)build/link_io_objs" << std::endl ;
|
||||
makefile_io_src << std::endl ;
|
||||
makefile_io_src << " \\\n $(CURDIR)/build/class_map.o" << std::endl
|
||||
<< std::endl
|
||||
<< "$(IO_OBJ_FILES): \%.o : \%.cpp" << std::endl
|
||||
<< "\t$(PRINT_IO_COMPILE)" << std::endl
|
||||
<< "\t$(ECHO_CMD)$(TRICK_CPPC) $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) -MMD -MP -c $< -o $@" << std::endl
|
||||
<< std::endl
|
||||
<< "-include $(IO_OBJ_FILES:.o=.d)" << std::endl
|
||||
<< std::endl
|
||||
<< "OBJECTS += $(LIB_DIR)/io_src.o" << std::endl
|
||||
<< "LINK_OBJECTS += $(LIB_DIR)/io_src.o" << std::endl
|
||||
<< std::endl
|
||||
<< "$(S_MAIN): $(LIB_DIR)/io_src.o" << std::endl
|
||||
<< std::endl
|
||||
<< "$(LIB_DIR)/io_src.o : $(IO_OBJ_FILES) | $(LIB_DIR)" << std::endl
|
||||
<< "\t$(PRINT_IO_INC_LINK)" << std::endl
|
||||
<< "\t$(ECHO_CMD)$(LD) $(LD_PARTIAL) -o $@ $(LD_FILELIST)build/link_io_objs" << std::endl
|
||||
<< std::endl ;
|
||||
|
||||
makefile_io_src.close() ;
|
||||
|
||||
@ -489,25 +493,27 @@ void PrintAttributes::printIOMakefile() {
|
||||
makefile_ICG.open("build/Makefile_ICG") ;
|
||||
link_io_objs.open("build/link_io_objs") ;
|
||||
ICG_processed.open("build/ICG_processed") ;
|
||||
makefile_ICG << "$(CURDIR)/build/Makefile_io_src :" ;
|
||||
|
||||
makefile_ICG << "build/Makefile_io_src:" ;
|
||||
for ( mit = all_io_files.begin() ; mit != all_io_files.end() ; mit++ ) {
|
||||
makefile_ICG << "\\\n " << (*mit).first ;
|
||||
makefile_ICG << " \\\n " << (*mit).first ;
|
||||
size_t found ;
|
||||
found = (*mit).second.find_last_of(".") ;
|
||||
link_io_objs << (*mit).second.substr(0,found) << ".o" << std::endl ;
|
||||
ICG_processed << (*mit).first << std::endl ;
|
||||
}
|
||||
makefile_ICG.close() ;
|
||||
|
||||
// Create the list of empty (of classes/enums) header files to be written to ICG_processed.
|
||||
addEmptyFiles() ;
|
||||
std::set< std::string >::iterator sit ;
|
||||
for ( sit = empty_header_files.begin() ; sit != empty_header_files.end() ; sit++ ) {
|
||||
ICG_processed << (*sit) << std::endl ;
|
||||
}
|
||||
makefile_ICG << std::endl << std::endl ;
|
||||
makefile_ICG.close() ;
|
||||
ICG_processed.close() ;
|
||||
|
||||
link_io_objs << "build/class_map.o" << std::endl ;
|
||||
link_io_objs.close() ;
|
||||
ICG_processed.close() ;
|
||||
|
||||
ext_lib.open("build/ICG_ext_lib") ;
|
||||
for ( sit = ext_lib_io_files.begin() ; sit != ext_lib_io_files.end() ; sit++ ) {
|
||||
|
@ -89,11 +89,10 @@ class PrintAttributes {
|
||||
/** We are specifying an output directory for all files */
|
||||
std::string output_dir ;
|
||||
|
||||
bool openIOFile(std::string header_file_name) ;
|
||||
bool openIOFile(const std::string& header_file_name) ;
|
||||
|
||||
bool isFileIncluded(std::string header_file_name) ;
|
||||
bool isIOFileOutOfDate(std::string header_file_name, std::string io_file_name ) ;
|
||||
bool doesIODirectoryExist(std::string io_file_name ) ;
|
||||
|
||||
/** Adds empty header files to list of processed files. */
|
||||
void addEmptyFiles() ;
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <stdio.h>
|
||||
#include <libgen.h>
|
||||
#include <stdlib.h>
|
||||
#include <sstream>
|
||||
|
||||
#include "Utilities.hh"
|
||||
|
||||
@ -92,3 +93,31 @@ char * almostRealPath( const char * in_path ) {
|
||||
return final_path ;
|
||||
}
|
||||
|
||||
static const std::string escapeSequence = "[";
|
||||
static const std::string defaultForegroundColorSequence = escapeSequence + "39m";
|
||||
static const std::string boldSequence = escapeSequence + "1m";
|
||||
static const std::string noBoldSequence = escapeSequence + "21m";
|
||||
static const std::string underlineSequence = escapeSequence + "4m";
|
||||
static const std::string noUnderlineSequence = escapeSequence + "24m";
|
||||
|
||||
std::string color(const Color& color, const std::string& text) {
|
||||
std::ostringstream oss;
|
||||
oss << escapeSequence << color << "m" << text << defaultForegroundColorSequence;
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
std::string bold(const std::string& text) {
|
||||
return boldSequence + text + noBoldSequence;
|
||||
}
|
||||
|
||||
std::string underline(const std::string& text) {
|
||||
return underlineSequence + text + noUnderlineSequence;
|
||||
}
|
||||
|
||||
std::string underline(const std::string& text, unsigned length) {
|
||||
return underline(text.substr(0, length)) + text.substr(length);
|
||||
}
|
||||
|
||||
std::string quote(const std::string& text) {
|
||||
return "\"" + text + "\"";
|
||||
}
|
||||
|
@ -7,10 +7,22 @@
|
||||
#include "clang/Basic/SourceLocation.h"
|
||||
#include "HeaderSearchDirs.hh"
|
||||
|
||||
enum Color {
|
||||
ERROR = 31,
|
||||
WARNING = 33,
|
||||
INFO = 34
|
||||
};
|
||||
|
||||
std::string trim( const std::string& str, const std::string& whitespace = " \t\n\r" ) ;
|
||||
bool isInUserCode( clang::CompilerInstance & ci , clang::SourceLocation sl , HeaderSearchDirs & hsd ) ;
|
||||
bool isInUserOrTrickCode( clang::CompilerInstance & ci , clang::SourceLocation sl , HeaderSearchDirs & hsd ) ;
|
||||
std::string getFileName( clang::CompilerInstance & ci , clang::SourceLocation sl , HeaderSearchDirs & hsd ) ;
|
||||
char * almostRealPath( const char * in_path ) ;
|
||||
|
||||
std::string color(const Color& color, const std::string& text);
|
||||
std::string bold(const std::string& text);
|
||||
std::string underline(const std::string& text);
|
||||
std::string underline(const std::string& text, unsigned length);
|
||||
std::string quote(const std::string& text);
|
||||
|
||||
#endif
|
||||
|
@ -37,9 +37,8 @@ int Trick::Sie::process_sim_args() {
|
||||
/* If main is being invoked by the configuration processor (cp) to generate the sie resource file... */
|
||||
/* Generate the sie resource file */
|
||||
sie_print_xml();
|
||||
std::cout << "Created S_sie.resource file." << std::endl ;
|
||||
|
||||
// Silently exit the sim without printing the termination message
|
||||
// Silently exit the sim without printing the termination message
|
||||
exit(0) ;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user