summaryrefslogtreecommitdiff
path: root/Makefile
blob: 9ff12d8e05d5b536fae8e3dd4a707981b0ed5756 (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
# 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.
aconfig.h.in: configure.in configure aclocal.m4
	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 $@