summaryrefslogtreecommitdiffstats
path: root/git-buildmsg/README.git-buildmsg
blob: dc9a7cd21eb2f59769cb79723fa3700bc04a6aa4 (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
========================================================================
How to hook it into automake-based builds:
========================================================================

---[ BEGIN top-level Makefile.am ]---
EXTRA_DIST += git-buildmsg
---[ END top-level Makefile.am ]---

---[ BEGIN Makefile.am where information is needed ]---
BUILT_SOURCES += git-buildmsg.stamp
GIT_BUILDMSG_CMD = $(SHELL) "$(top_srcdir)/git-buildmsg"
GIT_BUILDMSG_H = git-buildmsg.h
CLEANFILES += $(GIT_BUILDMSG_H)
git-buildmsg.stamp:
	env GIT_DIR="$(top_srcdir)/.git" $(GIT_BUILDMSG_CMD) -s "$(top_srcdir)" -o "$(GIT_BUILDMSG_H)"
	@if test -s "$(srcdir)/$(GIT_BUILDMSG_H)"; then \
		if cmp "$(srcdir)/$(GIT_BUILDMSG_H)" "$(GIT_BUILDMSG_H)"; then :; \
		else \
			echo "Error: $(srcdir)/$(GIT_BUILDMSG_H) and $(GIT_BUILDMSG_H) differ."; \
			echo "       You probably want to remove the former."; \
			exit 1; \
		fi; \
	fi

bin_PROGRAMS += foo
foo_SOURCES = foo.c
nodist_foo_SOURCES = $(GIT_BUILDMSG_H)
---[ END Makefile.am where information is needed ]---


========================================================================
How to hook it into imake-based builds:
========================================================================

---[ BEGIN Imakefile ]---
GIT_VERSION_CMD = $(SHELL) $(TOP)/git-buildmsg
GIT_DEFINES = `env GIT_DIR="$(TOP)/.git" $(GIT_VERSION_CMD) -s $(TOP) -o git-buildmsg.h`

clean::
	RemoveFile(git-buildmsg.h)
---[ END Imakefile ]---

Then make sure that the DEFINES the C compiler is run with includes
$(GIT_DEFINES).