Skip to content

Commit 1e1e990

Browse files
authored
Merge pull request #517 from jepler/test-515
Allow userspace components to include files relative to the location of the .comp file
2 parents df13360 + 497f132 commit 1e1e990

5 files changed

Lines changed: 20 additions & 1 deletion

File tree

src/hal/utils/halcompile.g

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,9 @@ def build_usr(tempdir, filename, mode, origfilename):
795795
makefile = os.path.join(tempdir, "Makefile")
796796
f = open(makefile, "w")
797797
print("%s: %s" % (binname, filename), file=f)
798-
print("\t$(CC) -I$(EMC2_HOME)/include -I/usr/include/linuxcnc -URTAPI -U__MODULE__ -DULAPI -Os %s -o $@ $< -Wl,-rpath,$(LIBDIR) -L$(LIBDIR) -llinuxcnchal %s" % (
798+
print("\t$(CC) -I%s -I$(EMC2_HOME)/include -I/usr/include/linuxcnc -URTAPI -U__MODULE__ -DULAPI -Os %s -o $@ $< -Wl,-rpath,$(LIBDIR) -L$(LIBDIR) -llinuxcnchal %s" % (
799+
800+
os.path.abspath(os.path.dirname(origfilename)),
799801
options.get("extra_compile_args", ""),
800802
options.get("extra_link_args", "")), file=f)
801803
print("include %s" % find_modinc(), file=f)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
[ -e "`dirname "$1"`/relative_header" ]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#define X 1
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
component relative_header;
2+
pin out bit out;
3+
include "local.h";
4+
license "GPL";
5+
option userspace yes;
6+
;;
7+
void user_mainloop(void) {
8+
FOR_ALL_INSTS() { out = ! out; }
9+
rtapi_delay(100 * 1000 * 1000);
10+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
set -e
3+
rm -f relative_header
4+
halcompile --compile relative_header.comp

0 commit comments

Comments
 (0)