Add to git.
[makeplus.git] / make+-skeleton
1 #!/bin/sh
2 #
3 # This is make+. Make+ is a set of scripts which enhance GNU make and
4 # let ou build RPMs, and other packages types with just one control
5 # file. Read more at http://www.annexia.org/freeware/makeplus/
6 #
7 # The original author is Richard W.M. Jones <rich@annexia.org>.
8 #
9 # This software has been explicitly placed in the PUBLIC DOMAIN.  You
10 # do not need any sort of license or agreement to use or copy this
11 # software. You may also copyright this software yourself, and/or
12 # relicense it under any terms you want, at any time and at no cost.
13 # This allows you (among other things) to include this software with
14 # other packages so that the user does not need to download and
15 # install make+ separately.
16
17 set -e
18
19 # Check that either MAKEPLUS_HOME or /etc/make+.conf exists, and run it.
20 if [ "x$MAKEPLUS_HOME" = "x" ]; then
21     for d in /etc /usr/etc /usr/local/etc; do
22         if [ -f $d/make+.conf ]; then
23             . $d/make+.conf
24             break
25         fi
26     done
27 fi
28
29 # Overwrite 'configure' with the latest version. This file is never
30 # important, even in autoconf-based installations.
31 cp $MAKEPLUS_HOME/configure .
32 chmod 0755 configure
33
34 # Check 'Makefile+' does not exist in the current directory.
35 if [ -f "Makefile+" ]; then
36     echo "There is already a file 'Makefile+' in the current directory."
37     echo "I won't overwrite this file. Remove this file and rerun me."
38     exit 1
39 fi
40
41 # Get the name of the package.
42 echo -n "What is the name of your package? "
43 read PACKAGE
44
45 # Get the version number.
46 echo
47 echo "Now I'm going to ask you for the initial version number for this"
48 echo "package. Version numbers have two parts: the MAJOR part and the"
49 echo "MINOR part."
50 echo
51 echo "The MAJOR part is a single number (eg 3). It is used (for example)"
52 echo "for versioning libraries."
53 echo
54 echo "The MINOR part is two numbers separated by a single DOT (eg 1.0)"
55 echo "This is the incremental release of the library."
56 echo
57 echo "If you library is version 3.1.0 then the MAJOR part would be"
58 echo "  3"
59 echo "and the MINOR part would be"
60 echo "  1.0"
61 echo
62
63 echo -n "What is the MAJOR part of the version? "
64 read VERSION_MAJOR
65
66 echo -n "What is the MINOR part of the version? "
67 read VERSION_MINOR
68
69 # Create the Makefile+ file.
70
71 cat > Makefile+ <<EOF
72 # -*- Makefile -*-
73 #
74 # This is a make+ file. Make+ is a set of scripts which enhance GNU
75 # make and let you build RPMs, and other package types with just one
76 # control file.  To build this package you will need to download make+
77 # from this site: http://www.annexia.org/freeware/makeplus/
78
79 PACKAGE         := $PACKAGE
80 VERSION_MAJOR   := $VERSION_MAJOR
81 VERSION_MINOR   := $VERSION_MINOR
82 VERSION         := \$(VERSION_MAJOR).\$(VERSION_MINOR)
83
84 SUMMARY         := XXX A ONE LINE SUMMARY OF YOUR PACKAGE
85 COPYRIGHT       := XXX ONE LINE COPYRIGHT OR LICENSE
86 AUTHOR          := XXX YOUR NAME AND EMAIL ADDRESS
87
88 define DESCRIPTION
89 XXX A FEW PARAGRAPHS ABOUT WHAT YOUR PACKAGE DOES
90 endef
91
92 #RPM_REQUIRES   :=
93 RPM_GROUP       := Development/Libraries
94
95 CFLAGS          += -Wall -Werror -g -O2
96
97 all:    build
98
99 # XXX MODIFY THE FOLLOWING TO CONFIGURE YOUR PACKAGE
100 configure:
101         \$(MP_CONFIGURE_START)
102         \$(MP_CHECK_HEADERS) string.h unistd.h
103         \$(MP_CONFIGURE_END)
104
105 build:
106 # XXX ADD CODE HERE TO BUILD YOUR PACKAGE
107
108 test: XXX LIST OF TEST PROGRAMS
109         \$(MP_RUN_TESTS) $^
110
111 # XXX MODIFY THE FOLLOWING CODE TO INSTALL YOUR PACKAGE
112 # XXX ALWAYS REMEMBER TO PREFIX INSTALLATION PATHS WITH \$(DESTDIR)
113 install:
114         install -d \$(DESTDIR)\$(bindir)
115         install -m 0755 my_program \$(DESTDIR)\$(bindir)
116
117 define WEBSITE
118 <html>
119 XXX PUT YOUR WEBSITE HERE. IF YOU DON\'T WANT TO MANAGE A WEBSITE WITH
120 XXX MAKE+ THEN JUST DELETE THIS SECTION AND THE upload_website RULE.
121 </html>
122 endef
123
124 upload_website:
125         scp \$(PACKAGE)-\$(VERSION).tar.gz \$(PACKAGE)-\$(VERSION)-1.*.rpm \\
126         \$(PACKAGE)-\$(VERSION).bin.tar.gz \\
127         you@yourmachine.example.com:/var/www/html/\$(PACKAGE)/files
128         scp index.html you@yourmachine.example.com:/var/www/html/\$(PACKAGE)/
129
130 .PHONY: build configure test upload_website
131 EOF
132
133 echo
134 echo "I've written a Makefile+ file for you. You'll need to edit this file."
135 echo "Start by searching for all the 'XXX's and replacing them as necessary."