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 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
|
#!/usr/bin/make -f
# Package name
#
p=seesat5
# Define variables and flags
#
STRIP = -s
INSTALL = install
INSTALL_BIN = $(INSTALL) $(STRIP) --owner=root --mode=0755
INSTALL_LIB = $(INSTALL) --owner=root --group=root --mode=0644
INSTALL_DIR = $(INSTALL) --directory --owner=root --mode=0775
GZIP = gzip
TARGET-ROOT =
PREFIX = /usr
BIN_DIR = $(TARGET-ROOT)$(PREFIX)/bin
MAN_DIR = $(TARGET-ROOT)$(PREFIX)/share/man
DOC_DIR = $(TARGET-ROOT)$(PREFIX)/share/doc/$(p)
EXAMPLE_DIR = $(TARGET-ROOT)$(PREFIX)/share/doc/$(p)/examples
# Build the components of the package
#
build:
$(checkdir)
make
-rm clean
touch build
# Clean up after a build
#
clean:
$(checkdir)
-rm -f build
-rm -f *.o seesat5 cr
-rm -rf debian/tmp *~ debian/*~ *.orig ./#*#
-rm -rf debian/substvars* debian/files*
touch clean
# There are no binary independent components to this package
#
binary-indep:
# None
@echo 'No indepenent portions for this package.'
# Collect the binary components and build the package
#
binary binary-arch: checkroot build
# Make sure old tmp directory is gone
#
-rm -rf debian/tmp
# Install new temporary directories for collecting components
#
$(INSTALL_DIR) debian/tmp debian/tmp/DEBIAN
# Install scripts
#
cp debian/postinst debian/prerm debian/tmp/DEBIAN/
chmod +x debian/tmp/DEBIAN/postinst debian/tmp/DEBIAN/prerm
# Install the package components
#
make -f debian/rules TARGET-ROOT=debian/tmp install
# Determine dependencies
#
dpkg-shlibdeps $(p)
# Generate control information
#
dpkg-gencontrol
# Set permissions and ownerships on all files in package
#
chown -R root.root debian/tmp
chmod -R g-ws debian/tmp
# Build the binary package
#
dpkg --build debian/tmp ..
# Install all components of this package
#
install: build
# Create the installation directory
#
$(INSTALL_DIR) $(BIN_DIR)
# Install the binaries for seesat5 and cr
#
$(INSTALL_BIN) seesat5 $(BIN_DIR)/seesat5
$(INSTALL_BIN) cr $(BIN_DIR)/cr
# Create man1 directory
#
$(INSTALL_DIR) $(MAN_DIR)/man1
# Install man pages for seesat5 and cr
#
$(INSTALL_LIB) Docs/seesat5.man.1 $(MAN_DIR)/man1/seesat5.1
$(INSTALL_LIB) Docs/cr.man.1 $(MAN_DIR)/man1/cr.1
# Create man5 directory
#
$(INSTALL_DIR) $(MAN_DIR)/man5
# Install man pages for SEESAT5.INI and tle
#
$(INSTALL_LIB) Docs/SEESAT5.INI.man.5 $(MAN_DIR)/man5/SEESAT5.INI.5
$(INSTALL_LIB) Docs/tle.man.5 $(MAN_DIR)/man5/tle.5
# Create man7 directory
#
$(INSTALL_DIR) $(MAN_DIR)/man7
# Install man pages for seesat5
#
$(INSTALL_LIB) Docs/seesat5.man.7 $(MAN_DIR)/man7/seesat5.7
# Create the docs directory
#
$(INSTALL_DIR) $(DOC_DIR)
# Install and gzip all the docs
#
$(INSTALL_LIB) Docs/seesat5.docs.old $(DOC_DIR)
$(INSTALL_LIB) debian/changelog $(DOC_DIR)
$(GZIP) $(DOC_DIR)/*
# Except don't gzip the copyrighti
#
$(INSTALL_LIB) debian/copyright $(DOC_DIR)
# Create the example directory
#
$(INSTALL_DIR) $(EXAMPLE_DIR)
# Install and gzip example files
#
$(INSTALL_LIB) Docs/Visual.tle $(EXAMPLE_DIR)
$(INSTALL_LIB) Docs/SEESAT5.INI.example $(EXAMPLE_DIR)
$(GZIP) $(EXAMPLE_DIR)/*
#
# End of component installation
# Bookkeeping
#
define checkdir
test -f seesat.c -a -f debian/rules
endef
checkroot:
$(checkdir)
test root = "`whoami`"
.PHONY: binary binary-arch binary-indep source clean checkroot
|