aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2019-01-05 19:10:49 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2019-01-05 19:10:49 +0800
commitd8975a2ca3ec0d8f3e95bd6b063e1d63232d129c (patch)
treee48f32658c7752f3bf9d88ac06496884193eddbf
parent3048d5c12551812d67e461c5bfdcc56d3bdd9976 (diff)
downloadtangerine-mcl-d8975a2ca3ec0d8f3e95bd6b063e1d63232d129c.tar.gz
tangerine-mcl-d8975a2ca3ec0d8f3e95bd6b063e1d63232d129c.tar.zst
tangerine-mcl-d8975a2ca3ec0d8f3e95bd6b063e1d63232d129c.zip
set CGO_* for cgo
-rw-r--r--Makefile11
-rw-r--r--ffi/go/mcl/mcl.go6
2 files changed, 8 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index c7f541d..7920d61 100644
--- a/Makefile
+++ b/Makefile
@@ -206,16 +206,17 @@ asm: $(LLVM_SRC)
$(LOW_ASM_OBJ): $(LOW_ASM_SRC)
$(ASM) $<
-# set PATH for mingw, set LD_RUN_PATH is for other env
+# set PATH for mingw, set LD_LIBRARY_PATH is for other env
COMMON_LIB_PATH="../../../lib"
+PATH_VAL=$$PATH:$(COMMON_LIB_PATH) LD_LIBRARY_PATH=$(COMMON_LIB_PATH) DYLD_LIBRARY_PATH=$(COMMON_LIB_PATH) CGO_CFLAGS="-I$(shell pwd)/include" CGO_LDFLAGS="-L../../../lib"
test_go256: $(MCL_SLIB) $(BN256_SLIB)
- cd ffi/go/mcl && env PATH=$$PATH:$(COMMON_LIB_PATH) LD_RUN_PATH=$(COMMON_LIB_PATH) DYLD_LIBRARY_PATH=$(COMMON_LIB_PATH) go test -tags bn256 .
+ cd ffi/go/mcl && env PATH=$(PATH_VAL) go test -tags bn256 .
test_go384: $(MCL_SLIB) $(BN384_SLIB)
- cd ffi/go/mcl && env PATH=$$PATH:$(COMMON_LIB_PATH) LD_RUN_PATH=$(COMMON_LIB_PATH) DYLD_LIBRARY_PATH=$(COMMON_LIB_PATH) go test -tags bn384 .
+ cd ffi/go/mcl && env PATH=$(PATH_VAL) go test -tags bn384 .
test_go384_256: $(MCL_SLIB) $(BN384_256_SLIB)
- cd ffi/go/mcl && env PATH=$$PATH:$(COMMON_LIB_PATH) LD_RUN_PATH=$(COMMON_LIB_PATH) DYLD_LIBRARY_PATH=$(COMMON_LIB_PATH) go test -tags bn384_256 .
+ cd ffi/go/mcl && env PATH=$(PATH_VAL) go test -tags bn384_256 .
test_go:
$(MAKE) test_go256
@@ -333,7 +334,7 @@ update_cybozulib:
cp -a $(addprefix ../cybozulib/,$(wildcard include/cybozu/*.hpp)) include/cybozu/
clean:
- $(RM) $(LIB_DIR)/*.a $(EXE_DIR)/*.$(LIB_SUF) $(OBJ_DIR)/*.o $(OBJ_DIR)/*.d $(EXE_DIR)/*.exe $(GEN_EXE) $(ASM_OBJ) $(LIB_OBJ) $(BN256_OBJ) $(BN384_OBJ) $(BN512_OBJ) $(LLVM_SRC) $(FUNC_LIST) src/*.ll lib/*.a
+ $(RM) $(LIB_DIR)/*.a $(LIB_DIR)/*.$(LIB_SUF) $(OBJ_DIR)/*.o $(OBJ_DIR)/*.obj $(OBJ_DIR)/*.d $(EXE_DIR)/*.exe $(GEN_EXE) $(ASM_OBJ) $(LIB_OBJ) $(BN256_OBJ) $(BN384_OBJ) $(BN512_OBJ) $(LLVM_SRC) $(FUNC_LIST) src/*.ll lib/*.a
ALL_SRC=$(SRC_SRC) $(TEST_SRC) $(SAMPLE_SRC)
DEPEND_FILE=$(addprefix $(OBJ_DIR)/, $(addsuffix .d,$(basename $(ALL_SRC))))
diff --git a/ffi/go/mcl/mcl.go b/ffi/go/mcl/mcl.go
index 7a428b3..a0c8bb4 100644
--- a/ffi/go/mcl/mcl.go
+++ b/ffi/go/mcl/mcl.go
@@ -1,13 +1,11 @@
package mcl
/*
-#cgo CFLAGS:-I../../../include
-#cgo LDFLAGS:-L../../../lib
#cgo bn256 CFLAGS:-DMCLBN_FP_UNIT_SIZE=4
-#cgo bn256 LDFLAGS:-lmclbn256 -lmcl
#cgo bn384 CFLAGS:-DMCLBN_FP_UNIT_SIZE=6
-#cgo bn384 LDFLAGS:-lmclbn384 -lmcl
#cgo bn384_256 CFLAGS:-DMCLBN_FP_UNIT_SIZE=6 -DMCLBN_FR_UNIT_SIZE=4
+#cgo bn256 LDFLAGS:-lmclbn256 -lmcl
+#cgo bn384 LDFLAGS:-lmclbn384 -lmcl
#cgo bn384_256 LDFLAGS:-lmclbn384_256 -lmcl
#include <mcl/bn.h>
*/