diff --git a/Makefile b/Makefile index 8dd28b8e..a29314ba 100644 --- a/Makefile +++ b/Makefile @@ -82,14 +82,19 @@ ER7_UTILS_DIRS = \ ${ER7_UTILS_HOME}/trick/integration ER7_UTILS_OBJS = $(addsuffix /object_$(TRICK_HOST_CPU)/*.o ,$(ER7_UTILS_DIRS)) -UTILS_DIRS = \ +UTILS_DIRS := \ ${TRICK_HOME}/trick_source/trick_utils/interpolator \ ${TRICK_HOME}/trick_source/trick_utils/trick_adt \ ${TRICK_HOME}/trick_source/trick_utils/comm \ ${TRICK_HOME}/trick_source/trick_utils/shm \ ${TRICK_HOME}/trick_source/trick_utils/math \ ${TRICK_HOME}/trick_source/trick_utils/units -UTILS_OBJS = $(addsuffix /object_$(TRICK_HOST_CPU)/*.o ,$(UTILS_DIRS)) +UTILS_OBJS := $(addsuffix /object_$(TRICK_HOST_CPU)/*.o ,$(UTILS_DIRS)) + +# filter out the directories that make their own libraries +UTILS_OBJS := $(filter-out ${TRICK_HOME}/trick_source/trick_utils/comm/%, $(UTILS_OBJS)) +UTILS_OBJS := $(filter-out ${TRICK_HOME}/trick_source/trick_utils/math/%, $(UTILS_OBJS)) +UTILS_OBJS := $(filter-out ${TRICK_HOME}/trick_source/trick_utils/units/%, $(UTILS_OBJS)) #------------------------------------------------------------------------------- # Specify the contents of: libtrick_pyip.a diff --git a/include/trick/hs_msg.h b/include/trick/hs_msg.h deleted file mode 100644 index 009d2c02..00000000 --- a/include/trick/hs_msg.h +++ /dev/null @@ -1,31 +0,0 @@ - -#ifndef HS_MSG_H -#define HS_MSG_H - -#define MAX_MSG_SIZE 4096 - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - - char sim_name[48]; /* -- Sim/Task-group name msg is - coming from */ - char hostname[48]; /* -- Machine name msg is coming from */ - double ret; /* -- Run elapsed time */ - int parent_child_num; /* -- Parent or child process number */ - int msgsize; /* -- Size in bytes of following msg */ - char datebuff[32]; /* -- Date and time string */ - - /* NOTE: msg[MAX_MSG_SIZE] MUST be the LAST - * element of this structure - */ - char msg[MAX_MSG_SIZE]; /* -- the message */ -} HS_MSG; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/include/trick/tc.h b/include/trick/tc.h index d68cd877..e95a7307 100644 --- a/include/trick/tc.h +++ b/include/trick/tc.h @@ -13,54 +13,11 @@ PROGRAMMERS: #ifdef __WIN32__ # include # include +#else +# include #endif -#include - -#ifndef __WIN32__ -# include -# include -# include -# include -# include -# if (_POSIX_C_SOURCE) -# ifndef TCP_NODELAY -# define TCP_NODELAY 0x01 -# endif -# else -# include -# endif -# if ( __vxworks ) -# include -# include -# else -# if ( __Lynx__ ) -# include -# include -# define __NO_INCLUDE_WARN__ -# include -# undef __NO_INCLUDE_WARN__ -# else -# include -# include -# include -# include -# endif -# include -# include -# endif -# if ( __sun ) -# include -# endif -# if ( __CYGWIN__ ) -# include -# endif -#endif - -#include "trick_byteswap.h" -#include "trick_error_hndlr.h" - -#define TC_DEFAULT_PORT 5132 +#include "trick/trick_error_hndlr.h" #if (__linux) # define TC_NOSIGNAL MSG_NOSIGNAL @@ -105,7 +62,6 @@ PROGRAMMERS: # define TRICKCOMM_EPIPE WSAENOTCONN # define EWOULDBLOCK WSAEWOULDBLOCK # define CLOSE_SOCKET closesocket -# define IOCTL_SOCKET ioctlsocket # define tc_errno WSAGetLastError() int tc_StartWinSock(void); #else @@ -117,23 +73,14 @@ int tc_StartWinSock(void); # define TRICKCOMM_EAGAIN EAGAIN # define TRICKCOMM_EPIPE EPIPE # define CLOSE_SOCKET close -# define IOCTL_SOCKET ioctl # define tc_errno errno #endif /* Define a macro to yield the processor - TC_RELEASE() */ -#if ( __sgi ) -# define TC_RELEASE() sginap(0) -typedef int socket_t ; -#elif ( __linux | __CYGWIN__ | __vxworks | __APPLE__ | __Lynx__ | __QNX__ | __ghs | __INTERIX ) -# define TC_RELEASE() usleep(1) -#elif ( __sun ) -# define TC_RELEASE() { struct timeval timeout;\ - timeout.tv_sec = 0;\ - timeout.tv_usec = 0;\ - select(0,0,0,0,&timeout);} -#elif ( __WIN32__ ) +#if ( __WIN32__ ) # define TC_RELEASE() Sleep(0) +#else +# define TC_RELEASE() usleep(1) #endif #define TC_TAG_LENGTH 80 @@ -143,10 +90,6 @@ typedef int socket_t ; #define TC_MULT_PORT 12345 #define TC_MULT_GROUP "225.0.0.40" -#ifdef STAND_ALONE -#define send_hs fprintf -#endif - #ifdef __cplusplus extern "C" { #endif diff --git a/include/trick/tc_proto.h b/include/trick/tc_proto.h index d86ff15e..d1c59ecf 100644 --- a/include/trick/tc_proto.h +++ b/include/trick/tc_proto.h @@ -17,13 +17,8 @@ ICG: #define TC_PROTO_H #include -#include "tc.h" - -#ifdef STAND_ALONE -#include "attributes.h" -#else +#include "trick/tc.h" #include "trick/attributes.h" -#endif #ifdef __cplusplus extern "C" { diff --git a/share/trick/makefiles/Makefile.common b/share/trick/makefiles/Makefile.common index 0bbb4a2c..f5797097 100644 --- a/share/trick/makefiles/Makefile.common +++ b/share/trick/makefiles/Makefile.common @@ -133,6 +133,7 @@ TRICK_DEFINES = $(shell $(PERL) -e '@defines = "${TRICK_CFLAGS}" =~ /-D\s*(\S+)/ IO_SRC_DIR := io_src/ OBJ_DIR := object_${TRICK_HOST_CPU} +TRICK_LIBS = -Wl,-rpath=${TRICK_LIB_DIR} -L${TRICK_LIB_DIR} -ltrick -ltrick_pyip -ltrick_comm -ltrick_math -ltrick_units TRICK_STATIC_LIB := ${TRICK_LIB_DIR}/libtrick.a TRICK_RANLIB = diff --git a/share/trick/makefiles/config_Darwin.mk b/share/trick/makefiles/config_Darwin.mk index 766deeac..20bbd969 100644 --- a/share/trick/makefiles/config_Darwin.mk +++ b/share/trick/makefiles/config_Darwin.mk @@ -4,7 +4,6 @@ INSTALL = /usr/bin/install SHARED_LIB_OPT := -dynamiclib -Wl,-undefined,dynamic_lookup TRICK_LIB_DIR := ${TRICK_HOME}/lib -TRICK_LIBS := -Wl,-rpath,${TRICK_HOME}/lib -L${TRICK_LIB_DIR} -ltrick -ltrick_pyip TRICK_LDFLAGS += LD_WHOLE_ARCHIVE := -Wl,-all_load LD_NO_WHOLE_ARCHIVE := diff --git a/share/trick/makefiles/config_Linux.mk b/share/trick/makefiles/config_Linux.mk index 646b6bc8..20da47d0 100644 --- a/share/trick/makefiles/config_Linux.mk +++ b/share/trick/makefiles/config_Linux.mk @@ -15,7 +15,6 @@ TRICK_LIB_DIR := ${TRICK_HOME}/lib endif SHARED_LIB_OPT := -shared -TRICK_LIBS = -Wl,-rpath=${TRICK_HOME}/lib:${TRICK_HOME}/lib64 -L${TRICK_LIB_DIR} -ltrick -ltrick_pyip ifeq ($(MAKELEVEL),0) export TRICK_LDFLAGS += -Wl,--export-dynamic diff --git a/trick_source/sim_services/MasterSlave/MSSocket.cpp b/trick_source/sim_services/MasterSlave/MSSocket.cpp index ba0d5c5a..3ff57dbf 100644 --- a/trick_source/sim_services/MasterSlave/MSSocket.cpp +++ b/trick_source/sim_services/MasterSlave/MSSocket.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include "trick/MSSocket.hh" #include "trick/Master.hh" diff --git a/trick_source/sim_services/MasterSlave/Master.cpp b/trick_source/sim_services/MasterSlave/Master.cpp index bc36884e..26fe6ae6 100644 --- a/trick_source/sim_services/MasterSlave/Master.cpp +++ b/trick_source/sim_services/MasterSlave/Master.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include diff --git a/trick_source/sim_services/MonteCarlo/MonteCarlo_dispatch_run_to_slave.cpp b/trick_source/sim_services/MonteCarlo/MonteCarlo_dispatch_run_to_slave.cpp index 374d4ec8..3fdf6977 100644 --- a/trick_source/sim_services/MonteCarlo/MonteCarlo_dispatch_run_to_slave.cpp +++ b/trick_source/sim_services/MonteCarlo/MonteCarlo_dispatch_run_to_slave.cpp @@ -1,6 +1,7 @@ #include #include +#include #include "trick/MonteCarlo.hh" #include "trick/tc_proto.h" diff --git a/trick_source/sim_services/MonteCarlo/MonteCarlo_funcs.cpp b/trick_source/sim_services/MonteCarlo/MonteCarlo_funcs.cpp index 8fa5948a..f4338825 100644 --- a/trick_source/sim_services/MonteCarlo/MonteCarlo_funcs.cpp +++ b/trick_source/sim_services/MonteCarlo/MonteCarlo_funcs.cpp @@ -1,4 +1,6 @@ +#include + #include "trick/MonteCarlo.hh" #include "trick/memorymanager_c_intf.h" #include "trick/command_line_protos.h" diff --git a/trick_source/sim_services/MonteCarlo/MonteCarlo_master.cpp b/trick_source/sim_services/MonteCarlo/MonteCarlo_master.cpp index 8f0d43b0..3507842c 100644 --- a/trick_source/sim_services/MonteCarlo/MonteCarlo_master.cpp +++ b/trick_source/sim_services/MonteCarlo/MonteCarlo_master.cpp @@ -1,4 +1,6 @@ +#include + #include "trick/MonteCarlo.hh" #include "trick/ExecutiveException.hh" diff --git a/trick_source/sim_services/MonteCarlo/MonteCarlo_master_shutdown.cpp b/trick_source/sim_services/MonteCarlo/MonteCarlo_master_shutdown.cpp index 335f53c6..071b33ab 100644 --- a/trick_source/sim_services/MonteCarlo/MonteCarlo_master_shutdown.cpp +++ b/trick_source/sim_services/MonteCarlo/MonteCarlo_master_shutdown.cpp @@ -1,4 +1,6 @@ +#include + #include "trick/MonteCarlo.hh" #include "trick/command_line_protos.h" #include "trick/message_proto.h" diff --git a/trick_source/sim_services/VariableServer/VariableServerThread_loop.cpp b/trick_source/sim_services/VariableServer/VariableServerThread_loop.cpp index 4ff6d779..d0248cd1 100644 --- a/trick_source/sim_services/VariableServer/VariableServerThread_loop.cpp +++ b/trick_source/sim_services/VariableServer/VariableServerThread_loop.cpp @@ -5,6 +5,8 @@ #ifdef __linux #include #endif +#include + #include "trick/VariableServer.hh" #include "trick/variable_server_sync_types.h" diff --git a/trick_source/trick_utils/comm/Makefile b/trick_source/trick_utils/comm/Makefile index 063e27cd..9384925b 100644 --- a/trick_source/trick_utils/comm/Makefile +++ b/trick_source/trick_utils/comm/Makefile @@ -1,77 +1,9 @@ -ifdef TRICK_HOME -ifneq ($(STAND_ALONE), 1) - --include ${TRICK_HOME}/share/trick/makefiles/Makefile.common - -OBJECT_FILES = \ - $(OBJ_DIR)/tc_accept.o \ - $(OBJ_DIR)/tc_blockio.o \ - $(OBJ_DIR)/tc_broadcast_conninfo.o \ - $(OBJ_DIR)/tc_clock_init.o \ - $(OBJ_DIR)/tc_clock_time.o \ - $(OBJ_DIR)/tc_connect.o \ - $(OBJ_DIR)/tc_dev_copy.o \ - $(OBJ_DIR)/tc_disconnect.o \ - $(OBJ_DIR)/tc_error.o \ - $(OBJ_DIR)/tc_init.o \ - $(OBJ_DIR)/tc_isValid.o \ - $(OBJ_DIR)/tc_listen.o \ - $(OBJ_DIR)/tc_multiconnect.o \ - $(OBJ_DIR)/tc_pending.o \ - $(OBJ_DIR)/tc_read.o \ - $(OBJ_DIR)/tc_read_byteswap.o \ - $(OBJ_DIR)/tc_set_blockio.o \ - $(OBJ_DIR)/tc_write_byteswap.o \ - $(OBJ_DIR)/tc_write.o \ - $(OBJ_DIR)/tc_init_mcast_client.o \ - $(OBJ_DIR)/tc_init_mcast_server.o \ - $(OBJ_DIR)/tc_init_udp_client.o \ - $(OBJ_DIR)/tc_init_udp_server.o \ - $(OBJ_DIR)/trick_bswap_buffer.o \ - $(OBJ_DIR)/trick_byteswap.o \ - $(OBJ_DIR)/trick_error_hndlr.o - --include ${TRICK_HOME}/share/trick/makefiles/Makefile.tricklib +include ${TRICK_HOME}/share/trick/makefiles/Makefile.common +# set the TRICK_LIB variable to create a separate library for comm +TRICK_LIB := $(TRICK_LIB_DIR)/libtrick_comm.a +include ${TRICK_HOME}/share/trick/makefiles/Makefile.tricklib -include Makefile_deps -ifneq ($(DMTCP),) -TRICK_CFLAGS += -D_DMTCP -I$(DMTCP)/dmtcpaware -endif - -SEPARATE_LIBS = $(TRICK_LIB_DIR)/libtrick_comm.a - -default: $(SEPARATE_LIBS) -trick: $(SEPARATE_LIBS) - -stand_alone: - @ $(MAKE) STAND_ALONE=1 - -clean_stand_alone: - @ $(MAKE) STAND_ALONE=1 clean - -$(TRICK_LIB_DIR)/libtrick_comm.a : $(OBJECT_FILES) $(IO_OBJS) $(OBJ_DIR)_sa/stubs.o | $(TRICK_LIB_DIR) - ar cr $@ $(OBJECT_FILES) $(IO_OBJS) $(OBJ_DIR)_sa/stubs.o - -$(OBJ_DIR)_sa/stubs.o: $(SRC_DIR)stubs.c | $(OBJ_DIR)_sa - $(CD_CMD) $(TRICK_CC) $(TRICK_CFLAGS) -DSTAND_ALONE -c ${ -#include -#include -#include -#include - -#ifdef __WIN32__ -#include -#include -#else -#include -#endif - -#include "trick/hs_msg.h" - -#ifdef STAND_ALONE -int send_hs(FILE * fp, char *format, ...); -void exec_terminate(char *file, char *error); - -int send_hs( /* RETURN: -- -1 on failure , 0 for completion */ - FILE * fp, /* In: File pointer, (usually stderr) */ - char *format, /* In: Format of args */ - ...) -{ /* In: Variable length arg list */ - char *buf; - va_list args; - HS_MSG hs_msg; - time_t date; - - va_start(args, format); - - (void) gethostname(hs_msg.hostname, (size_t) 48); - - /* Get the current date and time */ - date = time(NULL); - strncpy(hs_msg.datebuff, asctime(localtime(&date)), (size_t) 27); - - /* Terminate the returned buffer which is always 24 chars long */ - hs_msg.datebuff[24] = '\0'; - - hs_msg.ret = 0.0; - hs_msg.parent_child_num = 0; - (void) strcpy(hs_msg.sim_name, " "); - - /* Copy the message to print out */ - (void) vsprintf(hs_msg.msg, format, args); - - /* Rebuild message, adding id tag */ - buf = (char *) malloc(strlen(hs_msg.msg) + 128); - sprintf(buf, "|%s|%s|%d|%.2f|%s| %s\n", - hs_msg.sim_name, hs_msg.hostname, hs_msg.parent_child_num, hs_msg.ret, hs_msg.datebuff, hs_msg.msg); - strcpy(hs_msg.msg, buf); - hs_msg.msgsize = strlen(hs_msg.msg); - - fprintf(fp, "%s\n", hs_msg.msg); - - free(buf); - - va_end(args); - - return (0); -} - -void exec_terminate(char *file, /* In: Path name to file in which error occurred. */ - char *error) -{ /* In: Error message */ - char outbuff[4096]; - - sprintf(outbuff, "\n" "TERMINATED IN\n" " ROUTINE: %s\n" " DIAGNOSTIC:\n" "%s\n" "\n", file, error); - - send_hs(stderr, "%s", outbuff); - - exit(0); -} -#endif diff --git a/trick_source/trick_utils/comm/src/tc_accept.c b/trick_source/trick_utils/comm/src/tc_accept.c index 7a122e7e..0406aef7 100644 --- a/trick_source/trick_utils/comm/src/tc_accept.c +++ b/trick_source/trick_utils/comm/src/tc_accept.c @@ -3,8 +3,15 @@ * Accept a connection from a communications client */ +#ifndef __WIN32__ +#include +#include +#include +#endif + #include "trick/tc.h" #include "trick/tc_proto.h" +#include "trick/trick_byteswap.h" #if _DMTCP #include diff --git a/trick_source/trick_utils/comm/src/tc_blockio.c b/trick_source/trick_utils/comm/src/tc_blockio.c index fb0bf0bb..ade19f51 100644 --- a/trick_source/trick_utils/comm/src/tc_blockio.c +++ b/trick_source/trick_utils/comm/src/tc_blockio.c @@ -1,4 +1,11 @@ +#ifndef __WIN32__ +# include +# define IOCTL_SOCKET ioctl +#else +# define IOCTL_SOCKET ioctlsocket +#endif + #include "trick/tc.h" #include "trick/tc_proto.h" diff --git a/trick_source/trick_utils/comm/src/tc_broadcast_conninfo.c b/trick_source/trick_utils/comm/src/tc_broadcast_conninfo.c index 49bad025..2d2d3ec5 100644 --- a/trick_source/trick_utils/comm/src/tc_broadcast_conninfo.c +++ b/trick_source/trick_utils/comm/src/tc_broadcast_conninfo.c @@ -3,6 +3,11 @@ * Broadcast Connection Information */ +#ifndef __WIN32__ +#include +#include +#endif + #include "trick/tc.h" #include "trick/tc_proto.h" diff --git a/trick_source/trick_utils/comm/src/tc_clock_init.c b/trick_source/trick_utils/comm/src/tc_clock_init.c index 654c2f75..5dab8a1f 100644 --- a/trick_source/trick_utils/comm/src/tc_clock_init.c +++ b/trick_source/trick_utils/comm/src/tc_clock_init.c @@ -3,7 +3,12 @@ * Get system clock reference time */ -#include "trick/tc.h" +#if __linux +#include +#else +#include +#endif + #include "trick/tc_proto.h" double tc_clock_init(void) diff --git a/trick_source/trick_utils/comm/src/tc_clock_time.c b/trick_source/trick_utils/comm/src/tc_clock_time.c index 7a2cc7ec..a5ed9dc1 100644 --- a/trick_source/trick_utils/comm/src/tc_clock_time.c +++ b/trick_source/trick_utils/comm/src/tc_clock_time.c @@ -3,7 +3,12 @@ * Get elapsed time since last call to tc_clock_init() */ -#include "trick/tc.h" +#ifdef __linux +#include +#else +#include +#endif + #include "trick/tc_proto.h" double tc_clock_time(double ref_time) diff --git a/trick_source/trick_utils/comm/src/tc_connect.c b/trick_source/trick_utils/comm/src/tc_connect.c index 2b094f7e..ff00eaff 100644 --- a/trick_source/trick_utils/comm/src/tc_connect.c +++ b/trick_source/trick_utils/comm/src/tc_connect.c @@ -3,8 +3,16 @@ * Establish a connection with a communications server */ +#ifndef __WIN32__ +#include +#include +#include +#include +#endif + #include "trick/tc.h" #include "trick/tc_proto.h" +#include "trick/trick_byteswap.h" #if _DMTCP #include diff --git a/trick_source/trick_utils/comm/src/tc_disconnect.c b/trick_source/trick_utils/comm/src/tc_disconnect.c index 4f59bb74..a640f344 100644 --- a/trick_source/trick_utils/comm/src/tc_disconnect.c +++ b/trick_source/trick_utils/comm/src/tc_disconnect.c @@ -3,6 +3,10 @@ * Disconnect a device */ +#ifndef __WIN32__ +#include +#endif + #include "trick/tc.h" #include "trick/tc_proto.h" diff --git a/trick_source/trick_utils/comm/src/tc_init.c b/trick_source/trick_utils/comm/src/tc_init.c index 41f63e94..48e26230 100644 --- a/trick_source/trick_utils/comm/src/tc_init.c +++ b/trick_source/trick_utils/comm/src/tc_init.c @@ -3,8 +3,16 @@ * Set up a device on which to listen for connections */ #include + +#ifndef __WIN32__ +#include +#include +#include +#endif + #include "trick/tc.h" #include "trick/tc_proto.h" +#include "trick/trick_byteswap.h" int tc_init(TCDevice * listen_device) { diff --git a/trick_source/trick_utils/comm/src/tc_init_mcast_client.c b/trick_source/trick_utils/comm/src/tc_init_mcast_client.c index 9b137e92..32ce9562 100644 --- a/trick_source/trick_utils/comm/src/tc_init_mcast_client.c +++ b/trick_source/trick_utils/comm/src/tc_init_mcast_client.c @@ -18,6 +18,7 @@ #include "trick/tc.h" #include "trick/tc_proto.h" +#include "trick/trick_byteswap.h" int tc_init_mcast_client(TCDevice * mcast_client_device) { diff --git a/trick_source/trick_utils/comm/src/tc_init_mcast_server.c b/trick_source/trick_utils/comm/src/tc_init_mcast_server.c index 604b2a09..978a6876 100644 --- a/trick_source/trick_utils/comm/src/tc_init_mcast_server.c +++ b/trick_source/trick_utils/comm/src/tc_init_mcast_server.c @@ -16,6 +16,7 @@ #include "trick/tc.h" #include "trick/tc_proto.h" +#include "trick/trick_byteswap.h" int tc_init_mcast_server(TCDevice * mcast_server_device) { diff --git a/trick_source/trick_utils/comm/src/tc_init_udp_client.c b/trick_source/trick_utils/comm/src/tc_init_udp_client.c index 6220bada..ecc7fcc6 100644 --- a/trick_source/trick_utils/comm/src/tc_init_udp_client.c +++ b/trick_source/trick_utils/comm/src/tc_init_udp_client.c @@ -13,14 +13,17 @@ PROGRAMMERS: (((M. Will) (L3-Com) (31 October 2006) (--) (CAIL))) */ -#include "trick/tc.h" -#include "trick/tc_proto.h" - -static struct sockaddr_in sockin; -#ifndef STAND_ALONE -extern int send_hs(FILE * fp, char *format, ...); +#ifndef __WIN32__ +#include +#include +#include #endif +#include "trick/tc.h" +#include "trick/tc_proto.h" +#include "trick/trick_byteswap.h" + +static struct sockaddr_in sockin; int tc_init_udp_client(TCDevice * udp_client_device) { @@ -94,7 +97,7 @@ int tc_init_udp_client(TCDevice * udp_client_device) // Works fine on tomacco running 2.6.9-42.0.2.ELsmp and // works fine on scum running 2.6.9-trick inet_ntop(AF_INET, h->h_addr_list[0], addr_list, (socklen_t) sizeof(addr_list)); // dpanter - send_hs(stderr, "%s: Initializing client for '%s' (IP : %s) \n", __FILE__, h->h_name, addr_list); + fprintf(stderr, "%s: Initializing client for '%s' (IP : %s) \n", __FILE__, h->h_name, addr_list); } udp_client_device->remoteServAddr.sin_family = h->h_addrtype; diff --git a/trick_source/trick_utils/comm/src/tc_init_udp_server.c b/trick_source/trick_utils/comm/src/tc_init_udp_server.c index efeb8160..0862c2cd 100644 --- a/trick_source/trick_utils/comm/src/tc_init_udp_server.c +++ b/trick_source/trick_utils/comm/src/tc_init_udp_server.c @@ -13,8 +13,13 @@ PROGRAMMERS: (((M. Will) (L3-Com) (31 October 2006) (--) (CAIL))) */ +#ifndef __WIN32__ +#include +#endif + #include "trick/tc.h" #include "trick/tc_proto.h" +#include "trick/trick_byteswap.h" int tc_init_udp_server( /* RETURN: -- 0 for success */ TCDevice * udp_server_device) diff --git a/trick_source/trick_utils/comm/src/tc_isValid.c b/trick_source/trick_utils/comm/src/tc_isValid.c index 36338da8..e0c9421e 100644 --- a/trick_source/trick_utils/comm/src/tc_isValid.c +++ b/trick_source/trick_utils/comm/src/tc_isValid.c @@ -3,6 +3,10 @@ * Check to see if a device is valid */ +#ifndef __WIN32__ +#include +#endif + #include "trick/tc.h" #include "trick/tc_proto.h" diff --git a/trick_source/trick_utils/comm/src/tc_multiconnect.c b/trick_source/trick_utils/comm/src/tc_multiconnect.c index 9471c558..0e355546 100644 --- a/trick_source/trick_utils/comm/src/tc_multiconnect.c +++ b/trick_source/trick_utils/comm/src/tc_multiconnect.c @@ -3,23 +3,18 @@ * Multicast connect */ -#include "trick/tc.h" -#include "trick/tc_proto.h" #include #ifdef __WIN32__ #include #else +#include +#include #include #endif +#include -#if ( __sgi && _POSIX_C_SOURCE) -/* If _POSIX_C_SOURCE is defined on IRIX systems, ip_mreq is not defined so define the structure so we can use - multicast ports */ -struct ip_mreq { - struct in_addr imr_multiaddr; /* IP multicast address of group */ - struct in_addr imr_interface; /* local IP address of interface */ -}; -#endif +#include "trick/tc.h" +#include "trick/tc_proto.h" int tc_multiconnect(TCDevice * dev_ptr, char *my_tag, char *other_tag, TrickErrorHndlr * not_used) { diff --git a/trick_source/trick_utils/comm/src/tc_pending.c b/trick_source/trick_utils/comm/src/tc_pending.c index 523ea52e..82e314fe 100644 --- a/trick_source/trick_utils/comm/src/tc_pending.c +++ b/trick_source/trick_utils/comm/src/tc_pending.c @@ -3,6 +3,13 @@ * See if data is available for reading on a non-blocking connection */ +#ifndef __WIN32__ +# include +# define IOCTL_SOCKET ioctl +#else +# define IOCTL_SOCKET ioctlsocket +#endif + #include "trick/tc.h" #include "trick/tc_proto.h" diff --git a/trick_source/trick_utils/comm/src/tc_read.c b/trick_source/trick_utils/comm/src/tc_read.c index b224e70d..3a27fc3b 100644 --- a/trick_source/trick_utils/comm/src/tc_read.c +++ b/trick_source/trick_utils/comm/src/tc_read.c @@ -3,6 +3,11 @@ * Read data from a device */ +#ifndef __WIN32__ +#include +#include +#endif + #include "trick/tc.h" #include "trick/tc_proto.h" diff --git a/trick_source/trick_utils/comm/src/tc_read_byteswap.c b/trick_source/trick_utils/comm/src/tc_read_byteswap.c index 512f651f..85205764 100644 --- a/trick_source/trick_utils/comm/src/tc_read_byteswap.c +++ b/trick_source/trick_utils/comm/src/tc_read_byteswap.c @@ -6,6 +6,7 @@ #include "trick/tc.h" #include "trick/tc_proto.h" +#include "trick/trick_byteswap.h" int tc_read_byteswap(TCDevice * device, char *buffer, int size, ATTRIBUTES * attr) { diff --git a/trick_source/trick_utils/comm/src/tc_write.c b/trick_source/trick_utils/comm/src/tc_write.c index 82df6255..eca1aafe 100644 --- a/trick_source/trick_utils/comm/src/tc_write.c +++ b/trick_source/trick_utils/comm/src/tc_write.c @@ -3,6 +3,11 @@ * Write data to a device */ +#ifndef __WIN32__ +#include +#include +#endif + #include "trick/tc.h" #include "trick/tc_proto.h" diff --git a/trick_source/trick_utils/comm/src/tc_write_byteswap.c b/trick_source/trick_utils/comm/src/tc_write_byteswap.c index 872bcaec..f5f443cc 100644 --- a/trick_source/trick_utils/comm/src/tc_write_byteswap.c +++ b/trick_source/trick_utils/comm/src/tc_write_byteswap.c @@ -6,6 +6,7 @@ #include "trick/tc.h" #include "trick/tc_proto.h" +#include "trick/trick_byteswap.h" int tc_write_byteswap(TCDevice * device, char *buffer, int size, ATTRIBUTES * attr) { diff --git a/trick_source/trick_utils/comm/src/trick_bswap_buffer.c b/trick_source/trick_utils/comm/src/trick_bswap_buffer.c index 09d55fe0..0591d8a0 100644 --- a/trick_source/trick_utils/comm/src/trick_bswap_buffer.c +++ b/trick_source/trick_utils/comm/src/trick_bswap_buffer.c @@ -1,25 +1,17 @@ #include -#ifdef STAND_ALONE -#define TRICK_STRUCTURED 103 -#define TRICK_BITFIELD 11 -#define TRICK_UNSIGNED_BITFIELD 12 -#include "trick/attributes.h" -#include "trick/trick_byteswap.h" -#else #include "trick/attributes.h" #include "trick/parameter_types.h" #include "trick/trick_byteswap.h" -#endif - #include "trick/tc_proto.h" -/* - * tofrom: 1 = to. - * Use 1 (to) before writing data. Converts to the other endian + +/* + * tofrom: 1 = to. + * Use 1 (to) before writing data. Converts to the other endian * - * tofrom: 0 = from. - * Use 0 (from) after reading data. Converts from the other endian + * tofrom: 0 = from. + * Use 0 (from) after reading data. Converts from the other endian */ void *trick_bswap_buffer(void *out, void *in, ATTRIBUTES * attr, int tofrom) diff --git a/trick_source/trick_utils/comm/src/trick_byteswap.c b/trick_source/trick_utils/comm/src/trick_byteswap.c index af03d3a7..82c96c42 100644 --- a/trick_source/trick_utils/comm/src/trick_byteswap.c +++ b/trick_source/trick_utils/comm/src/trick_byteswap.c @@ -13,11 +13,7 @@ PROGRAMMERS: (((Jane B. Falgout) (LinCom) (08 May 98) (--) (generic HC))) */ -#ifdef STAND_ALONE #include "trick/trick_byteswap.h" -#else -#include "trick/trick_byteswap.h" -#endif /* (note from ISP developers) Normally this routine would just zip through the double a byte at a time and reassign them, but the optimizing compiler on the alpha core dumps on this file, after many iterations this "reloading" of diff --git a/trick_source/trick_utils/comm/src/trick_error_hndlr.c b/trick_source/trick_utils/comm/src/trick_error_hndlr.c index fb4d0522..a95d1659 100644 --- a/trick_source/trick_utils/comm/src/trick_error_hndlr.c +++ b/trick_source/trick_utils/comm/src/trick_error_hndlr.c @@ -25,14 +25,7 @@ #endif #include "trick/trick_error_hndlr.h" -#include "trick/tc.h" - -#ifndef STAND_ALONE -extern int send_hs( /* Return: -1 on failure , 0 for completion */ - FILE * fp, /* In: File pointer, (usually stderr) */ - char *format, /* In: Format of args */ - ...); /* In: Variable length arg list */ -#endif +//#include "trick/tc.h" static TrickErrorHndlr trick_error_hndlr_default = { (TrickErrorFuncPtr) trick_error_func_default, @@ -45,7 +38,6 @@ static TrickErrorHndlr trick_error_hndlr_default = { }; static void trick_error_message_print(FILE * out_stream, /* Inout: Output stream on which to print. */ - int use_send_hs, /* In: 1 = use send_hs; else use fprintf */ TrickErrorLevel level, /* In: Error level. */ char *file, /* In: File in which error ocurred. */ int line, /* In: Line in file in which error ocurred. */ @@ -55,51 +47,26 @@ static void trick_error_message_print(FILE * out_stream, /* Inout: Output "WARNING", "ALERT", "FATAL", "ABORT", "SILENT" }; - if (use_send_hs == 1) { - /* Print message to the output stream. */ - if (msg != (char *) NULL) { - if (file != (char *) NULL) { - if (line > 0) { - send_hs(out_stream, "\n %s: %s:%d: %s\n", label[level], file, line, msg); - } else { - send_hs(out_stream, "\n %s: %s: %s\n", label[level], msg, file); - } + /* Print message to the output stream. */ + if (msg != (char *) NULL) { + if (file != (char *) NULL) { + if (line > 0) { + fprintf(out_stream, "\n %s: %s:%d: %s\n", label[level], file, line, msg); } else { - send_hs(out_stream, "\n %s: %s", label[level], msg); + fprintf(out_stream, "\n %s: %s: %s\n", label[level], msg, file); } } else { - if (file != (char *) NULL) { - if (line > 0) { - send_hs(out_stream, "\n %s: found near line %d " "of file: %s\n", label[level], line, file); - } else { - send_hs(out_stream, "\n %s: found in file: %s\n", label[level], file); - } - } else { - send_hs(out_stream, "\n %s: an undescribed error was " "reported.\n", label[level]); - } + fprintf(out_stream, "\n %s: %s", label[level], msg); } } else { - /* Print message to the output stream. */ - if (msg != (char *) NULL) { - if (file != (char *) NULL) { - if (line > 0) { - fprintf(out_stream, "\n %s: %s:%d: %s\n", label[level], file, line, msg); - } else { - fprintf(out_stream, "\n %s: %s: %s\n", label[level], msg, file); - } + if (file != (char *) NULL) { + if (line > 0) { + fprintf(out_stream, "\n %s: found near line %d of " "file: %s\n", label[level], line, file); } else { - fprintf(out_stream, "\n %s: %s", label[level], msg); + fprintf(out_stream, "\n %s: found in file: %s\n", label[level], file); } } else { - if (file != (char *) NULL) { - if (line > 0) { - fprintf(out_stream, "\n %s: found near line %d of " "file: %s\n", label[level], line, file); - } else { - fprintf(out_stream, "\n %s: found in file: %s\n", label[level], file); - } - } else { - fprintf(out_stream, "\n %s: an undescribed error was " "reported.\n", label[level]); - } + fprintf(out_stream, "\n %s: an undescribed error was " "reported.\n", label[level]); } } @@ -132,16 +99,14 @@ void trick_error_func_default(TrickErrorHndlr * error_hndlr, /* In: Error obj if (error_hndlr->report_stream[level] == (FILE *) NULL) { error_hndlr->report_stream[level] = stderr; } - trick_error_message_print(error_hndlr->report_stream[level], - error_hndlr->use_send_hs[level], level, file, line, msg); + trick_error_message_print(error_hndlr->report_stream[level], level, file, line, msg); break; case TRICK_ERROR_ABORT: if (error_hndlr->report_stream[level] == (FILE *) NULL) { error_hndlr->report_stream[level] = stderr; } - trick_error_message_print(error_hndlr->report_stream[level], - error_hndlr->use_send_hs[level], level, file, line, msg); + trick_error_message_print(error_hndlr->report_stream[level], level, file, line, msg); abort(); break; @@ -149,8 +114,7 @@ void trick_error_func_default(TrickErrorHndlr * error_hndlr, /* In: Error obj if (error_hndlr->report_stream[level] == (FILE *) NULL) { error_hndlr->report_stream[level] = stderr; } - trick_error_message_print(error_hndlr->report_stream[level], - error_hndlr->use_send_hs[level], level, file, line, msg); + trick_error_message_print(error_hndlr->report_stream[level], level, file, line, msg); exit((int) level); break; @@ -158,48 +122,42 @@ void trick_error_func_default(TrickErrorHndlr * error_hndlr, /* In: Error obj if (error_hndlr->report_stream[level] == (FILE *) NULL) { error_hndlr->report_stream[level] = stderr; } - trick_error_message_print(error_hndlr->report_stream[level], - error_hndlr->use_send_hs[level], level, file, line, msg); + trick_error_message_print(error_hndlr->report_stream[level], level, file, line, msg); break; case TRICK_ERROR_WARNING: if (error_hndlr->report_stream[level] == (FILE *) NULL) { error_hndlr->report_stream[level] = stderr; } - trick_error_message_print(error_hndlr->report_stream[level], - error_hndlr->use_send_hs[level], level, file, line, msg); + trick_error_message_print(error_hndlr->report_stream[level], level, file, line, msg); break; case TRICK_ERROR_CAUTION: if (error_hndlr->report_stream[level] == (FILE *) NULL) { error_hndlr->report_stream[level] = stderr; } - trick_error_message_print(error_hndlr->report_stream[level], - error_hndlr->use_send_hs[level], level, file, line, msg); + trick_error_message_print(error_hndlr->report_stream[level], level, file, line, msg); break; case TRICK_ERROR_ADVISORY: if (error_hndlr->report_stream[level] == (FILE *) NULL) { error_hndlr->report_stream[level] = stderr; } - trick_error_message_print(error_hndlr->report_stream[level], - error_hndlr->use_send_hs[level], level, file, line, msg); + trick_error_message_print(error_hndlr->report_stream[level], level, file, line, msg); break; case TRICK_ERROR_TRIVIAL: if (error_hndlr->report_stream[level] == (FILE *) NULL) { error_hndlr->report_stream[level] = stderr; } - trick_error_message_print(error_hndlr->report_stream[level], - error_hndlr->use_send_hs[level], level, file, line, msg); + trick_error_message_print(error_hndlr->report_stream[level], level, file, line, msg); break; case TRICK_ERROR_ALL: if (error_hndlr->report_stream[level] == (FILE *) NULL) { error_hndlr->report_stream[level] = stderr; } - trick_error_message_print(error_hndlr->report_stream[level], - error_hndlr->use_send_hs[level], level, file, line, msg); + trick_error_message_print(error_hndlr->report_stream[level], level, file, line, msg); break; default: @@ -208,12 +166,10 @@ void trick_error_func_default(TrickErrorHndlr * error_hndlr, /* In: Error obj msg_buf = (char *) malloc(strlen(msg) + strlen(unknown) + 2); strcpy(msg_buf, unknown); strcat(msg_buf, msg); - trick_error_message_print(stderr, - error_hndlr->use_send_hs[level], TRICK_ERROR_ALERT, file, line, msg_buf); + trick_error_message_print(stderr, TRICK_ERROR_ALERT, file, line, msg_buf); free(msg_buf); } else { - trick_error_message_print(stderr, - error_hndlr->use_send_hs[level], TRICK_ERROR_ALERT, file, line, unknown); + trick_error_message_print(stderr, TRICK_ERROR_ALERT, file, line, unknown); } break; @@ -482,6 +438,11 @@ void trick_error_set_send_hs_flag(TrickErrorHndlr * error_hndlr, /* Inout /* Set the appropriate use_send_hs flag */ error_hndlr->use_send_hs[level] = use_send_hs; + /* warn the user that send_hs has been replaced with fprintf */ + trick_error_report(error_hndlr, TRICK_ERROR_ALERT, + __FILE__, __LINE__, + "trick_error_set_send_hs_flag no longer supported. All printouts will use fprintf\n"); + return; } diff --git a/trick_source/trick_utils/comm/test/Makefile b/trick_source/trick_utils/comm/test/Makefile index f48a0211..afecfebe 100644 --- a/trick_source/trick_utils/comm/test/Makefile +++ b/trick_source/trick_utils/comm/test/Makefile @@ -4,7 +4,9 @@ include ${TRICK_HOME}/share/trick/makefiles/Makefile.tricklib INCLUDE_DIRS = -I$(GTEST_HOME) -I$(GTEST_HOME)/include -I$(TRICK_HOME)/include -TRICK_LIBS := ${TRICK_LIB_DIR}/libtrick.a +# Use the trick_comm library only. libtrick.a would also work. +TRICK_LIBS := ${TRICK_LIB_DIR}/libtrick_comm.a + TRICK_EXEC_LINK_LIBS += ${GTEST_HOME}/lib/libgtest.a ${GTEST_HOME}/lib/libgtest_main.a TRICK_CXXFLAGS += ${INCLUDE_DIRS} -g -Wall -Wextra -DGTEST_HAS_TR1_TUPLE=0 @@ -13,8 +15,6 @@ TRICK_CXXFLAGS += ${INCLUDE_DIRS} -g -Wall -Wextra -DGTEST_HAS_TR1_TUPLE=0 TESTS = comm_test TEST_CPP = $(subst $(OBJ_DIR)/,,$(subst .o,.cpp,$(CPP_OBJS))) -OTHER_OBJECTS = ../../../sim_services/include/object_${TRICK_HOST_CPU}/io_SimObject.o - default : all all : objects $(TESTS) @@ -31,5 +31,5 @@ clean_test : $(RM) -rf $(TESTS) $(TESTS) : $(CPP_OBJS) - $(TRICK_LD) $(TRICK_CXXFLAGS) -o $@ $^ $(OTHER_OBJECTS) $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS) + $(TRICK_LD) $(TRICK_CXXFLAGS) -o $@ $^ $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS) diff --git a/trick_source/trick_utils/comm/test/TCBlockioTest.cpp b/trick_source/trick_utils/comm/test/TCBlockioTest.cpp index 4ddab19d..8be0d946 100644 --- a/trick_source/trick_utils/comm/test/TCBlockioTest.cpp +++ b/trick_source/trick_utils/comm/test/TCBlockioTest.cpp @@ -2,7 +2,6 @@ #include #include "trick/tc.h" #include "trick/attributes.h" -#include "trick/hs_msg.h" #include "trick/tc_proto.h" #include "trick/trick_byteswap.h" #include "trick/trick_error_hndlr.h" diff --git a/trick_source/trick_utils/comm/test/TCConnectTest.cpp b/trick_source/trick_utils/comm/test/TCConnectTest.cpp index d9f92d7f..d936c534 100644 --- a/trick_source/trick_utils/comm/test/TCConnectTest.cpp +++ b/trick_source/trick_utils/comm/test/TCConnectTest.cpp @@ -4,7 +4,6 @@ #include "trick/tc.h" #include "trick/tc_proto.h" #include "trick/attributes.h" -#include "trick/hs_msg.h" #include "trick/trick_byteswap.h" #include "trick/trick_error_hndlr.h" diff --git a/trick_source/trick_utils/comm/test/TCDevCopyTest.cpp b/trick_source/trick_utils/comm/test/TCDevCopyTest.cpp index 9dfc2a9a..e6473242 100644 --- a/trick_source/trick_utils/comm/test/TCDevCopyTest.cpp +++ b/trick_source/trick_utils/comm/test/TCDevCopyTest.cpp @@ -3,7 +3,6 @@ #include "trick/tc.h" #include "trick/attributes.h" -#include "trick/hs_msg.h" #include "trick/tc_proto.h" #include "trick/trick_byteswap.h" #include "trick/trick_error_hndlr.h" diff --git a/trick_source/trick_utils/comm/test/TCDisconnectTest.cpp b/trick_source/trick_utils/comm/test/TCDisconnectTest.cpp index b216ff81..0b9bedb3 100644 --- a/trick_source/trick_utils/comm/test/TCDisconnectTest.cpp +++ b/trick_source/trick_utils/comm/test/TCDisconnectTest.cpp @@ -3,7 +3,6 @@ #include "trick/tc.h" #include "trick/attributes.h" -#include "trick/hs_msg.h" #include "trick/tc_proto.h" #include "trick/trick_byteswap.h" #include "trick/trick_error_hndlr.h" diff --git a/trick_source/trick_utils/comm/test/TCErrorTest.cpp b/trick_source/trick_utils/comm/test/TCErrorTest.cpp index 9fa4d89f..39f14143 100644 --- a/trick_source/trick_utils/comm/test/TCErrorTest.cpp +++ b/trick_source/trick_utils/comm/test/TCErrorTest.cpp @@ -3,7 +3,6 @@ #include "trick/tc.h" #include "trick/attributes.h" -#include "trick/hs_msg.h" #include "trick/tc_proto.h" #include "trick/trick_byteswap.h" #include "trick/trick_error_hndlr.h" diff --git a/trick_source/trick_utils/comm/test/TCIsValidTest.cpp b/trick_source/trick_utils/comm/test/TCIsValidTest.cpp index 59dbe98e..73522aa1 100644 --- a/trick_source/trick_utils/comm/test/TCIsValidTest.cpp +++ b/trick_source/trick_utils/comm/test/TCIsValidTest.cpp @@ -4,7 +4,6 @@ #include "trick/tc.h" #include "trick/tc_proto.h" #include "trick/attributes.h" -#include "trick/hs_msg.h" #include "trick/trick_byteswap.h" #include "trick/trick_error_hndlr.h" diff --git a/trick_source/trick_utils/comm/test/TCPendingTest.cpp b/trick_source/trick_utils/comm/test/TCPendingTest.cpp index e3b35f1c..6e860e16 100644 --- a/trick_source/trick_utils/comm/test/TCPendingTest.cpp +++ b/trick_source/trick_utils/comm/test/TCPendingTest.cpp @@ -3,7 +3,6 @@ #include "trick/tc.h" #include "trick/attributes.h" -#include "trick/hs_msg.h" #include "trick/tc_proto.h" #include "trick/trick_byteswap.h" #include "trick/trick_error_hndlr.h" diff --git a/trick_source/trick_utils/comm/test/TCReadByteSwapTest.cpp b/trick_source/trick_utils/comm/test/TCReadByteSwapTest.cpp index 3e7ec9de..40a340a6 100644 --- a/trick_source/trick_utils/comm/test/TCReadByteSwapTest.cpp +++ b/trick_source/trick_utils/comm/test/TCReadByteSwapTest.cpp @@ -3,7 +3,6 @@ #include "trick/tc.h" #include "trick/attributes.h" -#include "trick/hs_msg.h" #include "trick/tc_proto.h" #include "trick/trick_byteswap.h" #include "trick/trick_error_hndlr.h" diff --git a/trick_source/trick_utils/comm/test/TCSetBlockIOTest.cpp b/trick_source/trick_utils/comm/test/TCSetBlockIOTest.cpp index 87d71551..03b23462 100644 --- a/trick_source/trick_utils/comm/test/TCSetBlockIOTest.cpp +++ b/trick_source/trick_utils/comm/test/TCSetBlockIOTest.cpp @@ -3,7 +3,6 @@ #include "trick/tc.h" #include "trick/attributes.h" -#include "trick/hs_msg.h" #include "trick/tc_proto.h" #include "trick/trick_byteswap.h" #include "trick/trick_error_hndlr.h" diff --git a/trick_source/trick_utils/interpolator/Makefile b/trick_source/trick_utils/interpolator/Makefile index 1f1cda7f..a181cedf 100644 --- a/trick_source/trick_utils/interpolator/Makefile +++ b/trick_source/trick_utils/interpolator/Makefile @@ -1,34 +1,5 @@ -ifdef TRICK_HOME -ifneq ($(STAND_ALONE), 1) - --include ${TRICK_HOME}/share/trick/makefiles/Makefile.common --include ${TRICK_HOME}/share/trick/makefiles/Makefile.tricklib - +include ${TRICK_HOME}/share/trick/makefiles/Makefile.common +include ${TRICK_HOME}/share/trick/makefiles/Makefile.tricklib -include Makefile_deps -SEPARATE_LIB = $(TRICK_LIB_DIR)/libtrick_interp.a - -default: $(SEPARATE_LIB) -trick: $(SEPARATE_LIB) - -stand_alone: - @ $(MAKE) STAND_ALONE=1 - -clean_stand_alone: - @ $(MAKE) STAND_ALONE=1 clean - -$(SEPARATE_LIB) : $(OBJECT_FILES) $(IO_OBJS) | $(TRICK_LIB_DIR) - ar cr $@ $(OBJECT_FILES) $(IO_OBJS) - -else - -include makefile.stand_alone - -endif -else - -include makefile.stand_alone - -endif - diff --git a/trick_source/trick_utils/interpolator/makefile.stand_alone b/trick_source/trick_utils/interpolator/makefile.stand_alone deleted file mode 100644 index d7ad4518..00000000 --- a/trick_source/trick_utils/interpolator/makefile.stand_alone +++ /dev/null @@ -1,55 +0,0 @@ - -# -# This makefile is used to build trick utils standalone. -# That is, without Trick. -# - -TRICK_HOST_CPU := $(shell uname -s) - -CC = cc -CPP = c++ - -INTERP_INC_DIR = include - -OBJ_DIR = object_${TRICK_HOST_CPU} -INTERP_LIB = $(OBJ_DIR)/libtrick_interp.a - -FLAGS = -g -I../include -D_REENTRANT -DSTAND_ALONE -CFLAGS = ${FLAGS} -I./include -CPPFLAGS = ${FLAGS} -I./include - -trick: start - -start: $(INTERP_LIB) - @ echo "$(INTERP_LIB) is up to date" - -real_clean: clean - -clean: - /bin/rm -rf $(OBJ_DIR) - -#======================================================================= -# INTERP - -SRC_DIR = src - -INTERP_OBJECTS = $(OBJ_DIR)/Interpolator.o - -$(INTERP_LIB): $(INTERP_OBJECTS) - ar cr $(INTERP_LIB) $? - @ if [ "${TRICK_RANLIB}" != "" ] ; then \ - echo ${TRICK_RANLIB} $(INTERP_LIB) ; \ - ${TRICK_RANLIB} $(INTERP_LIB) ; \ - fi - -$(OBJ_DIR): - mkdir -p $(OBJ_DIR) - -$(OBJ_DIR)/Interpolator.o: ${SRC_DIR}/Interpolator.cpp | $(OBJ_DIR) - $(CC) ${CFLAGS} -c src/Interpolator.cpp -o $@ - -#---------------------------- -# Header Dependencies - -$(OBJ_DIR)/Interpolator.o: ${INTERP_INC_DIR}/Interpolator.hh - diff --git a/trick_source/trick_utils/math/Makefile b/trick_source/trick_utils/math/Makefile index 262bae0d..278d73ad 100644 --- a/trick_source/trick_utils/math/Makefile +++ b/trick_source/trick_utils/math/Makefile @@ -1,41 +1,10 @@ -ifdef TRICK_HOME -ifneq ($(STAND_ALONE), 1) - --include ${TRICK_HOME}/share/trick/makefiles/Makefile.common --include ${TRICK_HOME}/share/trick/makefiles/Makefile.tricklib - +include ${TRICK_HOME}/share/trick/makefiles/Makefile.common +# set the TRICK_LIB variable to create a separate library for comm +TRICK_LIB := $(TRICK_LIB_DIR)/libtrick_math.a +include ${TRICK_HOME}/share/trick/makefiles/Makefile.tricklib -include Makefile_deps -SEPARATE_LIB = $(TRICK_LIB_DIR)/libtrick_math.a - -ifeq ($(HAVE_GSL),1) -TRICK_CFLAGS += -D_HAVE_GSL -ifneq ($(GSL_HOME),/usr) -TRICK_CFLAGS += -I${GSL_HOME}/include -endif -endif - -default: $(SEPARATE_LIB) -trick: $(SEPARATE_LIB) - -stand_alone: - @ $(MAKE) STAND_ALONE=1 - -clean_stand_alone: - @ $(MAKE) STAND_ALONE=1 clean - -$(SEPARATE_LIB) : $(OBJECT_FILES) $(IO_OBJS) | $(TRICK_LIB_DIR) - ar cr $@ $(OBJECT_FILES) $(IO_OBJS) - -else - -include makefile.stand_alone - -endif -else - -include makefile.stand_alone - -endif +# make the comm library when called by the master makefile. +trick: ${TRICK_LIB} diff --git a/trick_source/trick_utils/math/makefile.stand_alone b/trick_source/trick_utils/math/makefile.stand_alone deleted file mode 100644 index 9402fa0f..00000000 --- a/trick_source/trick_utils/math/makefile.stand_alone +++ /dev/null @@ -1,150 +0,0 @@ - -# -# This makefile is used to build trick utils standalone. -# That is, without Trick. -# - -TRICK_HOST_CPU := $(shell uname -s) - -CC = cc -OBJ_DIR = object_${TRICK_HOST_CPU} -MATH_LIB = $(OBJ_DIR)/libtrick_math.a -STUBS_LIB = $(OBJ_DIR)/libtrick_stubs.a - -FLAGS = -g -I../include -D_REENTRANT -DSTAND_ALONE -I../../ - -trick: start - -start: $(MATH_LIB) - @ if [ -d "$(STUBS_DIR)" ] ; then \ - $(MAKE) trick_stubs_lib ; \ - fi - @ echo "math libraries are up to date" - -trick_stubs_lib: $(STUBS_LIB) - -real_clean: clean - -clean: - /bin/rm -rf $(OBJ_DIR) - @ for i in $(GSL_DIRS) ; do \ - $(MAKE) -C $$i clean ; \ - done - -#======================================================================= -# MATH - -SRC_DIR = src - -STUBS_DIR = ../comm/src - -MATH_OBJECTS = \ - $(OBJ_DIR)/LUD_inv.o \ - $(OBJ_DIR)/LUT_inv.o \ - $(OBJ_DIR)/LU_bksb.o \ - $(OBJ_DIR)/LU_dcmp.o \ - $(OBJ_DIR)/dLU_Choleski.o \ - $(OBJ_DIR)/dLU_solver.o \ - $(OBJ_DIR)/dS_function.o \ - $(OBJ_DIR)/deuler_123.o \ - $(OBJ_DIR)/deuler_132.o \ - $(OBJ_DIR)/deuler_213.o \ - $(OBJ_DIR)/deuler_231.o \ - $(OBJ_DIR)/deuler_312.o \ - $(OBJ_DIR)/deuler_321.o \ - $(OBJ_DIR)/dm_add.o \ - $(OBJ_DIR)/dm_copy.o \ - $(OBJ_DIR)/dm_ident.o \ - $(OBJ_DIR)/dm_init.o \ - $(OBJ_DIR)/dm_invert.o \ - $(OBJ_DIR)/dm_invert_symm.o \ - $(OBJ_DIR)/dm_orthonormal.o \ - $(OBJ_DIR)/dm_print.o \ - $(OBJ_DIR)/dm_scale.o \ - $(OBJ_DIR)/dm_sub.o \ - $(OBJ_DIR)/dm_trans.o \ - $(OBJ_DIR)/dmtxm.o \ - $(OBJ_DIR)/dmtxmt.o \ - $(OBJ_DIR)/dmtxv.o \ - $(OBJ_DIR)/dmxm.o \ - $(OBJ_DIR)/dmxmt.o \ - $(OBJ_DIR)/dmxv.o \ - $(OBJ_DIR)/drandom_gaussian.o \ - $(OBJ_DIR)/dsingle_axis_rot.o \ - $(OBJ_DIR)/dv_add.o \ - $(OBJ_DIR)/dv_copy.o \ - $(OBJ_DIR)/dv_cross.o \ - $(OBJ_DIR)/dv_dot.o \ - $(OBJ_DIR)/dv_init.o \ - $(OBJ_DIR)/dv_mag.o \ - $(OBJ_DIR)/dv_norm.o \ - $(OBJ_DIR)/dv_print.o \ - $(OBJ_DIR)/dv_scale.o \ - $(OBJ_DIR)/dv_skew.o \ - $(OBJ_DIR)/dv_store.o \ - $(OBJ_DIR)/dv_sub.o \ - $(OBJ_DIR)/dvxm.o \ - $(OBJ_DIR)/dvxv_add.o \ - $(OBJ_DIR)/dvxv_sub.o \ - $(OBJ_DIR)/eigen_hh_red.o \ - $(OBJ_DIR)/eigen_jacobi.o \ - $(OBJ_DIR)/eigen_jacobi_4.o \ - $(OBJ_DIR)/eigen_ql.o \ - $(OBJ_DIR)/euler_matrix.o \ - $(OBJ_DIR)/gauss_rnd_bell.o \ - $(OBJ_DIR)/gauss_rnd_pseudo.o \ - $(OBJ_DIR)/mat_copy.o \ - $(OBJ_DIR)/mat_permute.o \ - $(OBJ_DIR)/mat_print.o \ - $(OBJ_DIR)/mat_to_quat.o \ - $(OBJ_DIR)/mat_trans.o \ - $(OBJ_DIR)/matxmat.o \ - $(OBJ_DIR)/matxtrans.o \ - $(OBJ_DIR)/matxvec.o \ - $(OBJ_DIR)/quat_mult.o \ - $(OBJ_DIR)/quat_norm.o \ - $(OBJ_DIR)/quat_norm_integ.o \ - $(OBJ_DIR)/quat_to_mat.o \ - $(OBJ_DIR)/rand_num.o \ - $(OBJ_DIR)/roundoff.o \ - $(OBJ_DIR)/tm_print_error.o \ - $(OBJ_DIR)/transxmat.o \ - $(OBJ_DIR)/transxtrans.o \ - $(OBJ_DIR)/transxvec.o \ - $(OBJ_DIR)/trick_gsl_rand.o \ - $(OBJ_DIR)/trns_fnct_1o.o \ - $(OBJ_DIR)/trns_fnct_2o.o \ - $(OBJ_DIR)/uniform_rnd_1.o \ - $(OBJ_DIR)/uniform_rnd_triple.o \ - $(OBJ_DIR)/vec_print.o \ - $(OBJ_DIR)/wave_form.o - -STUBS_OBJECTS = \ - $(OBJ_DIR)/stubs.o - -$(MATH_LIB) : $(MATH_OBJECTS) $(GSL_OBJECTS) - ar cr $(MATH_LIB) $? - @ if [ "`uname -s`" = "Darwin" ] ; then \ - echo ranlib $(MATH_LIB) ; \ - ranlib $(MATH_LIB) ; \ - fi - -$(STUBS_LIB) : $(OBJ_DIR)/stubs.o - ar cr $(STUBS_LIB) $? - @ if [ "`uname -s`" = "Darwin" ] ; then \ - echo ranlib $(STUBS_LIB) ; \ - ranlib $(STUBS_LIB) ; \ - fi - -$(OBJ_DIR): - mkdir -p $(OBJ_DIR) - -$(MATH_OBJECTS) : $(OBJ_DIR)/%.o : $(SRC_DIR)/%.c | $(OBJ_DIR) - $(CC) $(FLAGS) -c $? -o $@ - - -# Stubs routines - -$(STUBS_OBJECTS) : $(OBJ_DIR)/%.o : $(STUBS_DIR)/stubs.c | $(OBJ_DIR) - $(CC) $(FLAGS) -c $? -o $@ - diff --git a/trick_source/trick_utils/shm/Makefile b/trick_source/trick_utils/shm/Makefile index 2689b639..a181cedf 100644 --- a/trick_source/trick_utils/shm/Makefile +++ b/trick_source/trick_utils/shm/Makefile @@ -1,34 +1,5 @@ -ifdef TRICK_HOME -ifneq ($(STAND_ALONE), 1) - --include ${TRICK_HOME}/share/trick/makefiles/Makefile.common --include ${TRICK_HOME}/share/trick/makefiles/Makefile.tricklib - +include ${TRICK_HOME}/share/trick/makefiles/Makefile.common +include ${TRICK_HOME}/share/trick/makefiles/Makefile.tricklib -include Makefile_deps -SEPARATE_LIB = $(TRICK_LIB_DIR)/libtrick_shm.a - -default: $(SEPARATE_LIB) -trick: $(SEPARATE_LIB) - -stand_alone: - @ $(MAKE) STAND_ALONE=1 - -clean_stand_alone: - @ $(MAKE) STAND_ALONE=1 clean - -$(SEPARATE_LIB) : $(OBJECT_FILES) $(IO_OBJS) | $(TRICK_LIB_DIR) - ar cr $@ $(OBJECT_FILES) $(IO_OBJS) - -else - -include makefile.stand_alone - -endif -else - -include makefile.stand_alone - -endif - diff --git a/trick_source/trick_utils/shm/makefile.stand_alone b/trick_source/trick_utils/shm/makefile.stand_alone deleted file mode 100644 index aae89cd1..00000000 --- a/trick_source/trick_utils/shm/makefile.stand_alone +++ /dev/null @@ -1,51 +0,0 @@ - -# -# This makefile is used to build trick utils standalone. -# That is, without Trick. -# - -TRICK_HOST_CPU := $(shell uname -s) - -CC = cc -CPP = c++ - -SHM_INC_DIR = include - -OBJ_DIR = object_${TRICK_HOST_CPU} -SHM_LIB = $(OBJ_DIR)/libtrick_shm.a - -FLAGS = -g -I../include -D_REENTRANT -DSTAND_ALONE - -trick: start - -start: $(SHM_LIB) - @ echo "$(SHM_LIB) is up to date" - -real_clean: clean - -clean: - /bin/rm -rf $(OBJ_DIR) - -#======================================================================= -# SHM - -SRC_DIR = src - -SHM_OBJECTS = $(OBJ_DIR)/tsm_disconnect.o \ - $(OBJ_DIR)/tsm_init.o \ - $(OBJ_DIR)/tsm_init_with_lock.o \ - $(OBJ_DIR)/tsm_reconnect.o - -$(SHM_LIB): $(SHM_OBJECTS) - ar cr $(SHM_LIB) $? - @ if [ "${TRICK_RANLIB}" != "" ] ; then \ - echo ${TRICK_RANLIB} $(SHM_LIB) ; \ - ${TRICK_RANLIB} $(SHM_LIB) ; \ - fi - -$(OBJ_DIR): - mkdir -p $(OBJ_DIR) - -$(SHM_OBJECTS) : $(OBJ_DIR)/%.o : $(SRC_DIR)/%.c | $(OBJ_DIR) - $(CC) $(FLAGS) -c $< -o $@ - diff --git a/trick_source/trick_utils/trick_adt/Makefile b/trick_source/trick_utils/trick_adt/Makefile index 05c7ba6a..a181cedf 100644 --- a/trick_source/trick_utils/trick_adt/Makefile +++ b/trick_source/trick_utils/trick_adt/Makefile @@ -1,34 +1,5 @@ -ifdef TRICK_HOME -ifneq ($(STAND_ALONE), 1) - --include ${TRICK_HOME}/share/trick/makefiles/Makefile.common --include ${TRICK_HOME}/share/trick/makefiles/Makefile.tricklib - +include ${TRICK_HOME}/share/trick/makefiles/Makefile.common +include ${TRICK_HOME}/share/trick/makefiles/Makefile.tricklib -include Makefile_deps -SEPARATE_LIB = $(TRICK_LIB_DIR)/libtrick_adt.a - -default: $(SEPARATE_LIB) -trick: $(SEPARATE_LIB) - -stand_alone: - @ $(MAKE) STAND_ALONE=1 - -clean_stand_alone: - @ $(MAKE) STAND_ALONE=1 clean - -$(SEPARATE_LIB) : $(OBJECT_FILES) $(IO_OBJS) | $(TRICK_LIB_DIR) - ar cr $@ $(OBJECT_FILES) $(IO_OBJS) - -else - -include makefile.stand_alone - -endif -else - -include makefile.stand_alone - -endif - diff --git a/trick_source/trick_utils/trick_adt/makefile.stand_alone b/trick_source/trick_utils/trick_adt/makefile.stand_alone deleted file mode 100644 index 0be96873..00000000 --- a/trick_source/trick_utils/trick_adt/makefile.stand_alone +++ /dev/null @@ -1,54 +0,0 @@ - -# -# This makefile is used to build trick utils standalone. -# That is, without Trick. -# -# It does NOT create lib or object dirs for each platform. -# -# Once ran, all libraries go into "lib" . - -TRICK_HOST_CPU := $(shell uname -s) - -CC = cc -OBJ_DIR = object_${TRICK_HOST_CPU} -ADT_LIB = $(OBJ_DIR)/libtrick_adt.a - -FLAGS = -g -I../include -D_REENTRANT -DSTAND_ALONE -D${TRICK_HOST_CPU} -Iinclude - -trick: start - -start: $(ADT_LIB) - @ echo "$(ADT_LIB) is up to date" - -real_clean: clean - -clean: - /bin/rm -rf $(OBJ_DIR) - -#======================================================================= -# TRICK_ADT - -SRC_DIR = src - -TRICK_ADT_OBJECTS = \ - $(OBJ_DIR)/MapStrToPtr.o \ - $(OBJ_DIR)/bst.o \ - $(OBJ_DIR)/dllist.o \ - $(OBJ_DIR)/lqueue.o \ - $(OBJ_DIR)/lstack.o \ - $(OBJ_DIR)/record_array.o \ - $(OBJ_DIR)/bubble_sort.o - -$(ADT_LIB) : $(TRICK_ADT_OBJECTS) - ar cr $(ADT_LIB) $? - @ if [ "`uname -s`" = "Darwin" ] ; then \ - echo ranlib $(ADT_LIB) ; \ - ranlib $(ADT_LIB) ; \ - fi - -$(OBJ_DIR) : - mkdir -p $(OBJ_DIR) - -$(TRICK_ADT_OBJECTS) : $(OBJ_DIR)/%.o : $(SRC_DIR)/%.c | $(OBJ_DIR) - $(CC) $(FLAGS) -c $< -o $@ - diff --git a/trick_source/trick_utils/units/Makefile b/trick_source/trick_utils/units/Makefile index b61fc601..8beaf254 100644 --- a/trick_source/trick_utils/units/Makefile +++ b/trick_source/trick_utils/units/Makefile @@ -1,34 +1,9 @@ -ifdef TRICK_HOME -ifneq ($(STAND_ALONE), 1) - --include ${TRICK_HOME}/share/trick/makefiles/Makefile.common --include ${TRICK_HOME}/share/trick/makefiles/Makefile.tricklib - +include ${TRICK_HOME}/share/trick/makefiles/Makefile.common +# set the TRICK_LIB variable to create a separate library +TRICK_LIB := $(TRICK_LIB_DIR)/libtrick_units.a +include ${TRICK_HOME}/share/trick/makefiles/Makefile.tricklib -include Makefile_deps -SEPARATE_LIB = $(TRICK_LIB_DIR)/libtrick_units.a - -default: $(SEPARATE_LIB) -trick: $(SEPARATE_LIB) - -stand_alone: - @ $(MAKE) STAND_ALONE=1 - -clean_stand_alone: - @ $(MAKE) STAND_ALONE=1 clean - -$(SEPARATE_LIB) : $(OBJECT_FILES) $(IO_OBJS) | $(TRICK_LIB_DIR) - ar cr $@ $(OBJECT_FILES) $(IO_OBJS) - -else - -include makefile.stand_alone - -endif -else - -include makefile.stand_alone - -endif - +# make the library when called by the master makefile. +trick: ${TRICK_LIB} diff --git a/trick_source/trick_utils/units/makefile.stand_alone b/trick_source/trick_utils/units/makefile.stand_alone deleted file mode 100644 index e059d55b..00000000 --- a/trick_source/trick_utils/units/makefile.stand_alone +++ /dev/null @@ -1,65 +0,0 @@ - -# -# This makefile is used to build trick utils standalone. -# That is, without Trick. -# - -TRICK_HOST_CPU := $(shell uname -s) - -CC = cc -CPP = c++ - -UNITS_INC_DIR = include - -OBJ_DIR = object_${TRICK_HOST_CPU} -UNITS_LIB = $(OBJ_DIR)/libtrick_units.a - -FLAGS = -g -I../include -D_REENTRANT -DSTAND_ALONE -CFLAGS = ${FLAGS} -I./include -CPPFLAGS = ${FLAGS} -I./include - -trick: start - -start: $(UNITS_LIB) - @ echo "$(UNITS_LIB) is up to date" - -real_clean: clean - -clean: - /bin/rm -rf $(OBJ_DIR) - -#======================================================================= -# UNITS - -SRC_DIR = src - -UNITS_OBJECTS = $(OBJ_DIR)/units_conv.o \ - $(OBJ_DIR)/UCFn.o \ - $(OBJ_DIR)/Unit.o - -$(UNITS_LIB): $(UNITS_OBJECTS) - ar cr $(UNITS_LIB) $? - @ if [ "${TRICK_RANLIB}" != "" ] ; then \ - echo ${TRICK_RANLIB} $(UNITS_LIB) ; \ - ${TRICK_RANLIB} $(UNITS_LIB) ; \ - fi - -$(OBJ_DIR): - mkdir -p $(OBJ_DIR) - -$(OBJ_DIR)/units_conv.o: ${SRC_DIR}/units_conv.c | $(OBJ_DIR) - $(CC) ${CFLAGS} -c src/units_conv.c -o $@ - -$(OBJ_DIR)/UCFn.o: ${SRC_DIR}/UCFn.cpp | $(OBJ_DIR) - $(CPP) ${CPPFLAGS} -c src/UCFn.cpp -o $@ - -$(OBJ_DIR)/Unit.o: ${SRC_DIR}/Unit.cpp | $(OBJ_DIR) - $(CPP) ${CPPFLAGS} -c src/Unit.cpp -o $@ - -#---------------------------- -# Header Dependencies - -$(OBJ_DIR)/UCFn.o: ${UNITS_INC_DIR}/UCFn.hh -$(OBJ_DIR)/Unit.o: ${UNITS_INC_DIR}/Unit.hh ${UNITS_INC_DIR}/units_conv.h -$(OBJ_DIR)/units_conv.o: ${UNITS_INC_DIR}/units_conv.h -