Can't portably pass filesystem paths as command-line macros to C.

Generate a header file instead and include that.
This commit is contained in:
Andrew Johnson
2009-07-28 21:08:37 +00:00
parent ba11940aad
commit d5bffdb13d
3 changed files with 39 additions and 8 deletions
+3 -3
View File
@@ -16,9 +16,6 @@ softIoc_DBD += base.dbd
softIoc_DBD += dlload.dbd
softIoc_DBD += system.dbd
ABS_INSTALL_DIR = $(shell $(PERL) $(TOOLS)/fullPathName.pl -e $(INSTALL_LOCATION))
USR_CXXFLAGS += -DEPICS_BASE="$(ABS_INSTALL_DIR)"
softIoc_SRCS += softIoc_registerRecordDeviceDriver.cpp
softIoc_SRCS_DEFAULT += softMain.cpp
softIoc_SRCS_vxWorks = -nil-
@@ -28,3 +25,6 @@ softIoc_LIBS = $(EPICS_BASE_IOC_LIBS)
DB += softIocExit.db
include $(TOP)/configure/RULES
epicsInstallDir.h:
$(PERL) ../makeInstallDir.pl $(INSTALL_LOCATION) > $@
+31
View File
@@ -0,0 +1,31 @@
eval 'exec perl -S $0 ${1+"$@"}' # -*- Mode: perl -*-
if $running_under_some_shell; # registerRecordDeviceDriver
#*************************************************************************
# Copyright (c) 2009 UChicago Argonne LLC, as Operator of Argonne
# National Laboratory.
# EPICS BASE is distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution.
#*************************************************************************
use strict;
use FindBin qw($Bin);
use lib "$Bin/../../lib/perl";
use EPICS::Path;
die "Path to INSTALL_LOCATION missing\n" unless @ARGV == 1;
my $path = AbsPath(shift);
$path =~ s/\\/\\\\/gx;
print "/* THIS IS A GENERATED FILE. DO NOT EDIT! */\n",
"\n",
"#ifndef INC_epicsInstallDir_H\n",
"#define INC_epicsInstallDir_H\n",
"\n",
"#define EPICS_BASE \"$path\"\n",
"\n",
"#endif /* INC_epicsInstallDir_H */\n";
+5 -5
View File
@@ -70,16 +70,16 @@
#include "asDbLib.h"
#include "iocInit.h"
#include "iocsh.h"
#include "epicsInstallDir.h"
extern "C" int softIoc_registerRecordDeviceDriver(struct dbBase *pdbbase);
#define QUOTE(x) #x
#define DBD_FILE(top) QUOTE(top) "/dbd/softIoc.dbd"
#define EXIT_FILE(top) QUOTE(top) "/db/softIocExit.db"
#define DBD_FILE EPICS_BASE "/dbd/softIoc.dbd"
#define EXIT_FILE EPICS_BASE "/db/softIocExit.db"
const char *arg0;
const char *base_dbd = DBD_FILE(EPICS_BASE);
const char *exit_db = EXIT_FILE(EPICS_BASE);
const char *base_dbd = DBD_FILE;
const char *exit_db = EXIT_FILE;
static void exitSubroutine(subRecord *precord) {