Initial revision
[filters.git] / debian / rules
1 #!/usr/bin/make -f
2 ##############################################################################
3 # Generic debian/rules file. Based on:
4 #
5 #> Sample debian.rules file - for GNU Hello (1.3).
6 #> Copyright 1994,1995 by Ian Jackson.
7 #> I hereby give you perpetual unlimited permission to copy,
8 #> modify and relicense this file, provided that you do not remove
9 #> my name from the file itself. (I assert my moral right of
10 #> paternity under the Copyright, Designs and Patents Act 1988.)
11 #
12 # Heavily modified by Joey Hess <joeyh@master.debian.org>
13 #
14 ##############################################################################
15 #
16 # NOTE: You shouldn't have to edit this file. Edit debian/config instead.
17 # If you must edit this file to get your package to build properly, then
18 # I have failed. Let me know; mail me.
19 #
20 # (Currently not handled: multiple binary packages from 1 source package,
21 # and binary-indep rule.)
22 #
23 # NOTE: This file is designed so it doesn't need to be run as root. For
24 # actions that require that the user be root, the root password will be
25 # prompted for, if you're not already root.
26 #
27 ##############################################################################
28 #
29 # Changelog:
30 # * Fakeroot and sudo fixes.
31 # * Run dpkg-gencontrol after debstd, and delete substvars during clean.
32 # * Clean up junk files in subdirs.
33 # * Modifications for multiple binary package support.
34 # * Call debstd after fixing file perms.
35 # * Don't pass package name to debstd + fixes for multi binary packages.
36 # * Use build-stamp instead of build.
37 # * New email address.
38 # * Added changelog.
39 #
40 ##############################################################################
41
42 # Include config file.
43 include debian/config
44
45 # Generate a makefile (via configure scriopt or xmkmf).
46 makefile-stamp:
47 ifeq ($(strip $(use_imakefile)),y)
48 xmkmf -a
49 endif
50 $(use_configure)
51 touch makefile-stamp
52
53 # Preserve some files that may get deleted/overwritten/modified otherwise.
54 preserve-stamp:
55 ifneq ($(strip $(preserve_files)),)
56 $(foreach file,$(preserve_files),cp $(file) $(file).preserved ;)
57 endif
58 touch preserve-stamp
59
60 build-stamp: preserve-stamp makefile-stamp
61 $(checkdir)
62 $(build_command)
63 touch build-stamp
64
65 build: build-stamp
66
67 clean: preserve-stamp makefile-stamp
68 $(checkdir)
69 # Do actual cleaning up here.
70 -rm -f build-stamp
71 $(clean_command)
72 -find . -name '\#*\#' -o -name '*~' -o -name 'DEADJOE' -exec rm -f {} \;
73 -rm -f debian/files* debian/substvars debian/*.substvars $(clean_files)
74 $(clean_tmp)
75 # Remove Makefile that xmkmf creates.
76 ifeq ($(strip $(use_imakefile)),y)
77 -rm -f Makefile
78 endif
79 # If we preserved some files, we need to restore them now.
80 ifneq ($(strip $(preserve_files)),)
81 $(foreach file,$(preserve_files),mv -f $(file).preserved $(file); )
82 endif
83 -rm -f preserve-stamp makefile-stamp
84
85 # Build architecture-independent files here.
86 # (not yet set up to be used)
87 binary-indep: build
88 $(checkdir)
89
90 # Build architecture-dependent files here.
91 binary-arch: build
92 $(checkdir)
93 $(clean_tmp)
94 $(install_command)
95 # Set permissions and check package for problems, then build package.
96 @if [ "`whoami`" != root ]; then \
97 echo -e "\n ** Enter root password to set file permissions."; \
98 sudo debian/rules setperms; \
99 else \
100 debian/rules setperms; \
101 fi
102
103 # This must be run suid root, it sets the file permissions in debian/tmp
104 setperms:
105 chown -R root.root debian/tmp
106 chmod -R g-ws debian/tmp
107 # Debstd handles lots of nasty details. This requires that the debmake
108 # package is installed.
109 -debstd $(debstd) $(docs)
110 dpkg-gencontrol -p$(package)
111 $(ch_commands)
112 dpkg --build debian/tmp ..
113
114 define checkdir
115 @test -e $(test_file) -a -f debian/rules || (echo -e "\n\
116 ** \"$(test_file)\" or \"debian/rules\" does not exist.\n\
117 ** Either the package is not unpacked in this directory, or\n\
118 ** an incorrect test_file is specified in debian/config.\n" && false)
119 endef
120
121 # This rm's the debian/tmp directory, and any other directories specified in
122 # tmpdirs
123 define clean_tmp
124 -rm -rf debian/tmp >/dev/null 2>&1
125 @if [ -d debian/tmp -o -n "$(tmp_dirs)" ]; then \
126 if [ "`whoami`" != root ]; then \
127 echo -e "\n ** Enter root password to remove temporary directories $(tmp_dirs)"; \
128 sudo rm -rf debian/tmp $(tmp_dirs); \
129 else \
130 rm -rf debian/tmp $(tmp_dirs); \
131 fi; \
132 fi
133 endef
134
135 binary: binary-indep binary-arch
136 .PHONY: clean setperms binary
This page took 0.024687 seconds and 5 git commands to generate.