summaryrefslogtreecommitdiff
path: root/debian/rules
blob: da95ab0233ba5ab943f886b50fbc5ccfd2f48bf7 (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
#!/usr/bin/make -f

STRIP =strip
ifneq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
  STRIP =: nostrip
endif

CFLAGS =-g -O2 -Wall
LDFLAGS =
CC =gcc
BGLIBS =/usr/lib/bglibs
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
  CFLAGS =-g -O0 -Wall
endif
ifneq (,$(findstring diet,$(DEB_BUILD_OPTIONS)))
  CC =diet -v -Os gcc -nostdinc
  BGLIBS =/usr/lib/diet/bglibs
endif

DIR =$(shell pwd)/debian/twoftpd

patch: deb-checkdir patch-stamp
patch-stamp:
	for i in `ls -1 debian/diff/*.diff || :`; do \
	  patch -p1 <$$i || exit 1; \
	done
	touch patch-stamp

build: deb-checkdir build-arch-stamp build-indep-stamp

build-arch: deb-checkdir build-arch-stamp
build-arch-stamp: patch-stamp
	-gcc -v
	for i in conf-*; do \
	  test -e $${i%'{orig}'}'{orig}' || cp -v $$i $$i'{orig}'; \
	done
	echo '$(CC) $(CFLAGS)' >conf-cc
	echo '$(CC) $(LDFLAGS)' >conf-ld
	echo '/usr/bin' >conf-bin
	echo '$(BGLIBS)/include' >conf-bgincs
	echo '$(BGLIBS)/lib' >conf-bglibs
	$(MAKE)
	touch build-arch-stamp

build-indep: deb-checkdir build-indep-stamp
build-indep-stamp: 
	touch build-indep-stamp

clean: deb-checkdir deb-checkuid patch
	$(MAKE) clean
	for i in `ls *'{orig}' || :`; do mv -vf $$i $${i%'{orig}'}; done
	test ! -e patch-stamp || \
	  for i in `ls -1r debian/diff/*.diff || :`; do patch -p1 -R <$$i; done
	rm -f build-arch-stamp build-indep-stamp patch-stamp
	rm -rf '$(DIR)' '$(DIR)'-run
	rm -f debian/files debian/substvars changelog

install: install-arch install-indep
install-arch: deb-checkdir deb-checkuid build-arch-stamp
	rm -rf '$(DIR)'
	install -d -m0755 '$(DIR)'/usr/bin
	install -d -m0755 '$(DIR)'/usr/share/man/man1
	echo '$(DIR)'/usr/bin >conf-bin
	echo '$(DIR)'/usr/share/man >conf-man
	PATH=$$PATH:/usr/lib/bglibs/bin/ $(MAKE) install
	$(STRIP) -R .comment -R .note '$(DIR)'/usr/bin/*
	chmod 0644 '$(DIR)'/usr/share/man/man1/*.1
	gzip -9 '$(DIR)'/usr/share/man/man1/*.1
	test -r changelog || ln -s ChangeLog changelog

install-indep: deb-checkdir deb-checkuid build-indep-stamp
	rm -rf '$(DIR)'-run
	install -d -m0755 '$(DIR)'-run/etc/twoftpd/log
	install -d -m0755 '$(DIR)'-run/etc/twoftpd/env
	install -m0755 debian/etc/twoftpd/run '$(DIR)'-run/etc/twoftpd/
	install -m0755 debian/etc/twoftpd/log/run '$(DIR)'-run/etc/twoftpd/log/
	for i in debian/etc/twoftpd/env/*; do \
	  test -d $$i || install -m0644 $$i '$(DIR)'-run/etc/twoftpd/env/ \
	    || exit 1; \
	done
	install -d -m0755 '$(DIR)'-run/etc/twoftpd-anon/log
	install -d -m0755 '$(DIR)'-run/etc/twoftpd-anon/env
	install -m0755 debian/etc/twoftpd-anon/run \
	  '$(DIR)'-run/etc/twoftpd-anon/run
	install -m0755 debian/etc/twoftpd-anon/log/run \
	  '$(DIR)'-run/etc/twoftpd-anon/log/run
	for i in debian/etc/twoftpd-anon/env/*; do \
	  test -d $$i || install -m0644 $$i '$(DIR)'-run/etc/twoftpd-anon/env/ \
	    || exit 1; \
	done
	install -d -m0755 '$(DIR)'-run/var/log/twoftpd
	install -d -m0755 '$(DIR)'-run/var/log/twoftpd-anon
	test -r changelog || ln -s ChangeLog changelog

binary-arch: deb-checkdir deb-checkuid install-arch twoftpd.deb
	test '$(CC)' != 'gcc' || dpkg-shlibdeps '$(DIR)'/usr/bin/*
	dpkg-gencontrol -isp -ptwoftpd -P'$(DIR)'
	dpkg -b '$(DIR)' ..

binary-indep: deb-checkdir deb-checkuid install-indep twoftpd-run.deb
	dpkg-gencontrol -isp -ptwoftpd-run -P'$(DIR)'-run
	dpkg -b '$(DIR)'-run ..

binary: binary-indep binary-arch

.PHONY: patch build build-arch build-indep clean install install-arch \
install-indep binary-arch binary-indep binary

include debian/implicit