From a6c0f075adde1ad988586446b9d1c3304d23cbeb Mon Sep 17 00:00:00 2001
From: Lorenzo Pivetta <lorenzo.pivetta@elettra.eu>
Date: Fri, 8 Jan 2021 11:49:31 +0100
Subject: [PATCH] Fixes to build on a fresh host

---
 Makefile             | 7 +++----
 compiler/nc/Makefile | 4 +++-
 include/sysconfig.h  | 0
 sysconfig.mk         | 3 +++
 4 files changed, 9 insertions(+), 5 deletions(-)
 mode change 100755 => 100644 include/sysconfig.h

diff --git a/Makefile b/Makefile
index 8fcf12e..b5c2b13 100644
--- a/Makefile
+++ b/Makefile
@@ -3,8 +3,6 @@
 #
 
 include sysconfig.mk
-NCHOME = .
-NCSRC = .
 #
 # When changing VERSION modify README, sysconfig.h !
 #
@@ -87,8 +85,9 @@ shared: libobjects
 	rm -f $(NCHOME)/lib/$(NCLIBSHSYMLINK)
 	mkdir -p $(NCHOME)/lib
 	$(LD) $(LDFLAGS) -o $(NCHOME)/lib/$(NCLIBSH) $(LIBOBJS)
-	ln -sf  $(NCHOME)/lib/$(NCLIBSH) $(NCHOME)/lib/$(SHSONAME)
-	ln -sf  $(NCHOME)/lib/$(SHSONAME) $(NCHOME)/lib/$(NCLIBSHSYMLINK)
+	cd $(NCHOME)/lib
+	ln -s $(NCLIBSH) $(SHSONAME)
+	ln -s $(SHSONAME) $(NCLIBSHSYMLINK)
 
 
 
diff --git a/compiler/nc/Makefile b/compiler/nc/Makefile
index 5005940..c77d6ac 100644
--- a/compiler/nc/Makefile
+++ b/compiler/nc/Makefile
@@ -9,7 +9,9 @@
 #               nc installed directly in $(NCHOME)/bin
 
 include ../../sysconfig.mk
-VPATH=          $(NCSRC)/compiler/nc
+# VPATH=          $(NCSRC)/compiler/nc
+NCSRC = ../..
+NCHOME = ../..
 
 OBJS =          main.o argtab.o getargs.o stoi.o
 SRC =           main.c argtab.c getargs.c stoi.c
diff --git a/include/sysconfig.h b/include/sysconfig.h
old mode 100755
new mode 100644
diff --git a/sysconfig.mk b/sysconfig.mk
index dc2c2ca..fedafd6 100644
--- a/sysconfig.mk
+++ b/sysconfig.mk
@@ -5,6 +5,9 @@ LIBSUBRELEASE = 1
 INST_DIR_LIB = /runtime
 INST_DIR_BIN = /runtime
 
+NCHOME = ${PWD}
+NCSRC = ${PWD}
+
 FLEXLIB = -ll
 MATHLIB = -lm
 
-- 
GitLab