added conditionals ENABLE_STATIC and ENABLE_SHARED
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
a5d13e17e5
commit
4a6da0b386
12
Makefile.am
12
Makefile.am
@ -42,14 +42,22 @@ hclgo_DEPENDENCIES = hclgo.bin
|
|||||||
## let the linker to move hclgo.bin to the actual target
|
## let the linker to move hclgo.bin to the actual target
|
||||||
hclgo_LINK = cp -pf hclgo.bin hclgo$(EXEEXT) || echo "FAILED TO LINK"
|
hclgo_LINK = cp -pf hclgo.bin hclgo$(EXEEXT) || echo "FAILED TO LINK"
|
||||||
|
|
||||||
|
if ENABLE_STATIC
|
||||||
|
CGO_CFLAGS_EXTRA="-static"
|
||||||
|
CGO_LDFLAGS_EXTRA="-static"
|
||||||
|
else
|
||||||
|
CGO_CFLAGS_EXTRA=""
|
||||||
|
CGO_LDFLAGS_EXTRA=""
|
||||||
|
endif
|
||||||
|
|
||||||
hclgo.bin: lib/libhcl.la $(hclgo_OBJECTS)
|
hclgo.bin: lib/libhcl.la $(hclgo_OBJECTS)
|
||||||
cp -pf $(srcdir)/go.mod $(builddir)/go.mod >/dev/null 2>&1 || true
|
cp -pf $(srcdir)/go.mod $(builddir)/go.mod >/dev/null 2>&1 || true
|
||||||
chmod u+w $(builddir)/go.mod ## with `make distcheck`, the echo's redirection to the file fails without this permission change
|
chmod u+w $(builddir)/go.mod ## with `make distcheck`, the echo's redirection to the file fails without this permission change
|
||||||
[ -f $(srcdir)/go.sum ] && cp -pf $(srcdir)/go.sum $(builddir)/go.sum >/dev/null 2>&1 || true
|
[ -f $(srcdir)/go.sum ] && cp -pf $(srcdir)/go.sum $(builddir)/go.sum >/dev/null 2>&1 || true
|
||||||
## ---------------------------------------------------------------
|
## ---------------------------------------------------------------
|
||||||
CC=$(CC) \
|
CC=$(CC) \
|
||||||
CGO_CFLAGS="-I$(abs_srcdir)/lib -I$(abs_builddir)/lib $(CFLAGS)" \
|
CGO_CFLAGS="-I$(abs_srcdir)/lib -I$(abs_builddir)/lib $(CFLAGS) $(CGO_CFLAGS_EXTRA)" \
|
||||||
CGO_LDFLAGS="-L$(abs_builddir)/lib -L$(abs_builddir)/lib/.libs -lhcl -ldl $(LIBM)" \
|
CGO_LDFLAGS="-L$(abs_builddir)/lib -L$(abs_builddir)/lib/.libs -lhcl -ldl $(LIBM) $(CGO_LDFLAGS_EXTRA)" \
|
||||||
go build -C $(srcdir) -ldflags "-X 'main.BINDIR=$(bindir)' -X 'main.SBINDIR=$(sbindir)' -X 'main.LIBDIR=$(libdir)' -X 'main.SYSCONFDIR=$(sysconfdir)'" -x -o $(abs_builddir)/hclgo.bin -modfile $(abs_builddir)/go.mod
|
go build -C $(srcdir) -ldflags "-X 'main.BINDIR=$(bindir)' -X 'main.SBINDIR=$(sbindir)' -X 'main.LIBDIR=$(libdir)' -X 'main.SYSCONFDIR=$(sysconfdir)'" -x -o $(abs_builddir)/hclgo.bin -modfile $(abs_builddir)/go.mod
|
||||||
## ---------------------------------------------------------------
|
## ---------------------------------------------------------------
|
||||||
go clean -C $(srcdir) -x -modfile $(abs_builddir)/go.mod
|
go clean -C $(srcdir) -x -modfile $(abs_builddir)/go.mod
|
||||||
|
@ -373,6 +373,10 @@ DIST_SUBDIRS = $(SUBDIRS) pas
|
|||||||
|
|
||||||
@ENABLE_HCLGO_TRUE@hclgo_DEPENDENCIES = hclgo.bin
|
@ENABLE_HCLGO_TRUE@hclgo_DEPENDENCIES = hclgo.bin
|
||||||
@ENABLE_HCLGO_TRUE@hclgo_LINK = cp -pf hclgo.bin hclgo$(EXEEXT) || echo "FAILED TO LINK"
|
@ENABLE_HCLGO_TRUE@hclgo_LINK = cp -pf hclgo.bin hclgo$(EXEEXT) || echo "FAILED TO LINK"
|
||||||
|
@ENABLE_HCLGO_TRUE@@ENABLE_STATIC_FALSE@CGO_CFLAGS_EXTRA = ""
|
||||||
|
@ENABLE_HCLGO_TRUE@@ENABLE_STATIC_TRUE@CGO_CFLAGS_EXTRA = "-static"
|
||||||
|
@ENABLE_HCLGO_TRUE@@ENABLE_STATIC_FALSE@CGO_LDFLAGS_EXTRA = ""
|
||||||
|
@ENABLE_HCLGO_TRUE@@ENABLE_STATIC_TRUE@CGO_LDFLAGS_EXTRA = "-static"
|
||||||
all: all-recursive
|
all: all-recursive
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
@ -938,8 +942,8 @@ clean-local:
|
|||||||
@ENABLE_HCLGO_TRUE@ chmod u+w $(builddir)/go.mod ## with `make distcheck`, the echo's redirection to the file fails without this permission change
|
@ENABLE_HCLGO_TRUE@ chmod u+w $(builddir)/go.mod ## with `make distcheck`, the echo's redirection to the file fails without this permission change
|
||||||
@ENABLE_HCLGO_TRUE@ [ -f $(srcdir)/go.sum ] && cp -pf $(srcdir)/go.sum $(builddir)/go.sum >/dev/null 2>&1 || true
|
@ENABLE_HCLGO_TRUE@ [ -f $(srcdir)/go.sum ] && cp -pf $(srcdir)/go.sum $(builddir)/go.sum >/dev/null 2>&1 || true
|
||||||
@ENABLE_HCLGO_TRUE@ CC=$(CC) \
|
@ENABLE_HCLGO_TRUE@ CC=$(CC) \
|
||||||
@ENABLE_HCLGO_TRUE@ CGO_CFLAGS="-I$(abs_srcdir)/lib -I$(abs_builddir)/lib $(CFLAGS)" \
|
@ENABLE_HCLGO_TRUE@ CGO_CFLAGS="-I$(abs_srcdir)/lib -I$(abs_builddir)/lib $(CFLAGS) $(CGO_CFLAGS_EXTRA)" \
|
||||||
@ENABLE_HCLGO_TRUE@ CGO_LDFLAGS="-L$(abs_builddir)/lib -L$(abs_builddir)/lib/.libs -lhcl -ldl $(LIBM)" \
|
@ENABLE_HCLGO_TRUE@ CGO_LDFLAGS="-L$(abs_builddir)/lib -L$(abs_builddir)/lib/.libs -lhcl -ldl $(LIBM) $(CGO_LDFLAGS_EXTRA)" \
|
||||||
@ENABLE_HCLGO_TRUE@ go build -C $(srcdir) -ldflags "-X 'main.BINDIR=$(bindir)' -X 'main.SBINDIR=$(sbindir)' -X 'main.LIBDIR=$(libdir)' -X 'main.SYSCONFDIR=$(sysconfdir)'" -x -o $(abs_builddir)/hclgo.bin -modfile $(abs_builddir)/go.mod
|
@ENABLE_HCLGO_TRUE@ go build -C $(srcdir) -ldflags "-X 'main.BINDIR=$(bindir)' -X 'main.SBINDIR=$(sbindir)' -X 'main.LIBDIR=$(libdir)' -X 'main.SYSCONFDIR=$(sysconfdir)'" -x -o $(abs_builddir)/hclgo.bin -modfile $(abs_builddir)/go.mod
|
||||||
@ENABLE_HCLGO_TRUE@ go clean -C $(srcdir) -x -modfile $(abs_builddir)/go.mod
|
@ENABLE_HCLGO_TRUE@ go clean -C $(srcdir) -x -modfile $(abs_builddir)/go.mod
|
||||||
|
|
||||||
|
30
configure
vendored
30
configure
vendored
@ -675,6 +675,10 @@ ENABLE_LIBUNWIND_FALSE
|
|||||||
ENABLE_LIBUNWIND_TRUE
|
ENABLE_LIBUNWIND_TRUE
|
||||||
ENABLE_LIBLTDL_FALSE
|
ENABLE_LIBLTDL_FALSE
|
||||||
ENABLE_LIBLTDL_TRUE
|
ENABLE_LIBLTDL_TRUE
|
||||||
|
ENABLE_SHARED_FALSE
|
||||||
|
ENABLE_SHARED_TRUE
|
||||||
|
ENABLE_STATIC_FALSE
|
||||||
|
ENABLE_STATIC_TRUE
|
||||||
ENABLE_STATIC_MODULE_FALSE
|
ENABLE_STATIC_MODULE_FALSE
|
||||||
ENABLE_STATIC_MODULE_TRUE
|
ENABLE_STATIC_MODULE_TRUE
|
||||||
ENABLE_DYNAMIC_MODULE_FALSE
|
ENABLE_DYNAMIC_MODULE_FALSE
|
||||||
@ -18717,6 +18721,24 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if test "x${enable_static_is}" = "xyes"; then
|
||||||
|
ENABLE_STATIC_TRUE=
|
||||||
|
ENABLE_STATIC_FALSE='#'
|
||||||
|
else
|
||||||
|
ENABLE_STATIC_TRUE='#'
|
||||||
|
ENABLE_STATIC_FALSE=
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x${enable_shared_is}" = "xyes"; then
|
||||||
|
ENABLE_SHARED_TRUE=
|
||||||
|
ENABLE_SHARED_FALSE='#'
|
||||||
|
else
|
||||||
|
ENABLE_SHARED_TRUE='#'
|
||||||
|
ENABLE_SHARED_FALSE=
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Check whether --enable-libltdl was given.
|
# Check whether --enable-libltdl was given.
|
||||||
if test ${enable_libltdl+y}
|
if test ${enable_libltdl+y}
|
||||||
then :
|
then :
|
||||||
@ -19010,6 +19032,14 @@ if test -z "${ENABLE_STATIC_MODULE_TRUE}" && test -z "${ENABLE_STATIC_MODULE_FAL
|
|||||||
as_fn_error $? "conditional \"ENABLE_STATIC_MODULE\" was never defined.
|
as_fn_error $? "conditional \"ENABLE_STATIC_MODULE\" was never defined.
|
||||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||||
fi
|
fi
|
||||||
|
if test -z "${ENABLE_STATIC_TRUE}" && test -z "${ENABLE_STATIC_FALSE}"; then
|
||||||
|
as_fn_error $? "conditional \"ENABLE_STATIC\" was never defined.
|
||||||
|
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||||
|
fi
|
||||||
|
if test -z "${ENABLE_SHARED_TRUE}" && test -z "${ENABLE_SHARED_FALSE}"; then
|
||||||
|
as_fn_error $? "conditional \"ENABLE_SHARED\" was never defined.
|
||||||
|
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||||
|
fi
|
||||||
if test -z "${ENABLE_LIBLTDL_TRUE}" && test -z "${ENABLE_LIBLTDL_FALSE}"; then
|
if test -z "${ENABLE_LIBLTDL_TRUE}" && test -z "${ENABLE_LIBLTDL_FALSE}"; then
|
||||||
as_fn_error $? "conditional \"ENABLE_LIBLTDL\" was never defined.
|
as_fn_error $? "conditional \"ENABLE_LIBLTDL\" was never defined.
|
||||||
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||||||
|
@ -617,6 +617,11 @@ then
|
|||||||
fi
|
fi
|
||||||
AM_CONDITIONAL(ENABLE_STATIC_MODULE, test "x${enable_static_module_is}" = "xyes")
|
AM_CONDITIONAL(ENABLE_STATIC_MODULE, test "x${enable_static_module_is}" = "xyes")
|
||||||
|
|
||||||
|
|
||||||
|
dnl ===== conditionals - ENABLE_STATIC and ENABLE_SHARED =====
|
||||||
|
AM_CONDITIONAL(ENABLE_STATIC, test "x${enable_static_is}" = "xyes")
|
||||||
|
AM_CONDITIONAL(ENABLE_SHARED, test "x${enable_shared_is}" = "xyes")
|
||||||
|
|
||||||
dnl ===== enable-libltdl =====
|
dnl ===== enable-libltdl =====
|
||||||
AC_ARG_ENABLE([libltdl],
|
AC_ARG_ENABLE([libltdl],
|
||||||
[AS_HELP_STRING([--enable-libltdl],[use libltdl(default. no)])],
|
[AS_HELP_STRING([--enable-libltdl],[use libltdl(default. no)])],
|
||||||
|
6
main.go
6
main.go
@ -81,8 +81,10 @@ func handle_arguments(param *Param) error {
|
|||||||
return fmt.Errorf("command line error - %s", err.Error())
|
return fmt.Errorf("command line error - %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
if fs.NArg() != 1 {
|
if fs.NArg() < 1 {
|
||||||
return fmt.Errorf("no input file or too many input files specified")
|
return fmt.Errorf("no input file specified")
|
||||||
|
} else if fs.NArg() > 1 {
|
||||||
|
return fmt.Errorf("too many input files specified")
|
||||||
}
|
}
|
||||||
|
|
||||||
param.input_file = fs.Arg(0);
|
param.input_file = fs.Arg(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user