summaryrefslogtreecommitdiffstats
path: root/src/Makefile-files
blob: 0a93287f613220ad141ae4a5fb586a8335fda931 (plain)
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
# -*- makefile -*-

if HAVE_PYTHON

nodist_nbblib_PYTHON += src/nbblib/package.py
CLEANFILES  += src/nbblib/package.py

nbblib_PYTHON += src/nbblib/__init__.py
nbblib_PYTHON += src/nbblib/bs.py
nbblib_PYTHON += src/nbblib/commands.py
nbblib_PYTHON += src/nbblib/main.py
nbblib_PYTHON += src/nbblib/plugins.py
nbblib_PYTHON += src/nbblib/newplugins.py
nbblib_PYTHON += src/nbblib/progutils.py
nbblib_PYTHON += src/nbblib/vcs.py

# Put all python source files, whether changed or verbatim,
# into builddir, such that we can run tests in builddir.
all-local: all-local-nbblib
all-local-nbblib:
	@for f in $(nbblib_PYTHON); do \
		if test -f "$(top_builddir)/$$f" && test "$(top_srcdir)/$$f" -ot "$(top_builddir)/$$f"; then :; else \
			echo "INFO: Updating $$f in $(top_builddir) from $(top_srcdir)"; \
			cp -f "$(top_srcdir)/$$f" "$(top_builddir)/$$f"; \
		fi; \
	done

bin_SCRIPTS += src/nbb
CLEANFILES  += src/nbb

# We cannot create src/nbb from src/nbb.in in configure.ac/config.status.
# pythondir is defined as ${something}foobar, and that needs expansion.
EXTRA_DIST += src/nbb.in
src/nbb: src/nbb.in $(nodist_nbblib_PYTHON) $(nbblib_PYTHON) Makefile
	$(SED) \
		-e 's&[@]pythondir@&$(pythondir)&g' \
		-e 's&[@]PYTHON@&$(PYTHON)&g' \
		-e 's&[@]PACKAGE_VERSION@&$(PACKAGE_VERSION)&g' \
		< $(srcdir)/src/nbb.in > src/nbb.new
	@if test "x$$($(GREP) '@[a-zA-Z0-9_]\{1,\}@' src/nbb.new)" = "x"; then :; \
	else \
		echo "FATAL: Unsubstituted markers remain in src/nbb.new."; \
		$(GREP) '@[a-zA-Z0-9_]\{1,\}@' src/nbb.new; \
		exit 1; \
	fi
	@if test -f src/nbb && cmp src/nbb.new src/nbb; \
	then rm -f src/nbb.new; \
	else mv -f src/nbb.new src/nbb; echo "INFO: Updating src/nbb"; fi
	@chmod +x src/nbb

endif

clean-local: clean-local-nbblib
clean-local-nbblib:
	rm -f src/nbblib/*.pyc
	@top_srcdir="$$(cd "$(top_srcdir)" > /dev/null 2>&1 && pwd)"; \
	top_builddir="$$(cd "$(top_builddir)" > /dev/null 2>&1 && pwd)"; \
	if test "x$${top_srcdir}" = "x$${top_builddir}"; then :; else \
		for f in $(nbblib_PYTHON); do \
			echo rm -f "$(top_builddir)/$$f"; \
			rm -f "$(top_builddir)/$$f"; \
		done; \
	fi

# End of Makefile-files.