Re-organise the build.
[emoney] / Makefile
CommitLineData
a7161eda 1## Makefile for eMoney -*-Makefile-*-
a7161eda 2##
ee98102e 3## Copyright (C) 2003 - 2011 Steve Youngs
a7161eda
SY
4##
5## This file is part of eMoney.
6##
7## Redistribution and use in source and binary forms, with or without
8## modification, are permitted provided that the following conditions
9## are met:
10##
11## 1. Redistributions of source code must retain the above copyright
12## notice, this list of conditions and the following disclaimer.
13##
14## 2. Redistributions in binary form must reproduce the above copyright
15## notice, this list of conditions and the following disclaimer in the
16## documentation and/or other materials provided with the distribution.
17##
18## 3. Neither the name of the author nor the names of any contributors
19## may be used to endorse or promote products derived from this
20## software without specific prior written permission.
21##
22## THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
23## IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24## WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25## DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
29## BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30## WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
31## OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
32## IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
34PACKAGE = emoney
ee98102e 35VER = 1.0
a7161eda
SY
36
37# csh... yell no, we won't go!
38SHELL = /bin/sh
39
40# Programs and their flags.
41ifndef XEMACS
42 XEMACS = sxemacs
43endif
44XEMACS_FLAGS = -batch -no-autoloads
45INSTALL = install
46PKG_INSTALL = $(INSTALL)
47TAR = tar
48TAR_FLAGS = \
49 --create \
50 --owner=0 \
51 --group=0 \
52 --gzip \
53 --file
54
55
56# Our prefix. Everything hangs off this.
57ifndef PREFIX
58 ifeq ('$(XEMACS)','sxemacs')
59 PREFIX = /usr/local/share/sxemacs/site-packages
60 else
61 PREFIX = /usr/local/lib/xemacs/site-packages
62 endif
63endif
64
65# Where the lisp files go.
66LISP_DIR = $(PREFIX)/lisp/$(PACKAGE)
67
68# If you want to make a tarball that you can just unpack on all your
69# PC's you can 'make pkg'. The 'pkg' target uses these directories to
70# build the tarball.
71STAGING = ../build-pkg
72INFO_STAGING = $(STAGING)/info
73LISP_STAGING = $(STAGING)/lisp/$(PACKAGE)
74
75
76############################################################################
77## No User Configurable Items Below Here ##
78############################################################################
79
80SOURCES = $(wildcard ./emoney*.el)
81OBJECTS = $(SOURCES:.el=.elc)
82EXTRA_SRC =
0c4cafbc 83EXTRA_OBJ = $(wildcard ./auto-autoloads.el*) $(wildcard ./custom-*.el*)
a7161eda 84
0c4cafbc 85all:: emoney-version.el compile
a7161eda 86
0c4cafbc
SY
87compile:
88 $(XEMACS) $(XEMACS_FLAGS) -l "build.el"
a7161eda
SY
89
90emoney-version.el:
91 echo ";;; Automatically generated file -- DO NOT EDIT OR DELETE" > $@
92 echo ";;;###autoload" >> $@
93 echo "(defconst emoney-version" >> $@
ee98102e
SY
94 if [[ -d ".git" && -x `which git 2>/dev/null` ]]; then \
95 printf ' "%s"' `git describe` >> $@; \
a7161eda
SY
96 else \
97 echo -n ' "$(VER)"' >> $@; \
98 fi
99 echo ")" >> $@
100 echo "(provide 'emoney-version)" >> $@
101
102version: emoney-version.el
103
104install: all
105 $(INSTALL) -d $(LISP_DIR)
106 $(INSTALL) -m 644 $(SOURCES) $(EXTRA_SRC) $(OBJECTS) $(EXTRA_OBJ) \
107 $(LISP_DIR)
108
109pkg: all
110 $(PKG_INSTALL) -d $(STAGING) $(LISP_STAGING)
111 $(PKG_INSTALL) -m 644 $(SOURCES) $(EXTRA_SRC) $(OBJECTS) $(EXTRA_OBJ) \
112 $(LISP_STAGING)
113 (cd $(STAGING); \
114 $(TAR) $(TAR_FLAGS) $(PACKAGE)-$(VER)-pkg.tar.gz ./*)
115
116upgrade: uninstall install
117
118uninstall::
119 rm -rf $(LISP_DIR)
120 # rm -f $(INFO_DIR)/$(INFO_FILES)
121
122
123clean::
0c4cafbc
SY
124 rm -f $(OBJECTS) \
125 auto-autoloads.el* custom-*.el*
a7161eda
SY
126
127distclean: clean
128 rm -f core* *~ TAGS tags emoney-version.el*
129
130# Developer targets
131tags: TAGS
132
133TAGS: $(SOURCES)
134 etags $(SOURCES)
135
136dist: distclean
137 (cd ../ ; \
138 $(TAR) $(TAR_FLAGS) $(PACKAGE)-$(VER).tar.gz ./$(PACKAGE)/)
139
140.PHONY: emoney-version.el version