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 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
|
#!/usr/bin/make -f
install = install -o root -g root
install_exec = $(install) -m 755
install_dir = $(install) -m 755 -d
install_nonex = $(install) -m 644
install_script = $(install) -m 755
install_zipped = gzip -9vc
install_symlink = ln -s
package = tirc
rootdir = `pwd`/debian/tmp
docdir = $(rootdir)/usr/share/doc/$(package)
examplebindir = $(rootdir)/usr/lib/$(package)/examples
examplesrcdir = $(docdir)/examples
bindir = $(rootdir)/usr/bin
mandir = $(rootdir)/usr/share/man
man1dir = $(rootdir)/usr/share/man/man1
confdir = $(rootdir)/etc/tirc
menudir = $(rootdir)/usr/lib/menu
CFLAGS = -g -Wall
ifneq (,$(findstring noopt, $(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
ifeq (,$(findstring nostrip, $(DEB_BUILD_OPTIONS)))
install_exec += -s
endif
export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
confflags += --build $(DEB_HOST_GNU_TYPE)
else
confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
endif
build: debian/build.stamp
debian/build.stamp:
$(checkdir)
CC=gcc CFLAGS="$(CFLAGS)" ./configure $(confflags) --prefix=/usr \
--with-ansi-colours --mandir=/usr/share --with-dlmod
$(MAKE)
cd modules && $(MAKE)
touch $@
clean-build:
-test -r /usr/share/misc/config.sub && \
cp -f /usr/share/misc/config.sub config.sub
-test -r /usr/share/misc/config.guess && \
cp -f /usr/share/misc/config.guess config.guess
$(RM) debian/build*.stamp
-$(MAKE) distclean
cd modules && make distclean
binary: binary-arch binary-indep
binary-indep: debian/binary-indep.stamp
debian/binary-indep.stamp:
touch $@
binary-arch: debian/binary-arch.stamp
debian/binary-arch.stamp: build
$(checkdir)
$(RM) -r $(rootdir)
$(install_dir) $(rootdir)
$(install_dir) $(rootdir)/DEBIAN
$(install_dir) $(docdir)
$(install_dir) $(examplebindir)
$(install_dir) $(examplebindir)/hello
$(install_dir) $(examplesrcdir)
$(install_dir) $(examplesrcdir)/hello
$(install_dir) $(bindir)
$(install_dir) $(man1dir)
$(install_dir) $(confdir)
$(install_dir) $(menudir)
# binary
$(install_exec) tirc $(bindir)
# changelogs
$(install_nonex) debian/changelog $(docdir)/changelog.Debian
$(install_nonex) Changelog $(docdir)/changelog
# docs
$(install_nonex) FAQ $(docdir)
$(install_nonex) README $(docdir)
groff -me -T ascii < doc/dynmod.me > $(docdir)/dynmod.txt
chmod 0644 $(docdir)/dynmod.txt
gzip -9vfr $(docdir)/
$(install_nonex) debian/copyright $(docdir)
# modules
$(install_exec) modules/hello/hello.so $(examplebindir)/hello
$(install_nonex) modules/hello/hello.c $(examplesrcdir)/hello
$(install_nonex) modules/hello/Makefile $(examplesrcdir)/hello
$(install_nonex) modules/Makefile $(examplesrcdir)
(cd $(examplesrcdir) ; \
$(install_symlink) \
../../../../../lib/tirc/examples/hello/hello.so hello/hello.so)
# menu
$(install_nonex) debian/menu $(menudir)/$(package)
# manpages
$(install_nonex) tirc.1 $(man1dir)
gzip -9f $(man1dir)/tirc.1
# conffiles
$(install_nonex) debian/tircrc $(confdir)
# control
$(install_script) debian/postinst $(rootdir)/DEBIAN
$(install_script) debian/prerm $(rootdir)/DEBIAN
$(install_script) debian/postrm $(rootdir)/DEBIAN
dpkg-shlibdeps $(bindir)/tirc
dpkg-gencontrol -isp
# install control files
$(install_nonex) debian/conffiles $(rootdir)/DEBIAN
$(install_script) debian/prerm $(rootdir)/DEBIAN
# fixperms
chown -R root.root $(rootdir)
chmod -R g-ws $(rootdir)
# generate the deb
dpkg --build $(rootdir) ..
touch $@
define checkdir
test -f tirc.h -a -f debian/rules
endef
clean-binary:
$(RM) debian/binary*.stamp
$(RM) *~
$(RM) -r debian/tmp debian/*~ debian/files debian/substvars
clean: clean-build clean-binary
.PHONY: build binary-indep binary-arch binary clean-build clean-binary
|