move script directory into master tree
[debian6500.git] / trc6500-master-file / Makefile
CommitLineData
e043b5aa
OL
1# -*- Makefile -*-
2
7cf8d4b7 3DIR = ../master/
e043b5aa
OL
4
5CONFIGDIR = debian/
6
7FILES = $(shell cd $(DIR); find etc/ -type f)
8
7cf8d4b7 9TARGET = ../$(MODULE)_$(VERSION)_$(ARCH).deb
e043b5aa
OL
10
11OBJECTS = deb/DEBIAN/preinst \
12 deb/DEBIAN/postrm \
84523910 13 deb/DEBIAN/postinst
e043b5aa
OL
14
15SHELL=/bin/bash
7cf8d4b7 16MODULE = $(shell basename `pwd`)
e043b5aa
OL
17ARCH = all
18
19.DEFAULT: all
20.PHONY: clean deb all
21
22VERSION = $(shell awk '/^$(MODULE)/ { gsub(/[()]/, ""); print $$2; exit }' debian/debian-changelog)
23
24
25all: $(TARGET) deb
26
27clean:
28 rm -rf deb $(OBJECTS) $(TARGETS)
29
30deb:
31 rm -rf deb
32 mkdir --parent deb/etc/webconfig/ deb/etc/default/ deb/DEBIAN
33
34deb/DEBIAN/preinst: debian/debian-preinst deb $(addprefix $(DIR)/, $(FILES)) $(MAKEFILE_LIST)
35 rm -f $@
36 cat $< > $@~
37 for f in $(FILES); do echo '[ -f "/'$$f'" ] && dpkg-divert --add /'$$f; done >>$@~
38 echo "exit 0" >>$@~
39 chmod +x $@~
40 mv $@~ $@
41
42deb/DEBIAN/postrm: debian/debian-postrm deb $(addprefix $(DIR)/, $(FILES)) $(MAKEFILE_LIST)
43 rm -f $@
44 cat $< > $@~
45 for f in $(FILES); do echo '[ -f "/'$$f'" ] && dpkg-divert --remove /'$$f; done >>$@~
46 echo "exit 0" >>$@~
47 chmod +x $@~
48 mv $@~ $@
49
50deb/DEBIAN/postinst: debian/debian-postinst deb
51 cp $< $@
52
e043b5aa
OL
53$(TARGET): deb $(OBJECTS)
54 sed s/@@version@@/$(VERSION)/ debian/debian-control > deb/DEBIAN/control
55 mkdir -p deb/usr/share/doc/$(MODULE)
56 cp debian/debian-changelog deb/usr/share/doc/$(MODULE)/changelog
57 cp -r $(DIR)/* deb/
58 fakeroot dpkg --build deb
59 mv deb.deb $@