aboutsummaryrefslogtreecommitdiffstats
path: root/src/Makefile.am
blob: 068d20ffb87e2ffa21417388d722b65c88fc1a3f (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
#
#
# Makefile.am:
#
# Copyright (c) 2017 James McKenzie <foss@madingley.org>,
# All rights reserved.
#
#
#

CPROTO=cproto
AM_CPPFLAGS =

noinst_HEADERS=project.h prototypes.h

sbin_PROGRAMS = twa_t

SRCS=twa_t.c twa.c version.c util.c hexdump.c
twa_t_SOURCES = ${SRCS}
twa_t_LDADD = 

AM_CFLAGS=-g

twa_t_LDFLAGS = 

BUILT_SOURCES = version.h


VFD=${srcdir}/..
VF=${shell cat ${VFD}/version-files}
VFS=${VF:%=${VFD}/%}
VCHK=${shell cat ${VFS} | @MD5SUM@ | @AWK@ '{print $$1 }' }
VNUM=${shell @GREP@ ${VCHK} ${VFD}/version-md5sums | @AWK@ '{ print $$2 }'  }
VDEF=${shell echo `cat ${VFD}/version-major`.`cat ${VFD}/version-minor`.`cat ${VFD}/version-micro` }

protos:
	echo > prototypes.h
	${CPROTO} -v ${INCLUDES} ${SRCS} > prototypes.tmp
	mv -f prototypes.tmp prototypes.h



version.h: $(VFD)/version-files $(VFD)/version-major \
	$(VFD)/version-minor $(VFD)/version-micro \
	$(VFD)/version-md5sums ${VFS} Makefile
	if [ .${VNUM} = . ]; then \
		echo "#define VERSION \"twa_t Version ${VDEF} + Edits\"" > version.h; \
		echo ${VDEF}-E > version-num; \
	else \
		echo "#define VERSION \"twa_t Version ${VNUM}\"" > version.h; \
		echo ${VNUM} > version-num; \
	fi