Fix out-of-tree build.

Use libtool "noinst" local helper libs and use one Makefile.am per
subdir, which is the usual/preferred method. These helper libraries are
purely local and will not be installed.

This also fixes out-of-tree builds of sigrok, i.e. building in a
directory other than the sigrok source directory, e.g.

 $ cd /home/user
 $ git clone ...sigrok
 $ cd sigrok
 $ ./autogen.sh
 $ mkdir /tmp/foo
 $ cd /tmp/foo
 $ /home/user/sigrok/configure
 $ make
 $ make install

This will place all build results (.o files, .la files, etc) in the
local build directory (/tmp/foo) instead of the source directory
(/home/user/sigrok in this example). The installation directory is
selected via the --prefix configure option (/usr/local per default).
This commit is contained in:
Uwe Hermann 2011-01-08 03:32:25 +01:00
parent 757b8c628a
commit 340f6e7aea
10 changed files with 302 additions and 52 deletions

View File

@ -20,6 +20,8 @@
AM_CPPFLAGS = -I $(top_srcdir)/libsigrok \
-DFIRMWARE_DIR='"$(FIRMWARE_DIR)"'
SUBDIRS = hardware input output
lib_LTLIBRARIES = libsigrok.la
libsigrok_la_SOURCES = \
@ -28,59 +30,13 @@ libsigrok_la_SOURCES = \
device.c \
session.c \
hwplugin.c \
filter.c \
hardware/common/ezusb.c \
hardware/common/misc.c \
hardware/common/serial.c \
hardware/demo/demo.c \
input/input_binary.c \
input/input.c \
output/output_binary.c \
output/output_text.c \
output/output_vcd.c \
output/output_gnuplot.c \
output/common.c \
output/output.c
filter.c
if LA_ASIX_SIGMA
libsigrok_la_SOURCES += \
hardware/asix-sigma/asix-sigma.c \
hardware/asix-sigma/asix-sigma.h
else
EXTRA_DIST = \
hardware/asix-sigma/asix-sigma.c \
hardware/asix-sigma/asix-sigma.h
endif
if LA_OLS
libsigrok_la_SOURCES += hardware/openbench-logic-sniffer/ols.c
else
EXTRA_DIST = hardware/openbench-logic-sniffer/ols.c
endif
if LA_SALEAE_LOGIC
libsigrok_la_SOURCES += hardware/saleae-logic/saleae-logic.c
else
EXTRA_DIST = hardware/saleae-logic/saleae-logic.c
endif
if LA_ZEROPLUS_LOGIC_CUBE
libsigrok_la_SOURCES += \
hardware/zeroplus-logic-cube/analyzer.c \
hardware/zeroplus-logic-cube/analyzer.h \
hardware/zeroplus-logic-cube/gl_usb.c \
hardware/zeroplus-logic-cube/gl_usb.h \
hardware/zeroplus-logic-cube/zeroplus.c
else
EXTRA_DIST = \
hardware/zeroplus-logic-cube/analyzer.c \
hardware/zeroplus-logic-cube/analyzer.h \
hardware/zeroplus-logic-cube/gl_usb.c \
hardware/zeroplus-logic-cube/gl_usb.h \
hardware/zeroplus-logic-cube/zeroplus.c
endif
libsigrok_la_LIBADD = $(LIBOBJS)
libsigrok_la_LIBADD = \
$(LIBOBJS) \
hardware/libsigrokhardware.la \
input/libsigrokinput.la \
output/libsigrokoutput.la
include_HEADERS = sigrok.h

51
hardware/Makefile.am Normal file
View File

@ -0,0 +1,51 @@
##
## This file is part of the sigrok project.
##
## Copyright (C) 2011 Uwe Hermann <uwe@hermann-uwe.de>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
SUBDIRS = \
asix-sigma \
common \
demo \
openbench-logic-sniffer \
saleae-logic \
zeroplus-logic-cube
noinst_LTLIBRARIES = libsigrokhardware.la
libsigrokhardware_la_SOURCES =
libsigrokhardware_la_LIBADD = \
common/libsigrokhwcommon.la \
demo/libsigrokhwdemo.la
if LA_ASIX_SIGMA
libsigrokhardware_la_LIBADD += asix-sigma/libsigrokhwasixsigma.la
endif
if LA_OLS
libsigrokhardware_la_LIBADD += openbench-logic-sniffer/libsigrokhwols.la
endif
if LA_SALEAE_LOGIC
libsigrokhardware_la_LIBADD += saleae-logic/libsigrokhwsaleaelogic.la
endif
if LA_ZEROPLUS_LOGIC_CUBE
libsigrokhardware_la_LIBADD += zeroplus-logic-cube/libsigrokhwzeroplus.la
endif

View File

@ -0,0 +1,31 @@
##
## This file is part of the sigrok project.
##
## Copyright (C) 2011 Uwe Hermann <uwe@hermann-uwe.de>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
AM_CPPFLAGS = -DFIRMWARE_DIR='"$(FIRMWARE_DIR)"'
# Local lib, this is NOT meant to be installed!
noinst_LTLIBRARIES = libsigrokhwasixsigma.la
libsigrokhwasixsigma_la_SOURCES = \
asix-sigma.c \
asix-sigma.h
libsigrokhwasixsigma_la_CFLAGS = \
-I$(top_srcdir)/libsigrok

View File

@ -0,0 +1,30 @@
##
## This file is part of the sigrok project.
##
## Copyright (C) 2011 Uwe Hermann <uwe@hermann-uwe.de>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
# Local lib, this is NOT meant to be installed!
noinst_LTLIBRARIES = libsigrokhwcommon.la
libsigrokhwcommon_la_SOURCES = \
ezusb.c \
misc.c \
serial.c
libsigrokhwcommon_la_CFLAGS = \
-I$(top_srcdir)/libsigrok

28
hardware/demo/Makefile.am Normal file
View File

@ -0,0 +1,28 @@
##
## This file is part of the sigrok project.
##
## Copyright (C) 2011 Uwe Hermann <uwe@hermann-uwe.de>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
# Local lib, this is NOT meant to be installed!
noinst_LTLIBRARIES = libsigrokhwdemo.la
libsigrokhwdemo_la_SOURCES = \
demo.c
libsigrokhwdemo_la_CFLAGS = \
-I$(top_srcdir)/libsigrok

View File

@ -0,0 +1,28 @@
##
## This file is part of the sigrok project.
##
## Copyright (C) 2011 Uwe Hermann <uwe@hermann-uwe.de>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
# Local lib, this is NOT meant to be installed!
noinst_LTLIBRARIES = libsigrokhwols.la
libsigrokhwols_la_SOURCES = \
ols.c
libsigrokhwols_la_CFLAGS = \
-I$(top_srcdir)/libsigrok

View File

@ -0,0 +1,30 @@
##
## This file is part of the sigrok project.
##
## Copyright (C) 2011 Uwe Hermann <uwe@hermann-uwe.de>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
AM_CPPFLAGS = -DFIRMWARE_DIR='"$(FIRMWARE_DIR)"'
# Local lib, this is NOT meant to be installed!
noinst_LTLIBRARIES = libsigrokhwsaleaelogic.la
libsigrokhwsaleaelogic_la_SOURCES = \
saleae-logic.c
libsigrokhwsaleaelogic_la_CFLAGS = \
-I$(top_srcdir)/libsigrok

View File

@ -0,0 +1,32 @@
##
## This file is part of the sigrok project.
##
## Copyright (C) 2011 Uwe Hermann <uwe@hermann-uwe.de>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
# Local lib, this is NOT meant to be installed!
noinst_LTLIBRARIES = libsigrokhwzeroplus.la
libsigrokhwzeroplus_la_SOURCES = \
analyzer.c \
analyzer.h \
gl_usb.c \
gl_usb.h \
zeroplus.c
libsigrokhwzeroplus_la_CFLAGS = \
-I$(top_srcdir)/libsigrok

29
input/Makefile.am Normal file
View File

@ -0,0 +1,29 @@
##
## This file is part of the sigrok project.
##
## Copyright (C) 2011 Uwe Hermann <uwe@hermann-uwe.de>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
# Local lib, this is NOT meant to be installed!
noinst_LTLIBRARIES = libsigrokinput.la
libsigrokinput_la_SOURCES = \
input_binary.c \
input.c
libsigrokinput_la_CFLAGS = \
-I$(top_srcdir)/libsigrok

35
output/Makefile.am Normal file
View File

@ -0,0 +1,35 @@
##
## This file is part of the sigrok project.
##
## Copyright (C) 2011 Uwe Hermann <uwe@hermann-uwe.de>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##
AM_CPPFLAGS = -DFIRMWARE_DIR='"$(FIRMWARE_DIR)"'
# Local lib, this is NOT meant to be installed!
noinst_LTLIBRARIES = libsigrokoutput.la
libsigrokoutput_la_SOURCES = \
output_binary.c \
output_text.c \
output_vcd.c \
output_gnuplot.c \
common.c \
output.c
libsigrokoutput_la_CFLAGS = \
-I$(top_srcdir)/libsigrok