summaryrefslogtreecommitdiff
path: root/Makefile
blob: 75a2042cba049f1419022d5218bb31418bfdd01e (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
# You can do "make SUB=blah" to make only a few, or edit here, or both
# You can also run make directly in the subdirs you want.

SUB =   lib common tftp tftpd

%.build: MCONFIG aconfig.h version.h
	$(MAKE) -C $(patsubst %.build, %, $@)

%.install: MCONFIG aconfig.h version.h
	$(MAKE) -C $(patsubst %.install, %, $@) install

%.clean:
	$(MAKE) -C $(patsubst %.clean, %, $@) clean

%.distclean:
	$(MAKE) -C $(patsubst %.distclean, %, $@) distclean

all:      MCONFIG $(patsubst %, %.build, $(SUB))

tftp.build: lib.build common.build
tftpd.build: lib.build common.build

install:  MCONFIG $(patsubst %, %.install, $(SUB))

clean:	localclean $(patsubst %, %.clean, $(SUB))

localclean:
	rm -f version.h

distclean: localdistclean $(patsubst %, %.distclean, $(SUB))

localdistclean: localclean
	rm -f MCONFIG config.status config.log aconfig.h *~ \#*
	rm -rf *.cache
	find . -type f \( -name \*.orig -o -name \*.rej \) | xargs rm -f

spotless: distclean
	rm -f configure aconfig.h.in tftp.spec

autoconf: configure aconfig.h.in

config:	MCONFIG aconfig.h

release:
	$(MAKE) autoconf
	$(MAKE) tftp.spec
	$(MAKE) distclean

MCONFIG: configure MCONFIG.in aconfig.h.in
	if test -x config.status; then \
		./config.status --recheck && ./config.status ; \
	else \
		./configure ; \
	fi

aconfig.h: MCONFIG
	: Generated by side effect

# Adding "configure" to the dependencies serializes this with running
# autoconf, because there are apparently race conditions between
# autoconf and autoheader.  And worse than that, even when autoconf
# cleanly returns first, autoheader will truncate the timestamp of
# aconfig.h.in to second resolution, so on a filesystem with subsecond
# resolution it can appear older than configure (which isn't truncated).
# So make it an order-only prerequisite to avoid looping regenerating it.
aconfig.h.in: configure.in aclocal.m4 | configure
	rm -f aconfig.h.in aconfig.h
	autoheader

configure: configure.in aclocal.m4
	rm -rf MCONFIG configure config.log aconfig.h *.cache
	autoconf

version.h: version
	echo \#define VERSION \"tftp-hpa `cat version`\" > version.h

tftp.spec: tftp.spec.in version
	sed -e "s/@@VERSION@@/`cat version`/g" < $< > $@ || rm -f $@