tack on autoconf/automake build
This commit is contained in:
parent
34f150dc1c
commit
89818b0286
7 changed files with 134 additions and 56 deletions
32
.gitignore
vendored
32
.gitignore
vendored
|
|
@ -1,9 +1,27 @@
|
|||
aclocal.m4
|
||||
autom4te*.cache
|
||||
configure
|
||||
config.h*
|
||||
config.status
|
||||
libtool
|
||||
stamp-h*
|
||||
|
||||
Makefile
|
||||
Makefile.in
|
||||
.deps
|
||||
.libs
|
||||
|
||||
test-driver
|
||||
*.log
|
||||
*.trs
|
||||
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
/capn-test
|
||||
/capnpc-c
|
||||
/capn.a
|
||||
/gtest-all.a
|
||||
.cproject
|
||||
.project
|
||||
.settings
|
||||
*.lo
|
||||
*.la
|
||||
|
||||
capn-test
|
||||
capnpc-c
|
||||
|
||||
*.tar.gz
|
||||
|
|
|
|||
49
Makefile
49
Makefile
|
|
@ -1,49 +0,0 @@
|
|||
.PHONY: all clean test
|
||||
|
||||
LDFLAGS=-O2 -fPIC
|
||||
CFLAGS=-O2 -std=gnu11 -Wall -Wextra -fPIC -I. \
|
||||
-Wno-unused-function -Wno-missing-field-initializers -Wno-unused-parameter
|
||||
ifneq (,$(findstring gcc, $(CC)))
|
||||
# gcc's maybe-unintialized is too imprecise, disable it.
|
||||
# clang disbles this functionality by default and doesn't recognize the flag.
|
||||
# (check for CC that contains rather than equals 'gcc',
|
||||
# to accommodate using specific versions, like gcc-4.9 etc)
|
||||
CFLAGS += -Wno-maybe-uninitialized
|
||||
endif
|
||||
|
||||
GTEST_CFLAGS=-std=c++11 `gtest-config --cppflags --cxxflags`
|
||||
GTEST_LDFLAGS=`gtest-config --ldflags --libs`
|
||||
|
||||
OBJS=capn-malloc.o capn-stream.o capn.o
|
||||
prefix = /usr
|
||||
|
||||
all: capn.a capn.so capnpc-c test
|
||||
|
||||
clean:
|
||||
rm -f *.o *.so capnpc-c compiler/*.o *.a
|
||||
|
||||
%.o: %.c *.h *.inc compiler/*.h
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
capn.so: $(OBJS)
|
||||
$(CC) -shared $(LDFLAGS) $^ -o $@
|
||||
|
||||
capn.a: $(OBJS)
|
||||
$(AR) rcs $@ $^
|
||||
|
||||
capnpc-c: compiler/capnpc-c.o compiler/schema.capnp.o compiler/str.o capn.a
|
||||
$(CC) $(LDFLAGS) $^ -o $@
|
||||
|
||||
test: capn-test
|
||||
./capn-test
|
||||
|
||||
%-test.o: %-test.cpp *.h *.c *.inc
|
||||
$(CXX) --std=c++11 -g -I. `gtest-config --cppflags --cxxflags` -o $@ -c $<
|
||||
|
||||
capn-test: capn-test.o capn-stream-test.o compiler/test.capnp.o compiler/schema-test.o compiler/schema.capnp.o capn.a
|
||||
$(CXX) -std=c++11 -g -I. $^ `gtest-config --ldflags --libs` -o $@
|
||||
|
||||
install:
|
||||
install -c capnpc-c $(prefix)/bin/capnpc-c
|
||||
install -c capn.so $(prefix)/lib/capn.so
|
||||
install -c capn.a $(prefix)/lib/capn.a
|
||||
50
Makefile.am
Normal file
50
Makefile.am
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
ACLOCAL_AMFLAGS = -I m4
|
||||
AUTOMAKE_OPTIONS = foreign subdir-objects
|
||||
|
||||
lib_LTLIBRARIES =
|
||||
bin_PROGRAMS =
|
||||
check_PROGRAMS =
|
||||
EXTRA_DIST =
|
||||
noinst_HEADERS =
|
||||
include_HEADERS =
|
||||
|
||||
|
||||
|
||||
lib_LTLIBRARIES += libcapn.la
|
||||
libcapn_la_LDFLAGS = -version-info 1:0:0
|
||||
libcapn_la_SOURCES = \
|
||||
capn-malloc.c \
|
||||
capn-stream.c \
|
||||
capn.c
|
||||
|
||||
bin_PROGRAMS += capnpc-c
|
||||
capnpc_c_SOURCES = \
|
||||
compiler/capnpc-c.c \
|
||||
compiler/schema.capnp.c \
|
||||
compiler/str.c
|
||||
capnpc_c_LDADD = libcapn.la
|
||||
include_HEADERS += \
|
||||
capn.h
|
||||
|
||||
EXTRA_DIST += \
|
||||
capn-list.inc
|
||||
noinst_HEADERS += \
|
||||
compiler/str.h \
|
||||
compiler/schema.capnp.h \
|
||||
compiler/c++.capnp.h \
|
||||
compiler/test.capnp.h
|
||||
|
||||
if GTEST
|
||||
AM_CXXFLAGS = -std=gnu++11
|
||||
check_PROGRAMS += \
|
||||
capn-test
|
||||
capn_test_SOURCES = \
|
||||
capn-test.cpp \
|
||||
capn-stream-test.cpp \
|
||||
compiler/test.capnp.c \
|
||||
compiler/schema-test.cpp \
|
||||
compiler/schema.capnp.c
|
||||
capn_test_CFLAGS = $(GTEST_CFLAGS)
|
||||
capn_test_LDADD = libcapn.la $(GTEST_LDFLAGS)
|
||||
TESTS = capn-test
|
||||
endif
|
||||
2
ac/.gitignore
vendored
Normal file
2
ac/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
||||
56
configure.ac
Executable file
56
configure.ac
Executable file
|
|
@ -0,0 +1,56 @@
|
|||
AC_PREREQ(2.60)
|
||||
|
||||
AC_INIT(c-capnproto, 0.1, [])
|
||||
AC_CONFIG_SRCDIR(capn.h)
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_CONFIG_AUX_DIR([ac])
|
||||
|
||||
AC_CANONICAL_BUILD()
|
||||
AC_CANONICAL_HOST()
|
||||
AC_CANONICAL_TARGET()
|
||||
|
||||
AM_INIT_AUTOMAKE(1.14)
|
||||
AM_SILENT_RULES([yes])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
AC_USE_SYSTEM_EXTENSIONS
|
||||
|
||||
LT_INIT
|
||||
|
||||
AC_LANG([C])
|
||||
AC_PROG_CC
|
||||
AC_PROG_CXX
|
||||
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_LN_S
|
||||
|
||||
AC_ARG_ENABLE(werror,
|
||||
AS_HELP_STRING([--enable-werror], [enable -Werror (for developers only)]))
|
||||
if test x"${enable_werror}" = x"yes" ; then
|
||||
WERROR="-Werror"
|
||||
fi
|
||||
AC_SUBST(WERROR)
|
||||
|
||||
PKG_CHECK_MODULES(CAPNP, [capnp >= 0.5.2], [], [
|
||||
AC_MSG_ERROR([capnproto base package (0.5.2 or newer) not found])
|
||||
])
|
||||
|
||||
AC_ARG_WITH(gtest,
|
||||
AS_HELP_STRING([--without-gtest], [disable unit tests using gtest]))
|
||||
if test "x$with_gtest" != "xno" ; then
|
||||
AC_PATH_TOOL([GTEST_CONFIG], [gtest-config], [no])
|
||||
if test x"$GTEST_CONFIG" = x"no"; then
|
||||
AC_MSG_ERROR([gtest installation not found])
|
||||
fi
|
||||
GTEST_LDFLAGS="`${GTEST_CONFIG} --ldflags --libs`"
|
||||
GTEST_CFLAGS="`${GTEST_CONFIG} --cppflags --cxxflags`"
|
||||
gtest=yes
|
||||
fi
|
||||
AC_SUBST(GTEST_LDFLAGS)
|
||||
AC_SUBST(GTEST_CFLAGS)
|
||||
AM_CONDITIONAL([GTEST], [test "x$gtest" = "xyes"])
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
])
|
||||
AC_OUTPUT
|
||||
1
m4/.gitignore
vendored
Normal file
1
m4/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
*.m4
|
||||
Loading…
Add table
Add a link
Reference in a new issue