Hi,
In order to run:

$ CUSTOM_CFLAGS="-l otherlib" halcompile -c demo.comp

I suggest change code like this:

$ git diff halcompile.g
diff --git a/src/hal/utils/halcompile.g b/src/hal/utils/halcompile.g
index 35b8f6903..8f204a8d5 100644
--- a/src/hal/utils/halcompile.g
+++ b/src/hal/utils/halcompile.g
@@ -708,9 +708,13 @@ def build_usr(tempdir, filename, mode, origfilename):
     binname = os.path.basename(os.path.splitext(filename)[0])

     makefile = os.path.join(tempdir, "Makefile")
+    custom_env = os.getenv("CUSTOM_CFLAGS")
+    if custom_env is None:
+        custom_env = ""
     f = open(makefile, "w")
     print >>f, "%s: %s" % (binname, filename)
-    print >>f, "\t$(CC) $(EXTRA_CFLAGS) -URTAPI -U__MODULE__ -DULAPI
-Os %s -o $@ $< -Wl,-rpath,$(LIBDIR) -L$(LIBDIR) -llinuxcnchal %s" % (
+    print >>f, "\t$(CC) %s $(EXTRA_CFLAGS) -URTAPI -U__MODULE__ -DULAPI
-Os %s -o $@ $< -Wl,-rpath,$(LIBDIR) -L$(LIBDIR) -llinuxcnchal %s" % (
+        custom_env,
         options.get("extra_compile_args", ""),
         options.get("extra_link_args", ""))
     print >>f, "include %s" % find_modinc()

`print >>f, also should change to f.write().

-- 
Trần Ngọc Quân.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to