summaryrefslogtreecommitdiffstats
path: root/Makefile.am
blob: c426b8c8a0ad5e504c7d4d5e374bff87fc95917c (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
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = po lib include libparted parted partprobe doc debug tests

EXTRA_DIST =				\
  .version				\
  .prev-version				\
  BUGS					\
  libparted.pc.in			\
  libparted-fs-resize.pc.in		\
  parted.spec.in			\
  parted.spec				\
  scripts/data/abi/baseline_symbols.txt \
  scripts/extract_symvers		\
  cfg.mk				\
  dist-check.mk				\
  maint.mk				\
  GNUmakefile

aclocaldir=$(datadir)/aclocal

pcdir = $(libdir)/pkgconfig
pc_DATA = libparted.pc libparted-fs-resize.pc

# This is best not done via configure.ac, because automake's
# make distcheck target does not like auto-generated files
# being included in the distributed archive.
parted.spec: parted.spec.in
	sed 's/@''PACKAGE@/$(PACKAGE)/;s/@''VERSION@/$(VERSION)/' $< > $@-tmp
	mv $@-tmp $@
MAINTAINERCLEANFILES = parted.spec

.PHONY: root-check
root-check:
	sudo sh -c '$(MAKE) check; t=$$?; chown -R $(USER) .; exit $$t'

# Not everyone who runs "make distcheck" will want to or even
# be able to run the root tests.  If you want to skip them,
# run make like this: "make distcheck root-check="
root_check ?= root-check
distcheck-hook: $(root_check)
	$(MAKE) my-distcheck

### ABI Checking scripts ###

baseline_file = ${top_srcdir}/scripts/data/abi/baseline_symbols.txt
extract_symvers = $(top_srcdir)/scripts/extract_symvers

current_symbols.txt: ${extract_symvers}
	  -@(sh ${extract_symvers} libparted/.libs/libparted.so current_symbols.txt)

baseline_symbols:
	-@(output=${baseline_file}; \
	  if test ! -f $${output}; then \
	    echo "Baseline file doesn't exist."; \
	    echo "Try 'make new-abi-baseline' to create it."; \
	    exit 1; \
	  fi; true)

new-abi-baseline:
	-@$(mkinstalldirs) ${baseline_dir}
	-@(output=${baseline_file}; \
	  if test -f $${output}; then \
	    output=$${output}.new; \
	    t=`echo $${output} | sed 's=.*config/abi/=='`; \
	    echo "Baseline file already exists, writing to $${t} instead."; \
	  fi; \
	  sh ${extract_symvers} libparted/.libs/libparted.so $${output})

# Use 'new-abi-baseline' to create an initial symbol file.  Then run
# 'check-abi' to test for changes against that file.
check-abi: baseline_symbols current_symbols.txt
	@diff -u ${baseline_file} ./current_symbols.txt 2>&1 \
	 | tee libparted.abi-diff
	@test `wc -l < libparted.abi-diff` -eq 0 && exit 0 \
	 || echo "ABI has changed. Please, update you ABI package version." \
	 && exit 1

MOSTLYCLEANDIRS = m4

MAINTAINERCLEANFILES += \
  ABOUT-NLS     \
  ChangeLog     \
  INSTALL       \
  aclocal.m4    \
  configure

.PHONY: ss-1024 ss-2048 ss-4096
ss-1024 ss-2048 ss-4096:
	PARTED_SECTOR_SIZE=$(subst ss-,,$@) $(MAKE) check-recursive

# Run the regression test suite with different settings,
# to ensure it works with simulated partition sizes > 512.
.PHONY: check-other-sector_sizes
check-other-sector_sizes:
	$(MAKE) ss-1024
	$(MAKE) ss-2048
	$(MAKE) ss-4096

check: check-other-sector_sizes

# Arrange so that .tarball-version appears only in the distribution
# tarball, and never in a checked-out repository.
dist-hook: gen-ChangeLog
	echo $(VERSION) > $(distdir)/.tarball-version

gen_start_date = 2000-01-01
.PHONY: gen-ChangeLog
gen-ChangeLog:
	if test -d .git; then						\
	  $(top_srcdir)/build-aux/gitlog-to-changelog			\
	    --amend=$(srcdir)/build-aux/git-log-fix			\
	    --since=$(gen_start_date) > $(distdir)/cl-t;		\
	  rm -f $(distdir)/ChangeLog;					\
	  mv $(distdir)/cl-t $(distdir)/ChangeLog;			\
	fi

BUILT_SOURCES = .version
.version:
	echo $(VERSION) > $@-t && mv $@-t $@