Remove duplicate stand-alone libraries

I changed trick comm so that there is only one version built, not a slightly different version
if you are in or out of a sim.  While I was in the trick comm code, I removed all of the
unnecessary system header file inclusions out of tc.h.   I modified each of the source files
to include the system files it requires.  Some sim_services files were including tc.h and
also had to be edited to add headers.  I removed the stand-alone makefiles out of all
of the trick_utils directories.  Finally I modified the master makefile to exclude the
trick_util directories comm, math, and units from being archived into libtrick.a.  Each of
those directories will create their own library and will be included when linking a Trick sim.

refs #71
This commit is contained in:
Alex Lin 2015-06-24 15:58:17 -05:00
parent 67da980bdd
commit 941eb5c1cc
59 changed files with 185 additions and 1022 deletions

View File

@ -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

View File

@ -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

View File

@ -13,54 +13,11 @@ PROGRAMMERS:
#ifdef __WIN32__
# include <winsock2.h>
# include <ws2tcpip.h>
#endif
#include <stdio.h>
#ifndef __WIN32__
# include <errno.h>
# include <unistd.h>
# include <pthread.h>
# include <signal.h>
# include <netdb.h>
# if (_POSIX_C_SOURCE)
# ifndef TCP_NODELAY
# define TCP_NODELAY 0x01
# endif
# else
# include <netinet/tcp.h>
# endif
# if ( __vxworks )
# include <sys/times.h>
# include <ioLib.h>
# else
# if ( __Lynx__ )
# include <socket.h>
# include <time.h>
# define __NO_INCLUDE_WARN__
# include <netinet/in.h>
# undef __NO_INCLUDE_WARN__
# else
# include <sys/socket.h>
# include <sys/time.h>
# include <netinet/in.h>
#else
# include <arpa/inet.h>
# endif
# include <sys/ioctl.h>
# include <sys/utsname.h>
# endif
# if ( __sun )
# include <sys/filio.h>
# endif
# if ( __CYGWIN__ )
# include <sys/param.h>
# 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

View File

@ -17,13 +17,8 @@ ICG:
#define TC_PROTO_H
#include <stdarg.h>
#include "tc.h"
#ifdef STAND_ALONE
#include "attributes.h"
#else
#include "trick/tc.h"
#include "trick/attributes.h"
#endif
#ifdef __cplusplus
extern "C" {

View File

@ -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 =

View File

@ -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 :=

View File

@ -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

View File

@ -2,6 +2,7 @@
#include <iostream>
#include <sstream>
#include <string.h>
#include <unistd.h>
#include "trick/MSSocket.hh"
#include "trick/Master.hh"

View File

@ -7,6 +7,7 @@
#include <string>
#include <pwd.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>

View File

@ -1,6 +1,7 @@
#include <iomanip>
#include <sstream>
#include <sys/time.h>
#include "trick/MonteCarlo.hh"
#include "trick/tc_proto.h"

View File

@ -1,4 +1,6 @@
#include <sys/time.h>
#include "trick/MonteCarlo.hh"
#include "trick/memorymanager_c_intf.h"
#include "trick/command_line_protos.h"

View File

@ -1,4 +1,6 @@
#include <sys/time.h>
#include "trick/MonteCarlo.hh"
#include "trick/ExecutiveException.hh"

View File

@ -1,4 +1,6 @@
#include <sys/time.h>
#include "trick/MonteCarlo.hh"
#include "trick/command_line_protos.h"
#include "trick/message_proto.h"

View File

@ -5,6 +5,8 @@
#ifdef __linux
#include <cxxabi.h>
#endif
#include <netdb.h>
#include "trick/VariableServer.hh"
#include "trick/variable_server_sync_types.h"

View File

@ -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 ${<F} -o $(UP_DIR)$@
$(OBJ_DIR)_sa:
@ mkdir -p $@
clean: clean_sa
clean_sa:
${RM} -rf $(OBJ_DIR)_sa
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}

View File

@ -1,99 +0,0 @@
#
# This makefile is used to build trick utils standalone.
# That is, without Trick.
#
TRICK_HOST_CPU := $(shell uname -s)
CC = cc
SRC_DIR = src/
OBJ_DIR = object_${TRICK_HOST_CPU}
COMM_LIB = $(OBJ_DIR)/libtrick_comm.a
ERR_LIB = $(OBJ_DIR)/libtrick_err_hndlr.a
STUBS_LIB = $(OBJ_DIR)/libtrick_stubs.a
FLAGS = -g -I../include -D_REENTRANT -DSTAND_ALONE
trick: start
start: trick_comm
@ if [ -f "$(SRC_DIR)/trick_error_hndlr.c" ] ; then \
$(MAKE) trick_error_hndlr_lib ; \
fi
@ if [ -f "$(SRC_DIR)/stubs.c" ] ; then \
$(MAKE) trick_stubs_lib ; \
fi
@ echo "comm libraries are up to date"
trick_comm: $(COMM_LIB)
trick_error_hndlr_lib: $(ERR_LIB)
trick_stubs_lib: $(STUBS_LIB)
real_clean: clean
clean:
/bin/rm -rf $(OBJ_DIR)
#=======================================================================
# COMM
SRC_DIR = src
COMM_OBJECTS = \
$(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
$(COMM_LIB) : $(COMM_OBJECTS)
ar cr $(COMM_LIB) $?
@ if [ "`uname -s`" = "Darwin" ] ; then \
echo ranlib $(COMM_LIB) ; \
ranlib $(COMM_LIB) ; \
fi
$(ERR_LIB) : $(OBJ_DIR)/trick_error_hndlr.o
ar cr $(ERR_LIB) $?
@ if [ "`uname -s`" = "Darwin" ] ; then \
echo ranlib $(ERR_LIB) ; \
ranlib $(ERR_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)
$(COMM_OBJECTS) $(OBJ_DIR)/stubs.o : $(OBJ_DIR)/%.o : $(SRC_DIR)/%.c | $(OBJ_DIR)
$(CC) $(FLAGS) -c $< -o $@

View File

@ -1,91 +0,0 @@
/*
(This source file contains two functions that set up and remove a health and status spooling function which uses an
ipc msg queue for msg spooling from multiple processes. )
REFERENCE: (((Paddock, E.J) (Trick Runtime Executive Manual) (NASA:JSC #......) (JSC / Engineering Directorate /
Automation and Robotics Division) (April 1992) (--)) (See Also: ))
ASSUMPTIONS AND LIMITATIONS: ((Msg queue allocations must be within IPC limits of UNIX Kernal))
CLASS: (N/A)
LIBRARY DEPENDENCY: ((none))
PROGRAMMERS: (((Eddie J. Paddock) (MDSSC) (April 1992) (--) (Realtime))) */
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <time.h>
#include <string.h>
#ifdef __WIN32__
#include <winsock.h>
#include <malloc.h>
#else
#include <unistd.h>
#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

View File

@ -3,8 +3,15 @@
* Accept a connection from a communications client
*/
#ifndef __WIN32__
#include <errno.h>
#include <netinet/tcp.h>
#include <unistd.h>
#endif
#include "trick/tc.h"
#include "trick/tc_proto.h"
#include "trick/trick_byteswap.h"
#if _DMTCP
#include <dlfcn.h>

View File

@ -1,4 +1,11 @@
#ifndef __WIN32__
# include <sys/ioctl.h>
# define IOCTL_SOCKET ioctl
#else
# define IOCTL_SOCKET ioctlsocket
#endif
#include "trick/tc.h"
#include "trick/tc_proto.h"

View File

@ -3,6 +3,11 @@
* Broadcast Connection Information
*/
#ifndef __WIN32__
#include <pthread.h>
#include <unistd.h>
#endif
#include "trick/tc.h"
#include "trick/tc_proto.h"

View File

@ -3,7 +3,12 @@
* Get system clock reference time
*/
#include "trick/tc.h"
#if __linux
#include <time.h>
#else
#include <sys/time.h>
#endif
#include "trick/tc_proto.h"
double tc_clock_init(void)

View File

@ -3,7 +3,12 @@
* Get elapsed time since last call to tc_clock_init()
*/
#include "trick/tc.h"
#ifdef __linux
#include <time.h>
#else
#include <sys/time.h>
#endif
#include "trick/tc_proto.h"
double tc_clock_time(double ref_time)

View File

@ -3,8 +3,16 @@
* Establish a connection with a communications server
*/
#ifndef __WIN32__
#include <netdb.h>
#include <errno.h>
#include <netinet/tcp.h>
#include <unistd.h>
#endif
#include "trick/tc.h"
#include "trick/tc_proto.h"
#include "trick/trick_byteswap.h"
#if _DMTCP
#include <dlfcn.h>

View File

@ -3,6 +3,10 @@
* Disconnect a device
*/
#ifndef __WIN32__
#include <unistd.h>
#endif
#include "trick/tc.h"
#include "trick/tc_proto.h"

View File

@ -3,8 +3,16 @@
* Set up a device on which to listen for connections
*/
#include <fcntl.h>
#ifndef __WIN32__
#include <netinet/tcp.h>
#include <netdb.h>
#include <unistd.h>
#endif
#include "trick/tc.h"
#include "trick/tc_proto.h"
#include "trick/trick_byteswap.h"
int tc_init(TCDevice * listen_device) {

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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 <netdb.h>
#include <netinet/tcp.h>
#include <unistd.h>
#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;

View File

@ -13,8 +13,13 @@
PROGRAMMERS: (((M. Will) (L3-Com) (31 October 2006) (--) (CAIL))) */
#ifndef __WIN32__
#include <netinet/tcp.h>
#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)

View File

@ -3,6 +3,10 @@
* Check to see if a device is valid
*/
#ifndef __WIN32__
#include <errno.h>
#endif
#include "trick/tc.h"
#include "trick/tc_proto.h"

View File

@ -3,23 +3,18 @@
* Multicast connect
*/
#include "trick/tc.h"
#include "trick/tc_proto.h"
#include <string.h>
#ifdef __WIN32__
#include <process.h>
#else
#include <unistd.h>
#include <errno.h>
#include <arpa/inet.h>
#endif
#include <pthread.h>
#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)
{

View File

@ -3,6 +3,13 @@
* See if data is available for reading on a non-blocking connection
*/
#ifndef __WIN32__
# include <sys/ioctl.h>
# define IOCTL_SOCKET ioctl
#else
# define IOCTL_SOCKET ioctlsocket
#endif
#include "trick/tc.h"
#include "trick/tc_proto.h"

View File

@ -3,6 +3,11 @@
* Read data from a device
*/
#ifndef __WIN32__
#include <errno.h>
#include <unistd.h>
#endif
#include "trick/tc.h"
#include "trick/tc_proto.h"

View File

@ -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)
{

View File

@ -3,6 +3,11 @@
* Write data to a device
*/
#ifndef __WIN32__
#include <errno.h>
#include <unistd.h>
#endif
#include "trick/tc.h"
#include "trick/tc_proto.h"

View File

@ -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)
{

View File

@ -1,19 +1,11 @@
#include <stdio.h>
#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

View File

@ -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

View File

@ -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,30 +47,6 @@ 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);
}
} else {
send_hs(out_stream, "\n %s: %s", label[level], msg);
}
} 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]);
}
}
} else {
/* Print message to the output stream. */
if (msg != (char *) NULL) {
if (file != (char *) NULL) {
@ -101,7 +69,6 @@ static void trick_error_message_print(FILE * out_stream, /* Inout: Output
fprintf(out_stream, "\n %s: an undescribed error was " "reported.\n", label[level]);
}
}
}
return;
}
@ -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;
}

View File

@ -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)

View File

@ -2,7 +2,6 @@
#include <gtest/gtest.h>
#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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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}

View File

@ -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 $@

View File

@ -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

View File

@ -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 $@

View File

@ -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

View File

@ -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 $@

View File

@ -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}

View File

@ -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