Commit eb539b52 authored by Wesley W. Terpstra's avatar Wesley W. Terpstra

api: use automake build system

parent 84894459
*/*.o
etherbone.def
etherbone.dll
libetherbone.dll.a
libetherbone.a
libetherbone.so*
# Targets
libetherbone.la
# Compilation junk
*.lo
*.o
.libs
.deps
.dirstamp
# Automake junk
aclocal.m4
auto
autom4te.cache
config.h
config.h.in
config.log
config.status
configure
etherbone.pc
libtool
Makefile.in
Makefile
stamp-h1
# The installation prefix default to /usr/local, but can be set on the cmdline
PREFIX ?= /usr/local
STAGING ?=
EXTRA_FLAGS ?=
#BUILD = lm32
#BUILD = win32
BUILD = unix
ifeq ($(BUILD), lm32)
TARGET = lm32-elf-
FLAGS = -I/home/mkreider/hdlprojects/wrpc-sw/ptp-noposix/libptpnetif -I/home/mkreider/hdlprojects/wrpc-sw/lib
endif
ifeq ($(BUILD), win32)
LIBS = -lwsock32 -lws2_32
LIBRARY = etherbone.dll
EXTRA = libetherbone.dll.a
endif
ifeq ($(BUILD), unix)
FLAGS = -fPIC
LIBS = -Wl,-rpath,$(PREFIX)/lib
LIBRARY = libetherbone.so
EXTRA = libetherbone.so.*
endif
ifeq ($(BUILD), lm32)
TOOLS =
TESTS =
CPLUSPLUS =
TRANSPORT = transport/lm32.c
else
TOOLS = tools/eb-read tools/eb-write tools/eb-put tools/eb-get tools/eb-snoop tools/eb-ls tools/eb-find tools/eb-tunnel tools/eb-discover
TESTS = test/sizes test/loopback test/etherbonetest
CPLUSPLUS = glue/cplusplus.cpp
TRANSPORT = transport/posix-ip.c \
transport/posix-udp.c \
transport/posix-tcp.c \
transport/tunnel.c \
transport/dev.c \
transport/transports.c \
transport/run.c
endif
ARCHIVE = libetherbone.a
FLAGS := $(FLAGS) -Wall -O2
#FLAGS := $(FLAGS) -DEB_USE_DYNAMIC # deterministic untill table overflow (default)
#FLAGS := $(FLAGS) -DEB_USE_STATIC=200 # fully deterministic
#FLAGS := $(FLAGS) -DEB_USE_MALLOC # non-deterministic
#FLAGS := $(FLAGS) -DDISABLE_SLAVE
#FLAGS := $(FLAGS) -DDISABLE_MASTER
CFLAGS = $(EXTRA_FLAGS) $(FLAGS) -Wmissing-declarations -Wmissing-prototypes
CXXFLAGS= $(EXTRA_FLAGS) $(FLAGS)
CC = $(TARGET)gcc
CXX = $(TARGET)g++
OBJECTS = $(patsubst %.cpp,%.o,$(patsubst %.c,%.o,$(SOURCES)))
SOURCES = memory/static.c \
memory/dynamic.c \
memory/array.c \
memory/malloc.c \
format/slave.c \
format/master.c \
glue/widths.c \
glue/operation.c \
glue/cycle.c \
glue/device.c \
glue/format.c \
glue/socket.c \
glue/handler.c \
glue/readwrite.c \
glue/strncasecmp.c \
glue/sdb.c \
$(CPLUSPLUS) \
$(TRANSPORT)
all: glue/version.h $(TOOLS) $(TESTS) $(ARCHIVE) $(LIBRARY)
install: all
mkdir -p $(STAGING)$(PREFIX)/bin $(STAGING)$(PREFIX)/include $(STAGING)$(PREFIX)/lib/pkgconfig
cp -d $(LIBRARY) $(EXTRA) $(ARCHIVE) $(STAGING)$(PREFIX)/lib
cp etherbone.h $(STAGING)$(PREFIX)/include
sed "s#@PREFIX@#$(PREFIX)#" < etherbone.pc.in > $(STAGING)$(PREFIX)/lib/pkgconfig/etherbone.pc
cp $(TOOLS) $(STAGING)$(PREFIX)/bin
glue/version.h::
git log -n1 --pretty="format:%H" . > git.version_full
git log -n1 --pretty="format:%ci" . > git.date_full
cut -b1-8 < git.version_full > git.version_short
date +%Y%m%d -f git.date_full > git.date_short
sed 's/@EB_VERSION_FULL@/'"`cat git.version_full`"'/;s/@EB_VERSION_SHORT@/'"`cat git.version_short`"'/;s/@EB_DATE_FULL@/'"`cat git.date_full`"'/;s/@EB_DATE_SHORT@/'"`cat git.date_short`"'/' < $@.in > $@.tmp
if ! test -f $@ || ! diff $@ $@.tmp > /dev/null; then mv $@.tmp $@; fi
rm -f $@.tmp git.version_full git.date_full git.version_short git.date_short
$(ARCHIVE): $(OBJECTS)
rm -f $@
$(TARGET)ar rcs $@ $^
$(TARGET)ranlib $@
etherbone.dll: $(OBJECTS)
$(TARGET)g++ $(CXXFLAGS) -shared -Wl,--out-implib=libetherbone.dll.a -Wl,--output-def,etherbone.def -o $@ $^ $(LIBS)
libetherbone.so: libetherbone.so.1
rm -f $@; ln -s $< $@
libetherbone.so.1: libetherbone.so.1.0
rm -f $@; ln -s $< $@
libetherbone.so.1.0: $(OBJECTS)
$(TARGET)g++ $(CXXFLAGS) -shared -Wl,-soname,libetherbone.so.1 -o $@ $^ $(LIBS)
tools/%: tools/%.c $(LIBRARY)
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
tools/eb-tunnel: tools/eb-tunnel.c $(ARCHIVE)
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
tools/eb-discover: tools/eb-discover.c $(ARCHIVE)
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
test/%: test/%.c $(LIBRARY)
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
test/%: test/%.cpp $(LIBRARY)
$(CXX) $(CXXFLAGS) -o $@ $^ $(LIBS)
clean:
rm -f $(LIBRARY) $(EXTRA) $(ARCHIVE) $(OBJECTS) $(TOOLS)
%.o: %.c
$(CC) $(CFLAGS) -o $@ -c $^
%.o: %.cpp
$(CXX) $(CXXFLAGS) -o $@ -c $^
pkgdir = @libddir@/pkgconfig
ACLOCAL_AMFLAGS = -I auto
include_HEADERS = etherbone.h
lib_LTLIBRARIES = libetherbone.la
bin_PROGRAMS = tools/eb-read tools/eb-write tools/eb-put tools/eb-get tools/eb-snoop tools/eb-ls tools/eb-find #tools/eb-tunnel tools/eb-discover
EXTRA_PROGRAMS = test/sizes test/loopback test/etherbonetest
pkg_DATA = etherbone.pc
EXTRA_DIST = etherbone.pc.in glue/version.h.in glue/version.h
SOURCES = \
memory/dynamic.c \
memory/static.c \
memory/memory.h \
memory/memory-array.h \
memory/array.c \
memory/memory-malloc.h \
memory/malloc.c \
format/bigendian.h \
format/format.h \
format/slave.c \
format/master.c \
glue/cycle.h \
glue/cycle.c \
glue/device.h \
glue/device.c \
glue/format.c \
glue/handler.h \
glue/handler.c \
glue/operation.h \
glue/operation.c \
glue/readwrite.h \
glue/readwrite.c \
glue/sdb.h \
glue/sdb.c \
glue/socket.h \
glue/socket.c \
glue/strncasecmp.h \
glue/strncasecmp.c \
glue/widths.h \
glue/widths.c \
transport/dev.h \
transport/dev.c \
transport/posix-ip.h \
transport/posix-ip.c \
transport/posix-tcp.h \
transport/posix-tcp.c \
transport/posix-udp.h \
transport/posix-udp.c \
transport/run.c \
transport/transport.h \
transport/transports.c \
transport/tunnel.h \
transport/tunnel.c \
glue/cplusplus.cpp
if GIT_TREE
glue/version.h: glue/version.h.in $(SOURCES)
git log -n1 --pretty="format:%H" . > git.version_full
git log -n1 --pretty="format:%ci" . > git.date_full
cut -b1-8 < git.version_full > git.version_short
date +%Y%m%d -f git.date_full > git.date_short
sed 's/@EB_VERSION_FULL@/'"`cat git.version_full`"'/;s/@EB_VERSION_SHORT@/'"`cat git.version_short`"'/;s/@EB_DATE_FULL@/'"`cat git.date_full`"'/;s/@EB_DATE_SHORT@/'"`cat git.date_short`"'/' < $< > $@.tmp
rm -f $@.tmp git.version_full git.date_full git.version_short git.date_short
mv $@.tmp $@
endif
libetherbone_la_LDFLAGS = -version-info 2:1:0
libetherbone_la_SOURCES = $(SOURCES) glue/version.h
#FLAGS := $(FLAGS) -DEB_USE_DYNAMIC # deterministic untill table overflow (default)
#FLAGS := $(FLAGS) -DEB_USE_STATIC=200 # fully deterministic
#FLAGS := $(FLAGS) -DEB_USE_MALLOC # non-deterministic
#FLAGS := $(FLAGS) -DDISABLE_SLAVE
#FLAGS := $(FLAGS) -DDISABLE_MASTER
LDADD = libetherbone.la
tools_eb_read_SOURCES = tools/eb-read.c
tools_eb_write_SOURCES = tools/eb-write.c
tools_eb_put_SOURCES = tools/eb-put.c
tools_eb_get_SOURCES = tools/eb-get.c
tools_eb_snoop_SOURCES = tools/eb-snoop.c
tools_eb_ls_SOURCES = tools/eb-ls.c
tools_eb_find_SOURCES = tools/eb-find.c
#tools_eb_tunnel_SOURCES = tools/eb-tunnel.c
#tools_eb_discover_SOURCES= tools/eb-discover.c
test_sizes_SOURCES = test/sizes.c
test_loopback_SOURCES = test/loopback.cpp
test_etherbonetest_SOURCES = test/etherbonetest.cpp
#! /bin/sh
aclocal -I auto
autoheader
autoconf
libtoolize -c
automake -a -c
AC_PREREQ(2.63)
AC_INIT([etherbone], [1.1])
AC_CONFIG_SRCDIR([glue/socket.c])
AC_CONFIG_MACRO_DIR([auto])
AC_CONFIG_AUX_DIR([auto])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([subdir-objects foreign])
AM_MAINTAINER_MODE
AC_PROG_LIBTOOL
AC_PROG_INSTALL
AC_PROG_CC
AC_PROG_CXX
AC_MSG_CHECKING(whether compiler understands -Wall)
old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Wmissing-declarations -Wmissing-prototypes"
AC_TRY_COMPILE([],[],
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
CFLAGS="$old_CFLAGS")
AC_CACHE_CHECK([for lsb_release supporting -d -s], [ac_cv_path_LSB_RELEASE_CMD],
[AC_PATH_PROGS_FEATURE_CHECK([LSB_RELEASE_CMD], [lsb_release],
[[$ac_path_LSB_RELEASE_CMD -d -s > /dev/null && ac_cv_path_LSB_RELEASE_CMD=$ac_path_LSB_RELEASE_CMD]],
[AC_MSG_ERROR([could not find acceptable lsb_release])])])
AC_CACHE_CHECK([for operating system], [ac_cv_OPERATING_SYSTEM],
[os="$($ac_cv_path_LSB_RELEASE_CMD -d -s)"
os="${os%\"}"
ac_cv_OPERATING_SYSTEM="${os#\"}"])
AC_DEFINE_UNQUOTED([OPERATING_SYSTEM], ["$ac_cv_OPERATING_SYSTEM"], [The operating system of the build system])
AC_DEFINE_UNQUOTED([HOSTNAME], ["${HOSTNAME:-unknown}"], [The hostname of the build system])
AC_DEFINE_UNQUOTED([USERNAME], ["${USERNAME:-${LOGNAME:-${USER:-unknown}}}"], [The username of the person compiling saftlib])
AC_PATH_PROGS([GIT], [git])
AM_CONDITIONAL([GIT_TREE], [test x$GIT != x -a -e ../.git])
AC_CONFIG_FILES([Makefile etherbone.pc])
AC_OUTPUT
prefix=@PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: etherbone
Description: Wishbone serial protocol library
Version: 1.0
Version: @VERSION@
Libs: -L${libdir} -letherbone
Cflags: -I${includedir}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment