Commit fd890421 authored by Lucas Russo's avatar Lucas Russo

various: update files to reference new libhutils library

parent 5d5cd6af
......@@ -58,6 +58,7 @@ DRIVER_OBJ = /lib/modules/$(PCIE_DRIVER_VER)/extra/pciDriver.ko
# Project libraries
LIBERRHAND_DIR = src/libs/liberrhand
LIBCONVC_DIR = src/libs/libconvc
LIBHUTILS_DIR = src/libs/libhutils
LIBBPMCLIENT_DIR = src/libs/libbpmclient
# General C flags
......@@ -145,11 +146,12 @@ LIBS = -lm -lzmq -lczmq -lmdp -lpcidriver
# FIXME: make the project libraries easily interchangeable, specifying
# the lib only a single time
PROJECT_LIBS_NAME = liberrhand libconvc libbpmclient
PROJECT_LIBS = -lerrhand -lconvc -lbpmclient
PROJECT_LIBS_NAME = liberrhand libconvc libhutils libbpmclient
PROJECT_LIBS = -lerrhand -lconvc -lhutils -lbpmclient
# General library flags -L<libdir>
LFLAGS = -Lsrc/libs/liberrhand -Lsrc/libs/libconvc -Lsrc/libs/lbpmclient
LFLAGS = -Lsrc/libs/liberrhand -Lsrc/libs/libconvc -Lsrc/libs/libhutils \
-Lsrc/libs/lbpmclient
# Specific platform objects
OBJS_PLATFORM =
......@@ -172,6 +174,7 @@ INCLUDE_DIRS = $(hal_INCLUDE_DIRS) \
-Iinclude \
-Isrc/libs/liberrhand \
-Isrc/libs/libconvc \
-Isrc/libs/libhutils \
-Isrc/libs/libbpmclient \
-I/usr/local/include
......@@ -203,6 +206,7 @@ revision_SRCS = $(patsubst %.o,%.c,$(revision_OBJS))
pcie_driver pcie_driver_install pcie_driver_uninstall pcie_driver_clean pcie_driver_check \
liberrhand liberrhand_install liberrhand_uninstall liberrhand_clean liberrhand_mrproper \
libconvc libconvc_install libconvc_uninstall libconvc_clean libconvc_mrproper \
libhutils libhutils_install libhutils_uninstall libhutils_clean libhutils_mrproper \
libbpmclient libbpmclient_install libbpmclient_uninstall libbpmclient_clean libbpmclient_mrproper \
libmdp libmdp_install libmdp_uninstall libmdp_clean libmdp_mrproper \
libbsmp libbsmp_install libbsmp_uninstall libbsmp_clean libbsmp_mrproper \
......@@ -351,6 +355,21 @@ libconvc_clean:
libconvc_mrproper:
$(MAKE) -C $(LIBCONVC_DIR) mrproper
libhutils:
$(MAKE) -C $(LIBHUTILS_DIR) all
libhutils_install:
$(MAKE) -C $(LIBHUTILS_DIR) install
libhutils_uninstall:
$(MAKE) -C $(LIBHUTILS_DIR) uninstall
libhutils_clean:
$(MAKE) -C $(LIBHUTILS_DIR) clean
libhutils_mrproper:
$(MAKE) -C $(LIBHUTILS_DIR) mrproper
libbpmclient:
$(MAKE) -C $(LIBBPMCLIENT_DIR) all
......@@ -425,9 +444,9 @@ cfg_clean:
cfg_mrproper:
$(MAKE) -C cfg mrproper
install: hal_install deps_install libbpmclient_install cfg_install
install: hal_install deps_install liberrhand_install libconvc_install libbpmclient_install cfg_install
uninstall: hal_uninstall deps_uninstall libbpmclient_uninstall cfg_uninstall
uninstall: hal_uninstall deps_uninstall liberrhand_uninstall libconvc_uninstall libbpmclient_uninstall cfg_uninstall
clean: hal_clean deps_clean liberrhand_clean libconvc_clean libbpmclient_clean examples_clean tests_clean cfg_clean
......
......@@ -34,7 +34,7 @@ CFLAGS_PLATFORM = -Wall -Wextra -Werror
LDFLAGS_PLATFORM =
# Libraries
LIBS = -lbpmclient -lmdp -lczmq -lzmq
LIBS = -lbpmclient -lerrhand -lmdp -lczmq -lzmq
# General library flags -L<libdir>
LFLAGS =
......
......@@ -194,7 +194,7 @@ int main (int argc, char *argv[])
char *argv_exec [] = {DEVIO_CFG_NAME, "-n", devio_type_str,"-t", dev_type,
"-i", dev_id_str, "-e", dev_entry, "-b", broker_endp, NULL};
/* Spawn Config DEVIO */
child_devio_cfg_pid = halutils_spawn_chld (DEVIO_CFG_NAME, argv_exec);
child_devio_cfg_pid = hutils_spawn_chld (DEVIO_CFG_NAME, argv_exec);
if (child_devio_cfg_pid < 0) {
DBE_DEBUG (DBG_DEV_IO | DBG_LVL_FATAL, "[dev_io] Could not create "
......@@ -236,7 +236,7 @@ int main (int argc, char *argv[])
/* Kill DEVIO cfg as we've already got our slot number */
kill (child_devio_cfg_pid, DEVIO_KILL_CFG_SIGNAL);
/* Wait child */
halutils_wait_chld ();
hutils_wait_chld ();
#endif
/* We don't need it anymore */
......@@ -305,7 +305,7 @@ int main (int argc, char *argv[])
}
/* wait child */
halutils_wait_chld ();
hutils_wait_chld ();
}
err_devio:
......
dev_io_DIR = $(SRC_DIR)/hal/dev_io
dev_io_core_utils_OBJS = $(dev_io_DIR)/dev_io_utils.o
# Here we call <output_name>_core_OBJS as we need to add
# more objects to this target. This is done in the hal.mk
# makefile
dev_io_core_OBJS = $(dev_io_DIR)/dev_io_core.o \
$(dev_io_DIR)/dev_io_err.o \
$(dev_io_utils_OBJS)
$(dev_io_core_utils_OBJS)
dev_io_OBJS = $(dev_io_DIR)/dev_io.o
dev_io_INCLUDE_DIRS = $(dev_io_DIR) \
$(dev_io_utils_INCLUDE_DIRS) \
$(LIBBPMCLIENT_DIR)
dev_io_OUT = dev_io
......
......@@ -17,7 +17,7 @@
#include "sm_io_thsafe_codes.h"
#include "sm_io_bootstrap.h"
#include "ll_io_utils.h"
#include "hal_utils.h"
#include "hutils.h"
/* Undef ASSERT_ALLOC to avoid conflicting with other ASSERT_ALLOC */
#ifdef ASSERT_TEST
......@@ -139,9 +139,9 @@ devio_t * devio_new (char *name, char *endpoint_dev, llio_type_e type,
self->disp_table_thsafe_ops = disp_table_new ();
ASSERT_ALLOC(self->disp_table_thsafe_ops, err_disp_table_thsafe_ops_alloc);
halutils_err_e halutils_err = disp_table_insert_all (self->disp_table_thsafe_ops,
hutils_err_e hutils_err = disp_table_insert_all (self->disp_table_thsafe_ops,
self->thsafe_server_ops);
ASSERT_TEST(halutils_err==HALUTILS_SUCCESS, "Could not initialize dispatch table",
ASSERT_TEST(hutils_err==HUTILS_SUCCESS, "Could not initialize dispatch table",
err_disp_table_init);
/* Finally, initialize mdp_worker with service being the BPM<board_number> */
......@@ -261,9 +261,9 @@ devio_err_e devio_register_sm (devio_t *self, uint32_t smio_id, uint64_t base,
* alloc can fail */
DBE_DEBUG (DBG_DEV_IO | DBG_LVL_TRACE,
"[dev_io_core:register_sm] Stringify hash ID\n");
char *inst_id_str = halutils_stringify_dec_key (inst_id);
char *inst_id_str = hutils_stringify_dec_key (inst_id);
ASSERT_ALLOC(inst_id_str, err_inst_id_str_alloc);
char *key = halutils_concat_strings_no_sep (smio_mod_dispatch[i].name,
char *key = hutils_concat_strings_no_sep (smio_mod_dispatch[i].name,
inst_id_str);
/* We don't need this anymore */
free (inst_id_str);
......
......@@ -11,7 +11,7 @@
#include "czmq.h"
#include "mdp.h"
#include "hal_utils.h"
#include "hutils.h"
#include "dispatch_table.h"
#include "dev_io_err.h"
#include "ll_io.h"
......
......@@ -18,7 +18,7 @@
#include "dev_mngr.h"
#include "varg_macros.h"
#include "errhand.h"
#include "hal_utils.h"
#include "hutils.h"
#define DFLT_BIND_FOLDER "/tmp/bpm"
#define DFLT_BIND_ADDR "0"
......@@ -237,8 +237,8 @@ int main (int argc, char *argv[])
}
#endif
dmngr_set_wait_clhd_handler (dmngr, &halutils_wait_chld);
dmngr_set_spawn_clhd_handler (dmngr, &halutils_spawn_chld);
dmngr_set_wait_clhd_handler (dmngr, &hutils_wait_chld);
dmngr_set_spawn_clhd_handler (dmngr, &hutils_spawn_chld);
err = dmngr_register_sig_handlers (dmngr);
if (err != DMNGR_SUCCESS) {
......
......@@ -10,7 +10,7 @@
#include "dev_mngr_core.h"
#include "errhand.h"
#include "hal_utils.h"
#include "hutils.h"
/* Undef ASSERT_ALLOC to avoid conflicting with other ASSERT_ALLOC */
#ifdef ASSERT_TEST
......@@ -425,9 +425,9 @@ dmngr_err_e dmngr_spawn_all_devios (dmngr_t *self, char *broker_endp,
/* Alloc and convert types */
dev_type_c = llio_type_to_str (devio_info->type);
ASSERT_ALLOC (dev_type_c, err_dev_type_c_alloc, DMNGR_ERR_ALLOC);
dev_id_c = halutils_stringify_dec_key (devio_info->id);
dev_id_c = hutils_stringify_dec_key (devio_info->id);
ASSERT_ALLOC (dev_id_c, err_dev_id_c_alloc, DMNGR_ERR_ALLOC);
smio_inst_id_c = halutils_stringify_dec_key (devio_info->smio_inst_id);
smio_inst_id_c = hutils_stringify_dec_key (devio_info->smio_inst_id);
ASSERT_ALLOC (smio_inst_id_c, err_smio_inst_id_c_alloc, DMNGR_ERR_ALLOC);
/* Argument options are "process name", "device type" and
......
......@@ -16,7 +16,7 @@ hal_all_OUT += $(dev_mngr_all_OUT) $(dev_io_all_OUT)
dev_mngr_OBJS += $(dev_mngr_core_OBJS) $(debug_OBJS) \
$(hal_utils_OBJS) $(exp_ops_OBJS) \
$(thsafe_msg_zmq_OBJS) $(ll_io_utils_OBJS) \
$(dev_io_utils_OBJS)
$(dev_io_core_utils_OBJS)
# msg_OBJS already contains exp_ops_OBJS. So, there is no need to include
# it here twice
dev_io_OBJS += $(dev_io_core_OBJS) $(ll_io_OBJS) $(sm_io_OBJS) \
......
This diff is collapsed.
......@@ -15,7 +15,7 @@
#define _DISPATCH_TABLE_H_
#include <czmq.h>
#include "hal_utils_err.h"
#include "hutils.h"
struct _disp_table_t {
/* Hash containg all the sm_io thsafe operations
......@@ -89,31 +89,31 @@ typedef struct _disp_op_handler_t disp_op_handler_t;
/***************** Our methods *****************/
disp_table_t *disp_table_new (void);
halutils_err_e disp_table_destroy (disp_table_t **self_p);
hutils_err_e disp_table_destroy (disp_table_t **self_p);
halutils_err_e disp_table_insert (disp_table_t *self, const disp_op_t *disp_op);
halutils_err_e disp_table_insert_all (disp_table_t *self,
hutils_err_e disp_table_insert (disp_table_t *self, const disp_op_t *disp_op);
hutils_err_e disp_table_insert_all (disp_table_t *self,
const disp_op_t **disp_ops);
halutils_err_e disp_table_remove (disp_table_t *self, uint32_t key);
halutils_err_e disp_table_remove_all (disp_table_t *self);
hutils_err_e disp_table_remove (disp_table_t *self, uint32_t key);
hutils_err_e disp_table_remove_all (disp_table_t *self);
halutils_err_e disp_table_fill_desc (disp_table_t *self, disp_op_t **disp_ops,
hutils_err_e disp_table_fill_desc (disp_table_t *self, disp_op_t **disp_ops,
const disp_table_func_fp *func_fps);
halutils_err_e disp_table_check_args (disp_table_t *self, uint32_t key,
hutils_err_e disp_table_check_args (disp_table_t *self, uint32_t key,
void *args, void **ret);
halutils_err_e disp_table_cleanup_args (disp_table_t *self, uint32_t key);
hutils_err_e disp_table_cleanup_args (disp_table_t *self, uint32_t key);
const disp_op_t *disp_table_lookup (disp_table_t *self, uint32_t key);
int disp_table_call (disp_table_t *self, uint32_t key, void *owner, void *args,
void *ret);
int disp_table_check_call (disp_table_t *self, uint32_t key, void *owner,
void *args, void **ret);
halutils_err_e disp_table_set_ret (disp_table_t *self, uint32_t key, void **ret);
hutils_err_e disp_table_set_ret (disp_table_t *self, uint32_t key, void **ret);
/*********************** Disp Op Handler functions ****************************/
disp_op_handler_t *disp_op_handler_new (void);
halutils_err_e disp_op_handler_destroy (disp_op_handler_t **self_p);
hutils_err_e disp_op_handler_destroy (disp_op_handler_t **self_p);
#endif
......@@ -2,11 +2,13 @@ hal_utils_DIR = $(SRC_DIR)/hal/hal_utils
# We depend on "msg.c" fucntions to determine which message
# we are dealing with
hal_utils_OBJS = $(hal_utils_DIR)/hal_utils.o \
$(hal_utils_DIR)/hal_math.o \
$(hal_utils_DIR)/hal_utils_err.o \
$(hal_utils_DIR)/dispatch_table.o \
$(msg_DIR)/msg.o
#hal_utils_OBJS = $(hal_utils_DIR)/hal_utils.o \
# $(hal_utils_DIR)/hal_math.o \
# $(hal_utils_DIR)/hal_utils_err.o \
# $(hal_utils_DIR)/dispatch_table.o \
# $(msg_DIR)/msg.o
hal_utils_OBJS = $(hal_utils_DIR)/dispatch_table.o \
$(msg_DIR)/msg.o
hal_utils_INCLUDE_DIRS = $(hal_utils_DIR)
......@@ -10,19 +10,19 @@
#include "hal_utils_err.h"
static const char *halutils_err [HALUTILS_ERR_END] =
static const char *hutils_err [HUTILS_ERR_END] =
{
[HALUTILS_SUCCESS] = "Success",
[HALUTILS_ERR_ALLOC] = "Could not allocate memory",
[HALUTILS_ERR_NULL_POINTER] = "Null pointer received",
[HALUTILS_ERR_NO_FUNC_REG] = "No function registered",
[HALUTILS_ERR_INV_LESS_ARGS] = "Less arguments than specified passed",
[HALUTILS_ERR_INV_MORE_ARGS] = "More arguments than specified passed",
[HALUTILS_ERR_INV_SIZE_ARG] = "Invalid size of argument size"
[HUTILS_SUCCESS] = "Success",
[HUTILS_ERR_ALLOC] = "Could not allocate memory",
[HUTILS_ERR_NULL_POINTER] = "Null pointer received",
[HUTILS_ERR_NO_FUNC_REG] = "No function registered",
[HUTILS_ERR_INV_LESS_ARGS] = "Less arguments than specified passed",
[HUTILS_ERR_INV_MORE_ARGS] = "More arguments than specified passed",
[HUTILS_ERR_INV_SIZE_ARG] = "Invalid size of argument size"
};
/* Convert enumeration type to string */
const char * halutils_err_str (halutils_err_e err)
const char * hutils_err_str (hutils_err_e err)
{
return halutils_err [err];
return hutils_err [err];
}
......@@ -8,24 +8,24 @@
/* Error definitions and output stringification based on the work available
* at the libsllp project repository: https://github.com/brunoseivam/libsllp */
#ifndef _HALUTILS_ERR_H_
#define _HALUTILS_ERR_H_
#ifndef _HUTILS_ERR_H_
#define _HUTILS_ERR_H_
enum _halutils_err_e
enum _hutils_err_e
{
HALUTILS_SUCCESS = 0, /* No error */
HALUTILS_ERR_ALLOC, /* Could not allocate memory */
HALUTILS_ERR_NULL_POINTER, /* Null pointer received */
HALUTILS_ERR_NO_FUNC_REG, /* No function registered */
HALUTILS_ERR_INV_LESS_ARGS, /* Less arguments than specified passed */
HALUTILS_ERR_INV_MORE_ARGS, /* More arguments than specified passed */
HALUTILS_ERR_INV_SIZE_ARG, /* Invalid size of argument size */
HALUTILS_ERR_END
HUTILS_SUCCESS = 0, /* No error */
HUTILS_ERR_ALLOC, /* Could not allocate memory */
HUTILS_ERR_NULL_POINTER, /* Null pointer received */
HUTILS_ERR_NO_FUNC_REG, /* No function registered */
HUTILS_ERR_INV_LESS_ARGS, /* Less arguments than specified passed */
HUTILS_ERR_INV_MORE_ARGS, /* More arguments than specified passed */
HUTILS_ERR_INV_SIZE_ARG, /* Invalid size of argument size */
HUTILS_ERR_END
};
typedef enum _halutils_err_e halutils_err_e;
typedef enum _hutils_err_e hutils_err_e;
/* Convert enumeration type to string */
const char * halutils_err_str (halutils_err_e err);
const char * hutils_err_str (hutils_err_e err);
#endif
......@@ -502,7 +502,7 @@ static smch_err_e _smch_si57x_calc_divs (smch_si57x_t *self, double frequency,
hs_div = si57x_hs_div_values[i];
/* Calculate lowest possible value for n1 */
n1 = div_u64 (div_u64 (SI57X_FDCO_MIN, hs_div), (uint64_t) FLOOR(frequency));
n1 = hutils_div_u64 (hutils_div_u64 (SI57X_FDCO_MIN, hs_div), (uint64_t) FLOOR(frequency));
if (!n1 || (n1 & 1)) {
n1++;
......
......@@ -13,7 +13,7 @@
#include "sm_pr_i2c.h"
#include "sm_ch_err.h"
#include "hal_math.h"
#include "hutils_math.h"
struct _smch_si57x_t {
smpr_t *i2c; /* I2C protocol object */
......
......@@ -115,25 +115,25 @@ static int _afc_diag_info_rw (void *owner, void *args, void *ret,
AFC_DIAG_INFO_FUNC_NAME_HEADER(build_revision)
{
return _afc_diag_info_rw(owner, args, ret, halutils_copy_build_revision,
return _afc_diag_info_rw(owner, args, ret, revision_copy_build_revision,
AFC_DIAG_OPCODE_GET_BUILD_REVISION, "Could not get build revision");
}
AFC_DIAG_INFO_FUNC_NAME_HEADER(build_date)
{
return _afc_diag_info_rw(owner, args, ret, halutils_copy_build_date,
return _afc_diag_info_rw(owner, args, ret, revision_copy_build_date,
AFC_DIAG_OPCODE_GET_BUILD_DATE, "Could not get build date");
}
AFC_DIAG_INFO_FUNC_NAME_HEADER(build_user_name)
{
return _afc_diag_info_rw(owner, args, ret, halutils_copy_build_user_name,
return _afc_diag_info_rw(owner, args, ret, revision_copy_build_user_name,
AFC_DIAG_OPCODE_GET_BUILD_USER_NAME, "Could not get build user name");
}
AFC_DIAG_INFO_FUNC_NAME_HEADER(build_user_email)
{
return _afc_diag_info_rw(owner, args, ret, halutils_copy_build_user_email,
return _afc_diag_info_rw(owner, args, ret, revision_copy_build_user_email,
AFC_DIAG_OPCODE_GET_BUILD_USER_EMAIL, "Could not get build user email");
}
......
......@@ -100,8 +100,8 @@ smio_err_e smio_export_ops (smio_t *self, const disp_op_t** smio_exp_ops)
smio_err_e err = SMIO_SUCCESS;
halutils_err_e herr = disp_table_insert_all (self->exp_ops_dtable, smio_exp_ops);
ASSERT_TEST(herr == HALUTILS_SUCCESS, "smio_export_ops: Could not export"
hutils_err_e herr = disp_table_insert_all (self->exp_ops_dtable, smio_exp_ops);
ASSERT_TEST(herr == HUTILS_SUCCESS, "smio_export_ops: Could not export"
" SMIO ops", err_export_op, SMIO_ERR_EXPORT_OP);
err = SMIO_FUNC_OPS_NOFAIL_WRAPPER(err, export_ops, smio_exp_ops);
......@@ -119,9 +119,9 @@ smio_err_e smio_unexport_ops (smio_t *self)
assert (self);
smio_err_e err = SMIO_SUCCESS;
halutils_err_e herr = disp_table_remove_all (self->exp_ops_dtable);
hutils_err_e herr = disp_table_remove_all (self->exp_ops_dtable);
ASSERT_TEST(herr == HALUTILS_SUCCESS, "smio_export_ops: Could not unexport SMIO ops",
ASSERT_TEST(herr == HUTILS_SUCCESS, "smio_export_ops: Could not unexport SMIO ops",
err_unexport_op, SMIO_ERR_EXPORT_OP);
err = SMIO_FUNC_OPS_NOFAIL_WRAPPER(err, unexport_ops);
......@@ -143,10 +143,10 @@ smio_err_e smio_init_exp_ops (smio_t *self, disp_op_t** smio_exp_ops,
{
assert(self);
halutils_err_e herr = HALUTILS_SUCCESS;
hutils_err_e herr = HUTILS_SUCCESS;
smio_err_e err = SMIO_SUCCESS;
herr = disp_table_fill_desc (self->exp_ops_dtable, smio_exp_ops, func_fps);
ASSERT_TEST(herr == HALUTILS_SUCCESS, "smio_export_ops: Could not export"
ASSERT_TEST(herr == HUTILS_SUCCESS, "smio_export_ops: Could not export"
" fill SMIO ops description", err_fill_desc_ops, SMIO_ERR_EXPORT_OP);
err_fill_desc_ops:
......
......@@ -11,7 +11,7 @@
#include "sm_io.h"
#include "exp_ops_codes.h"
#include "errhand.h"
#include "hal_utils.h"
#include "hutils.h"
/* Undef ASSERT_ALLOC to avoid conflicting with other ASSERT_ALLOC */
#ifdef ASSERT_TEST
......@@ -61,9 +61,9 @@ void smio_startup (void *args, zctx_t *ctx, void *pipe)
/* We must export our service as the combination of the
* devio name (coming from devio parent) and our own name ID
* followed by an optional parameter coming from priv pointer */
char *inst_id_str = halutils_stringify_dec_key (th_args->inst_id);
char *inst_id_str = hutils_stringify_dec_key (th_args->inst_id);
ASSERT_ALLOC(inst_id_str, err_inst_id_str_alloc);
char *smio_service = halutils_concat_strings3 (th_args->service,
char *smio_service = hutils_concat_strings3 (th_args->service,
smio_mod_dispatch[th_args->smio_id].name, inst_id_str, ':');
ASSERT_ALLOC(smio_service, err_smio_service_alloc);
......@@ -107,7 +107,7 @@ err_call_init:
err_self_alloc:
/* We can't output this message at a later time as we depend on the smio_service
* variable. This is not so bad, though, as most of the time we will not fail
* in halutils_concat_strings () function */
* in hutils_concat_strings () function */
DBE_DEBUG (DBG_SM_IO | DBG_LVL_WARN, "[sm_io_bootstrap] SMIO Thread %s exiting ...\n",
smio_service);
free (smio_service);
......@@ -128,9 +128,9 @@ void *smio_config_defaults (void *args)
/* We must export our service as the combination of the
* devio name (coming from devio parent) and our own name ID
* followed by an optional parameter coming from priv pointer */
char *inst_id_str = halutils_stringify_dec_key (th_args->inst_id);
char *inst_id_str = hutils_stringify_dec_key (th_args->inst_id);
ASSERT_ALLOC(inst_id_str, err_inst_id_str_alloc);
char *smio_service = halutils_concat_strings3 (th_args->service,
char *smio_service = hutils_concat_strings3 (th_args->service,
smio_mod_dispatch[th_args->smio_id].name, inst_id_str, ':');
ASSERT_ALLOC(smio_service, err_smio_service_alloc);
......
......@@ -90,7 +90,7 @@ OBJS_EXTERNAL = ../../hal/sm_io/modules/sm_io_codes.o \
boards_INCLUDE_DIRS = -I../../../include/boards/$(BOARD)
# Include directories
INCLUDE_DIRS = -I. -I../../../include -I../liberrhand \
INCLUDE_DIRS = -I. -I../../../include -I../liberrhand -I../libhutils \
$(boards_INCLUDE_DIRS) \
-I../../hal/sm_io/modules \
-I../../hal/sm_io/modules/fmc130m_4ch \
......@@ -129,7 +129,10 @@ $(LIBBPMCLIENT)_CODE_HEADERS = ../../hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m
../../hal/sm_io/modules/sm_io_codes.h \
../../../include/acq_chan_gen_defs.h \
../../hal/hal_utils/dispatch_table.h \
../../hal/hal_utils/hal_utils_err.h \
../libhutils/hutils.h \
../libhutils/hutils_err.h \
../libhutils/hutils_math.h \
../libhutils/hutils_utils.h \
bpm_client_codes.h
$(LIBBPMCLIENT)_FUNC_EXPORTS = ../../hal/sm_io/modules/fmc130m_4ch/sm_io_fmc130m_4ch_exports.h \
......
......@@ -15,8 +15,11 @@ PWD = $(shell pwd)
LIBERRHAND = liberrhand
INSTALL_DIR ?= /usr/local
export INSTALL_DIR
# General C flags
CFLAGS = -std=gnu99 -O2
CFLAGS = -std=gnu99 -O2 -fPIC
# To enable this option, use: make ERRHAND_DBG=y
ifneq ($(ERRHAND_DBG),)
......@@ -92,9 +95,12 @@ OBJS_all = $(common_OBJS) $($(LIBERRHAND)_OBJS)
# Libraries suffixes
LIB_STATIC_SUFFIX = .a
LIB_SHARED_SUFFIX = .so
# Generate suitable names for static libraries
TARGET_STATIC = $(addsuffix $(LIB_STATIC_SUFFIX), $(OUT))
TARGET_SHARED = $(addsuffix $(LIB_SHARED_SUFFIX), $(OUT))
TARGET_SHARED_VER = $(addsuffix $(LIB_SHARED_SUFFIX).$(LIB_VER), $(OUT))
.PHONY: all clean mrproper install uninstall
......@@ -102,12 +108,16 @@ TARGET_STATIC = $(addsuffix $(LIB_STATIC_SUFFIX), $(OUT))
.SECONDARY: $(OBJS_all)
# Makefile rules
all: $(TARGET_STATIC)
all: $(TARGET_STATIC) $(TARGET_SHARED_VER)
# Compile static library
%.a: $$($$*_OBJS)
$(AR) rcs $@ $^
# Compile dynamic library
%.so.$(LIB_VER): $$($$*_OBJS) $(OBJ_REVISION)
$(CC) -shared -fPIC -Wl,-soname,$@ -o $@ $^ $(LDFLAGS)
# Pull in dependency info for *existing* .o files and don't complain if the
# corresponding .d file is not found
-include $(OBJS_all:.o=.d)
......@@ -140,8 +150,19 @@ all: $(TARGET_STATIC)
@rm -f $*.d.tmp
install:
$(foreach lib,$(TARGET_SHARED_VER),install -m 755 $(lib) $(INSTALL_DIR)/lib $(CMDSEP))
$(foreach lib,$(TARGET_SHARED),ln -sf $(lib).$(LIB_VER) $(INSTALL_DIR)/lib/$(lib) $(CMDSEP))
$(foreach lib,$(TARGET_SHARED),ln -sf $(lib).$(LIB_VER) $(INSTALL_DIR)/lib/$(lib).$(LIB_VER_MAJOR) $(CMDSEP))
$(foreach lib,$(TARGET_STATIC),install -m 755 $(lib) $(INSTALL_DIR)/lib $(CMDSEP))
$(foreach header,$($(LIBBPMCLIENT)_INST_HEADERS),install -m 755 $(header) $(INSTALL_DIR)/include $(CMDSEP))
uninstall:
$(foreach lib,$(TARGET_SHARED),rm -f $(INSTALL_DIR)/lib/$(lib).$(LIB_VER) $(CMDSEP))
$(foreach lib,$(TARGET_SHARED),rm -f $(INSTALL_DIR)/lib/$(lib) $(CMDSEP))
$(foreach lib,$(TARGET_SHARED),rm -f $(INSTALL_DIR)/lib/$(lib).$(LIB_VER_MAJOR) $(CMDSEP))
$(foreach lib,$(TARGET_STATIC),rm -f $(INSTALL_DIR)/lib/$(lib) $(CMDSEP))
$(foreach header,$(notdir $($(LIBBPMCLIENT)_INST_HEADERS)),rm -f \
$(INSTALL_DIR)/include/$(header) $(CMDSEP))
clean:
rm -f $(OBJS_all) $(OBJS_all:.o=.d)
......
#include "hutils.h"
#include "revision.h"
const char *build_revision = GIT_REVISION;
const char *build_date = __DATE__ " " __TIME__;
const char *build_user_name = GIT_USER_NAME;
const char *build_user_email = GIT_USER_EMAIL;
char *revision_clone_build_rev (void)
{
return hutils_clone_str (build_revision);
}
char *revision_clone_build_date (void)
{
return hutils_clone_str (build_date);
}
char *revision_clone_build_user_name (void)
{
return hutils_clone_str (build_user_name);
}
char *revision_clone_build_user_email (void)
{
return hutils_clone_str (build_user_email);
}
int revision_copy_build_revision (char *dest, size_t size)
{
return hutils_copy_str (dest, build_revision, size);
}
int revision_copy_build_date (char *dest, size_t size)
{
return hutils_copy_str (dest, build_date, size);
}
int revision_copy_build_user_name (char *dest, size_t size)
{
return hutils_copy_str (dest, build_user_name, size);
}
int revision_copy_build_user_email (char *dest, size_t size)
{
return hutils_copy_str (dest, build_user_email, size);
}
......@@ -13,4 +13,32 @@ extern const char *build_date;
extern const char *build_user_name;
extern const char *build_user_email;
/* Clone the build revision. Returns the cloned string is successfully or NULL
* on error */
char *revision_clone_build_revision (void);
/* Copies the build revision into a pre-allocated buffer. Returns a negative number
* on error and the number of copied bytes otherwise */
int revision_copy_build_revision (char *dest, size_t size);
/* Clone the build date. Returns the cloned string is successfully or NULL
* on error */
char *revision_clone_build_date (void);
/* Copies the build date into a pre-allocated buffer. Returns a negative number
* on error and the number of copied bytes otherwise */
int revision_copy_build_date (char *dest, size_t size);
/* Clone the build user name. Returns the cloned string is successfully or NULL
* on error */
char *revision_clone_build_user_name (void);
/* Copies the build user name into a pre-allocated buffer. Returns a negative number
* on error and the number of copied bytes otherwise */
int revision_copy_build_user_name (char *dest, size_t size);
/* Clone the build user email. Returns the cloned string is successfully or NULL
* on error */
char *revision_clone_build_user_email (void);
/* Copies the build user email into a pre-allocated buffer. Returns a negative number
* on error and the number of copied bytes otherwise */
int revision_copy_build_user_email (char *dest, size_t size);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment