File: Makefile.am

package info (click to toggle)
libguestfs 1%3A1.34.6-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 112,152 kB
  • ctags: 48,429
  • sloc: ansic: 438,854; ml: 49,329; sh: 15,718; java: 9,326; perl: 8,954; makefile: 7,318; cs: 6,153; haskell: 5,531; python: 3,161; erlang: 2,386; xml: 1,739; ruby: 350; pascal: 248; lex: 134; yacc: 128; cpp: 10
file content (95 lines) | stat: -rw-r--r-- 3,350 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# libguestfs Haskell bindings
# Copyright (C) 2009 Red Hat Inc.
#
# 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 2 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, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

include $(top_srcdir)/subdir-rules.mk

generator_built = \
	$(srcdir)/Guestfs.hs \
	Bindtests.hs

# $(generator_built) isn't redundant below as the wildcard rule won't match, and
# therefore won't generate, the files if they haven't been created yet
EXTRA_DIST = $(generator_built) *.hs run-bindtests

if HAVE_HASKELL

TESTS_ENVIRONMENT = $(top_builddir)/run --test $(VG)

# XXX Don't run the bindtests: they don't build since the addition of optargs.
# Haskell bindings are incomplete.

TESTS = Guestfs010Load Guestfs030Config
if ENABLE_APPLIANCE
TESTS += Guestfs050LVCreate
endif ENABLE_APPLIANCE

#check_DATA = Bindtests

GHCFLAGS = -I$(top_builddir)/src -L$(top_builddir)/src/.libs -i$(srcdir)

all_targets = Guestfs010Load Guestfs030Config Guestfs050LVCreate
$(all_targets): $(top_builddir)/src/libguestfs.la

all: $(all_targets)

built_tests = Bindtests Guestfs010Load Guestfs030Config Guestfs050LVCreate

# Building with ghc --make doesn't work properly here because it
# always rebuilds Guestfs.o despite it being up to date. So if you:
#
# * build Guestfs010Load, then build it again, the second time it will
# not be rebuilt.
#
# * build Guestfs010Load, then build Guestfs030Config, then build
# Guestfs010Load again, it will be rebuilt every time.
#
# In the second case, building Guestfs030Config rebuilt Guestfs.o. As
# this is a dependency of Guestfs010Load, Guestfs010Load is now
# unnecessarily out of date.
#
# Because the default target builds all of the above, they will all be
# rebuilt every time.
#
# An obvious choice would be to remove the Guestfs.o dependency, but
# this would potentially result in corruption during a parallel build
# as multiple ghc processes rebuild Guestfs.o simultaneously. I had
# hoped that the solution below would work. It correctly builds
# Guestfs010Load and Guestfs030Config, but Guestfs050LVCreate requires
# additional link options which I haven't been able to work out.

#Guestfs.o: $(srcdir)/Guestfs.hs
#	$(GHC)  $(GHCFLAGS) -c $< -o $@
#
#$(built_tests:%=%.o): %.o: %.hs Guestfs.o
#	$(GHC)  $(GHCFLAGS) -main-is $(basename $<) -c $< -o $@
#
#$(built_tests): %: %.o Guestfs.o
#	$(GHC)  $(GHCFLAGS) -main-is $@ -o $@ $< Guestfs.o -lguestfs

# The solution below isn't ideal. It uses --make and avoids the
# parallel make problem by putting object files in separate
# directories per target.

$(built_tests): %: %.hs Guestfs.hs
	$(GHC)  $(GHCFLAGS) --make -main-is $@ -odir .$@ -o $@ $< $(srcdir)/Guestfs.hs -lguestfs

CLEANFILES += $(all_targets) *.hi test-lv-create.img

clean-local:
	-rm -rf $(built_tests:%=.%)

endif