summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@colm.net>2021-12-04 09:48:13 -0800
committerGitHub <noreply@github.com>2021-12-04 09:48:13 -0800
commit0856b1a230400fc4358ef00fa422db986f685555 (patch)
tree720500f71252e0f92ca713512bdaf1c673db0fa9
parentc77aceb85139404a602fbd463f631235f99773d9 (diff)
parent7b2524ec0c036a3aab8e97e77c8a94b3dc12fe82 (diff)
downloadcolm-0856b1a230400fc4358ef00fa422db986f685555.tar.gz
Merge pull request #138 from viccie30/fix-out-of-tree-build
Some build system fixes
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac39
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/Makefile.am19
-rw-r--r--src/codevect.c1
-rw-r--r--src/main.cc124
-rw-r--r--src/rtvector.h35
-rw-r--r--src/version.h.in2
-rw-r--r--test/Makefile.am3
-rw-r--r--test/aapl.d/Makefile.am14
-rw-r--r--test/colm.d/Makefile.am11
-rw-r--r--test/colm.d/gentests.sh2
-rw-r--r--test/rlhc.d/Makefile.am14
-rw-r--r--test/rlparse.d/Makefile.am26
-rw-r--r--test/trans.d/Makefile.am22
-rwxr-xr-xtest/trans.d/gentests2
16 files changed, 142 insertions, 176 deletions
diff --git a/Makefile.am b/Makefile.am
index 0eb09cb4..aae162ef 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -24,3 +24,5 @@ SUBDIRS = src doc test
dist_doc_DATA = colm.vim
EXTRA_DIST = colm.vim sedsubst
ACLOCAL_AMFLAGS = -I m4
+
+export CC CFLAGS
diff --git a/configure.ac b/configure.ac
index fc034f28..9248bc63 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,6 +31,7 @@ AM_INIT_AUTOMAKE([foreign])
AC_CONFIG_MACRO_DIR([m4])
AC_SUBST(PUBDATE)
+AC_DEFINE_UNQUOTED([PUBDATE], ["$PUBDATE"])
AC_CHECK_SIZEOF([int])
AC_CHECK_SIZEOF([void *])
@@ -45,6 +46,7 @@ AC_PROG_CXX
AC_CHECK_TOOL(AR, ar)
AC_PROG_RANLIB
AC_PROG_LIBTOOL
+AC_PROG_LN_S
SED_SUBST=["\
-e 's|@CXX@|${CXX}|g' \
@@ -185,7 +187,7 @@ AC_ARG_WITH(subject,
SUBJ_RAGEL_JULIA_BIN="$withval/bin/ragel-julia"
],
[
- SUBJ_AAPL_CPPFLAGS='-I$(abs_top_builddir)/src/aapl'
+ SUBJ_AAPL_CPPFLAGS='-I$(abs_top_srcdir)/src/aapl'
SUBJ_COLM_BIN='$(abs_top_builddir)/src/colm'
SUBJ_COLM_CPPFLAGS='-I$(abs_top_builddir)/src/include'
@@ -415,26 +417,33 @@ AC_CHECK_FUNC(fopencookie,
[]
)
-mkdir -p src/include
-test -e src/include/colm || ln -s .. src/include/colm
-
-echo "#define VERSION \"$VERSION\"" > src/version.h
-echo "#define PUBDATE \"$PUBDATE\"" >> src/version.h
-
-if test "x$enable_static" = "xyes"; then
- AC_DEFINE([LINK_STATIC], [1], [Link static lib when invoking C compile and link])
-fi
-
-if test "x$enable_shared" = "xyes"; then
- AC_DEFINE([LINK_SHARED], [1], [Link shared lib when invoking C compile and link])
-fi
dnl
dnl Wrap up.
dnl
AC_SUBST(SED_SUBST)
-AC_CONFIG_HEADERS([src/config.h src/defs.h])
+AC_CONFIG_HEADERS([src/config.h src/defs.h src/version.h])
+m4_foreach_w([header],
+ [
+ config.h
+ bytecode.h
+ defs.h
+ debug.h
+ pool.h
+ input.h
+ pdarun.h
+ map.h
+ type.h
+ tree.h
+ struct.h
+ program.h
+ colm.h
+ internal.h
+ colmex.h
+ ],
+ [AC_CONFIG_LINKS(src/include/colm/header:src/header)]
+)
AC_OUTPUT([
Makefile
src/aapl/Makefile
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3d855523..651df849 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -56,7 +56,7 @@ add_library(libprog
buffer.h bytecode.h colm.h debug.h dotgen.h fsmcodegen.h fsmgraph.h
input.h keyops.h map.h compiler.h
parsetree.h pcheck.h pdacodegen.h pdagraph.h pdarun.h pool.h redbuild.h
- redfsm.h rtvector.h tree.h global.h colm.h parser.h cstring.h
+ redfsm.h tree.h global.h colm.h parser.h cstring.h
internal.h
resolve.cc lookup.cc synthesis.cc parsetree.cc
fsmstate.cc fsmbase.cc fsmattach.cc fsmmin.cc
diff --git a/src/Makefile.am b/src/Makefile.am
index c5fb6efa..09da4c47 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -52,13 +52,14 @@ endif
common_CFLAGS = \
-Wall \
- -DPREFIX='"$(prefix)"'
+ -DINCLUDEDIR='"$(includedir)"' \
+ -DLIBDIR='"$(libdir)"'
libprog_a_SOURCES = \
buffer.h bytecode.h colm.h debug.h dotgen.h fsmcodegen.h fsmgraph.h \
input.h keyops.h map.h compiler.h \
parsetree.h pcheck.h pdacodegen.h pdagraph.h pdarun.h pool.h redbuild.h \
- redfsm.h rtvector.h tree.h version.h global.h colm.h parser.h cstring.h \
+ redfsm.h tree.h version.h global.h colm.h parser.h cstring.h \
internal.h \
\
resolve.cc lookup.cc synthesis.cc parsetree.cc \
@@ -135,10 +136,10 @@ bootstrap1_LDADD = libprog.a libcolm.la
# and thus generates the sources used in the colm binary.
#
-gen/bootstrap2.pack: $(builddir)/colm-wrap bootstrap1$(EXEEXT) colm.lm
+gen/bootstrap2.pack: colm.lm $(builddir)/colm-wrap bootstrap1$(EXEEXT)
mkdir -p gen
$(builddir)/colm-wrap -w bootstrap1 -o $@ \
- -c -p gen/parse2.c -e gen/if2.h -x gen/if2.cc colm.lm
+ -c -p gen/parse2.c -e gen/if2.h -x gen/if2.cc $<
gen/parse2.c: gen/bootstrap2.pack
$(builddir)/colm-wrap -o $@ $<
@@ -157,10 +158,10 @@ bootstrap2_LDADD = libprog.a libcolm.la
endif
-gen/bootstrap3.pack: $(WRAP_PARSE_3_WITH) $(BUILD_PARSE_3_WITH) prog.lm colm.lm
+gen/bootstrap3.pack: prog.lm colm.lm $(WRAP_PARSE_3_WITH) $(BUILD_PARSE_3_WITH)
mkdir -p gen
$(WRAP_PARSE_3_WITH) -w $(BUILD_PARSE_3_WITH) -o $@ \
- -c -p gen/parse3.c -e gen/if3.h -x gen/if3.cc prog.lm
+ -c -p gen/parse3.c -e gen/if3.h -x gen/if3.cc -I$(srcdir) $<
gen/parse3.c: gen/bootstrap3.pack
$(WRAP_PARSE_3_WITH) -o $@ $<
@@ -184,8 +185,7 @@ colm_LDADD = libprog.a -lcolm
# with the following additional dependency.
CLEANFILES = \
- version.h \
- include/colm \
+ colm-wrap \
gen/parse1.c \
gen/if1.h \
gen/if1.cc \
@@ -199,6 +199,9 @@ CLEANFILES = \
gen/bootstrap2.pack \
gen/bootstrap3.pack
+distclean-local:
+ -rm -rf include
+
EXTRA_DIST = prog.lm colm.lm loadfinal.cc colm-wrap.sh
colm-wrap: colm-wrap.sh
diff --git a/src/codevect.c b/src/codevect.c
index 50b86336..e206371b 100644
--- a/src/codevect.c
+++ b/src/codevect.c
@@ -23,7 +23,6 @@
#include <string.h>
#include <stdlib.h>
-#include <colm/rtvector.h>
#include <colm/pdarun.h>
void init_rt_code_vect( struct rt_code_vect *vect )
diff --git a/src/main.cc b/src/main.cc
index 8ca395f0..06647497 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -78,6 +78,7 @@ const char *binaryFn = 0;
const char *exportHeaderFn = 0;
const char *exportCodeFn = 0;
const char *commitCodeFn = 0;
+const char *buildDir = 0;
const char *objectName = "colm_object";
bool exportCode = false;
bool hostAdapters = true;
@@ -441,67 +442,49 @@ void runOutputProgram()
/* We shall never return here! */
}
-void compileOutput( const char *argv0, const bool inSource, char *srcLocation )
+void compileOutput()
{
- /* Find the location of the colm program that is executing. */
- char *location = strdup( argv0 );
- char *last;
- int length = 1024 + strlen( intermedFn ) + strlen( binaryFn );
- if ( inSource ) {
- last = strrchr( location, '/' );
- assert( last != 0 );
- last[0] = 0;
- length += 3 * strlen( location );
- }
- else {
- last = location + strlen( location ) - 1;
- while ( true ) {
- if ( last == location ) {
- last[0] = '.';
- last[1] = 0;
- break;
- }
- if ( *last == '/' ) {
- last[0] = 0;
- break;
- }
- last -= 1;
- }
- }
+ const char *compiler = getenv( "CC" );
+ if ( compiler == 0 )
+ compiler = "gcc";
+
+ const char *cflags = getenv( "CFLAGS" );
+ if ( cflags == 0 )
+ cflags = "";
+
+ int length = 1024 + strlen( compiler ) + strlen( cflags ) +
+ strlen( intermedFn ) + strlen( binaryFn );
for ( ArgsVector::Iter af = additionalCodeFiles; af.lte(); af++ )
length += strlen( *af ) + 2;
for ( ArgsVector::Iter ip = includePaths; ip.lte(); ip++ )
length += strlen( *ip ) + 3;
for ( ArgsVector::Iter lp = libraryPaths; lp.lte(); lp++ )
length += strlen( *lp ) + 3;
-#define COMPILE_COMMAND_STRING "gcc -Wall -Wwrite-strings" \
- " -g" \
+ if ( buildDir != 0 )
+ length += strlen( buildDir ) * 3;
+#define COMPILE_COMMAND_STRING "%s -Wall -Wwrite-strings" \
+ " -g %s" \
" -o %s" \
" %s"
char *command = new char[length];
- if ( inSource ) {
+ if ( buildDir != 0 ) {
sprintf( command,
+ "%s/libtool --tag=CC --mode=link "
COMPILE_COMMAND_STRING
- " -I%s/../aapl"
- " -I%s/include"
- " -L%s"
-#if defined(LINK_STATIC)
- " %s/libcolm.a",
-#elif defined(LINK_SHARED)
- " %s/libcolm.so",
-#else
-# error "must enabled at least one of shared or static libs"
-#endif
-
- binaryFn, intermedFn, srcLocation,
- srcLocation, location, location );
+ " -I%s/src/include"
+ " -static"
+ " %s/src/libcolm.la",
+ buildDir, compiler, cflags,
+ binaryFn, intermedFn,
+ buildDir, buildDir );
}
else {
sprintf( command,
COMPILE_COMMAND_STRING
- " -I" PREFIX "/include"
- " -L" PREFIX "/lib"
- " -Wl,-rpath," PREFIX "/lib",
+ " -I" INCLUDEDIR
+ " -L" LIBDIR
+ " -Wl,-rpath," LIBDIR,
+ compiler, cflags,
binaryFn, intermedFn );
}
#undef COMPILE_COMMAND_STRING
@@ -518,7 +501,7 @@ void compileOutput( const char *argv0, const bool inSource, char *srcLocation )
strcat( command, *lp );
}
- if ( !inSource )
+ if ( buildDir == 0 )
strcat( command, " -lcolm" );
if( !compileOutputCommand( command ) && run )
@@ -527,46 +510,9 @@ void compileOutput( const char *argv0, const bool inSource, char *srcLocation )
delete[] command;
}
-bool inSourceTree( const char *argv0, char *&location )
-{
- const char *lastSlash = strrchr( argv0, '/' );
- if ( lastSlash != 0 ) {
- /* Take off the file name. */
- int rootLen = lastSlash - argv0;
-
- /* Create string for dir. */
- char *mainPath = new char[rootLen + 16];
- memcpy( mainPath, argv0, rootLen );
- mainPath[rootLen] = 0;
-
- /* If built using ldconfig then there will be a .libs dir. */
- lastSlash = strrchr( mainPath, '/' );
- if ( lastSlash != 0 ) {
- if ( strlen( lastSlash ) >= 6 && memcmp( lastSlash, "/.libs", 7 ) == 0 ) {
- rootLen = lastSlash - mainPath;
- mainPath[rootLen] = 0;
- }
- }
-
- strcpy( mainPath + rootLen, "/main.cc" );
-
- struct stat sb;
- int res = stat( mainPath, &sb );
- if ( res == 0 && S_ISREG( sb.st_mode ) ) {
- mainPath[rootLen] = 0;
- location = mainPath;
- return true;
- }
-
- delete[] mainPath;
- }
-
- return false;
-}
-
void processArgs( int argc, const char **argv )
{
- ParamCheck pc( "p:cD:e:x:I:L:vdliro:S:M:vHh?-:sVa:m:b:E:", argc, argv );
+ ParamCheck pc( "p:cD:e:x:I:L:vdliro:S:M:vHh?-:sVa:m:b:E:B:", argc, argv );
while ( pc.check() ) {
switch ( pc.state ) {
@@ -658,6 +604,9 @@ void processArgs( int argc, const char **argv )
case 'm':
commitCodeFn = pc.parameterArg;
break;
+ case 'B':
+ buildDir = pc.parameterArg;
+ break;
case 'E': {
const char *eq = strchr( pc.parameterArg, '=' );
@@ -811,11 +760,8 @@ int main(int argc, const char **argv)
if ( outStream != 0 )
delete outStream;
- if ( !gblLibrary ) {
- char *location = 0;
- bool inSource = inSourceTree( argv[0], location );
- compileOutput( argv[0], inSource, location );
- }
+ if ( !gblLibrary )
+ compileOutput();
if ( exportHeaderFn != 0 ) {
openExports();
diff --git a/src/rtvector.h b/src/rtvector.h
deleted file mode 100644
index e15d3f2a..00000000
--- a/src/rtvector.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2002-2018 Adrian Thurston <thurston@colm.net>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef _COLM_RTVECTOR_H
-#define _COLM_RTVECTOR_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _COLM_RT_VECTOR_H */
-
diff --git a/src/version.h.in b/src/version.h.in
new file mode 100644
index 00000000..753ae55b
--- /dev/null
+++ b/src/version.h.in
@@ -0,0 +1,2 @@
+#undef VERSION
+#undef PUBDATE
diff --git a/test/Makefile.am b/test/Makefile.am
index 4b6bba61..b239156c 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,6 +1,6 @@
SUBDIRS = . aapl.d colm.d rlhc.d rlparse.d trans.d
-noinst_SCRIPTS = subject.mk subject.sh
+check_SCRIPTS = subject.mk subject.sh
pkgdata_DATA = runtests
@@ -15,3 +15,4 @@ subject.sh: subject.sh.in Makefile
dist: dist.sh
@$(top_srcdir)/sedsubst $< $@ -w,+x $(SED_SUBST)
+CLEANFILES = subject.mk subject.sh
diff --git a/test/aapl.d/Makefile.am b/test/aapl.d/Makefile.am
index 906b94ef..03908032 100644
--- a/test/aapl.d/Makefile.am
+++ b/test/aapl.d/Makefile.am
@@ -4,7 +4,7 @@
CPPFLAGS = @SUBJ_AAPL_CPPFLAGS@
-noinst_PROGRAMS = \
+check_PROGRAMS = \
stress_avltree stress_avliter stress_avlmel \
stress_avlmelkey stress_avlitree stress_avlmap \
stress_avlset stress_avlimel stress_avlimelkey \
@@ -19,7 +19,7 @@ noinst_PROGRAMS = \
test_avlikeyless test_compare test_string \
test_rope
-noinst_SCRIPTS = gentests
+check_SCRIPTS = gentests
stress_avltree_SOURCES = stress_avltree.cpp util.cpp
stress_avliter_SOURCES = stress_avliter.cpp util.cpp
@@ -101,5 +101,13 @@ gentests: gentests.sh Makefile
#
#-include $(DEPS)
+CLEANFILES = gentests
+
clean-local:
- rm -Rf working
+ rm -Rf working *.exp
+
+check-local:
+ if test '$(builddir)' != '$(srcdir)'; then \
+ $(LN_S) -f '$(srcdir)/'*.exp '$(builddir)'; \
+ fi
+ '$(top_srcdir)/test/runtests'
diff --git a/test/colm.d/Makefile.am b/test/colm.d/Makefile.am
index e2a4c911..b0041329 100644
--- a/test/colm.d/Makefile.am
+++ b/test/colm.d/Makefile.am
@@ -1,4 +1,4 @@
-noinst_SCRIPTS = gentests
+check_SCRIPTS = gentests
EXTRA_DIST = \
gentests.sh \
@@ -185,6 +185,13 @@ EXTRA_DIST = \
gentests: gentests.sh Makefile
@$(top_srcdir)/sedsubst $< $@ -w,+x $(SED_SUBST)
+CLEANFILES = gentests
+
clean-local:
- rm -Rf working
+ rm -Rf working *.lm *.lmi *.in
+check-local:
+ if test '$(builddir)' != '$(srcdir)'; then \
+ $(LN_S) -f '$(srcdir)/'*.lm '$(srcdir)/'*.lmi '$(srcdir)/'*.in '$(builddir)'; \
+ fi
+ '$(top_srcdir)/test/runtests'
diff --git a/test/colm.d/gentests.sh b/test/colm.d/gentests.sh
index b5cc8982..783f002f 100644
--- a/test/colm.d/gentests.sh
+++ b/test/colm.d/gentests.sh
@@ -226,7 +226,7 @@ function runtests()
fi
else
# Compilation.
- echo $COLM_BIN $COMP $COLM_ADDS $LM '&>' $LOG >> $SH
+ echo $COLM_BIN -B ../.. $COMP $COLM_ADDS $LM '&>' $LOG >> $SH
echo "if [ \$? != 0 ]; then echo \"COMPILATION FAILED (see $LOG)\" >> $DIFF; fi" >> $SH
fi
diff --git a/test/rlhc.d/Makefile.am b/test/rlhc.d/Makefile.am
index 4e9ffe56..9d150771 100644
--- a/test/rlhc.d/Makefile.am
+++ b/test/rlhc.d/Makefile.am
@@ -16,10 +16,10 @@ RLHC_DEP = \
EXTRA_DIST = gentests rlhc.lm $(RLHC_DEP) $(CASES)
-noinst_PROGRAMS = rlhc
+check_PROGRAMS = rlhc
rlhc$(EXEEXT): rlhc.lm $(RLHC_DEP) $(COLM_BIN)
- $(COLM_BIN) -b rlhc_object -o $@ $<
+ $(COLM_BIN) -B '$(top_builddir)' -b rlhc_object -o $@ -I$(srcdir) $<
CASES = \
case/atoi1_c.c-C-F1--goto-backend.exp \
@@ -1089,5 +1089,13 @@ CASES = \
case/union.cpp-C-T1--goto-backend.exp \
case/union.cpp-C-T1--goto-backend.in
+CLEANFILES = gentests rlhc.c
+
clean-local:
- rm -Rf working
+ rm -Rf working case
+
+check-local:
+ if test '$(builddir)' != '$(srcdir)'; then \
+ $(LN_S) -f '$(srcdir)/gentests' '$(srcdir)/case' '$(builddir)'; \
+ fi
+ '$(top_srcdir)/test/runtests'
diff --git a/test/rlparse.d/Makefile.am b/test/rlparse.d/Makefile.am
index 54a14639..cbbc28dd 100644
--- a/test/rlparse.d/Makefile.am
+++ b/test/rlparse.d/Makefile.am
@@ -1,8 +1,8 @@
COLM_BIN = ../../src/colm
COLM_xCPPFLAGS = -I../../src/include
-COLM_xLDFLAGS = -L../../src
+COLM_xLDADD = ../../src/libcolm.la
-noinst_PROGRAMS = rlparse
+check_PROGRAMS = rlparse
rlparse_SOURCES = parse.c if.h if.cc commit.cc \
actparams.cc parsetree.cc parsedata.cc \
@@ -21,8 +21,8 @@ rlparse_SOURCES = parse.c if.h if.cc commit.cc \
svector.h
rlparse_CPPFLAGS = $(COLM_xCPPFLAGS)
-rlparse_LDADD = -lcolm
-rlparse_LDFLAGS = $(COLM_xLDFLAGS)
+rlparse_LDADD = $(COLM_xLDADD)
+rlparse_LDFLAGS = -static
EXTRA_DIST = \
reducer.lm rlparse.lm ragel.lm \
@@ -31,14 +31,24 @@ EXTRA_DIST = \
case/rlparse.h case/rlscan.rl \
case/rlscan--colm-frontend.exp case/rlscan--reduce-frontend.exp
-BUILT_SOURCES = parse.c if.h if.cc commit.cc
-
parse.c: rlparse.lm reducer.lm $(RAGEL_LM) $(COLM_BIN)
- $(COLM_BIN) -c -b rlparse_object -o $@ -e if.h -x if.cc -m commit.cc $<
+ $(COLM_BIN) -c -b rlparse_object -o $@ -e if.h -x if.cc -m commit.cc -I$(srcdir) $<
if.h: parse.c
if.cc: parse.c
commit.cc: parse.c
+load.cc: if.h
+reducer.cc: if.h
+
+CLEANFILES = gentests parse.c if.h if.cc commit.cc
+
clean-local:
- rm -Rf working
+ rm -Rf working case
+
+check-local:
+ if test '$(builddir)' != '$(srcdir)'; then \
+ $(LN_S) -f '$(srcdir)/gentests' '$(builddir)'; \
+ cp -pR -f '$(srcdir)/case' '$(builddir)'; \
+ fi
+ '$(top_srcdir)/test/runtests'
diff --git a/test/trans.d/Makefile.am b/test/trans.d/Makefile.am
index 4a9d8798..200cd10a 100644
--- a/test/trans.d/Makefile.am
+++ b/test/trans.d/Makefile.am
@@ -1,11 +1,9 @@
COLM_BIN = ../../src/colm
COLM_xCPPFLAGS = -I../../src/include
-COLM_xLDFLAGS = -L../../src
+COLM_xLDADD = ../../src/libcolm.la
-noinst_PROGRAMS = trans
-
-BUILT_SOURCES = trans.c
+check_PROGRAMS = trans
EXTRA_DIST = \
gentests \
@@ -29,12 +27,12 @@ EXTRA_DIST = \
$(CASES)
trans.c: trans.lm $(TRANS_DEPS) $(COLM_BIN)
- $(COLM_BIN) -b trans_object -c -o $@ $<
+ $(COLM_BIN) -b trans_object -c -o $@ -I$(srcdir) $<
trans_CPPFLAGS = $(COLM_xCPPFLAGS)
trans_SOURCES = actparams.cc trans.c main.c
-trans_LDADD = -lcolm
-trans_LDFLAGS = $(COLM_xLDFLAGS)
+trans_LDADD = $(COLM_xLDADD)
+trans_LDFLAGS = -static
CASES = \
case/any1_asm.rl \
@@ -378,5 +376,13 @@ CASES = \
case/zlen1_ruby.rl \
case/zlen1_rust.rl
+CLEANFILES = gentests trans.c
+
clean-local:
- rm -Rf working
+ rm -Rf working case
+
+check-local:
+ if test '$(builddir)' != '$(srcdir)'; then \
+ $(LN_S) -f '$(srcdir)/gentests' '$(srcdir)/case' '$(builddir)'; \
+ fi
+ '$(top_srcdir)/test/runtests'
diff --git a/test/trans.d/gentests b/test/trans.d/gentests
index a2064080..dd3bcf91 100755
--- a/test/trans.d/gentests
+++ b/test/trans.d/gentests
@@ -9,7 +9,7 @@ mkdir -p working
echo working/* | xargs rm -f
-[ $# = 0 ] && set -- `find case -type f -and -not -name '*_*' | sort`
+[ $# = 0 ] && set -- `find -H case -type f -and -not -name '*_*' | sort`
for fn; do