Commit graph

73 commits

Author SHA1 Message Date
Aaron Ecay
c10085c77b Fix up Makefile for build.
Must set extra_c(xx)flags before including subdir Makefile.local's,
so that there is a blank slate that the subdirs can add on to.

Must include subdir Makefile.local's before global one, otherwise
the compat sources are not added to the list of those to be
compiled.

Signed-off-by: Aaron Ecay <aaronecay@gmail.com>
2010-04-14 10:46:36 -07:00
Carl Worth
b5d8fe2784 Makefile: Move the completion-specific commands to completion/Makefile.local
For much better modularity.
2010-04-06 14:36:31 -07:00
Carl Worth
784e55d0f9 Move bulk of rules from Makefile to Makefile.local.
Before it was impossible to know whether any particular setting or
rule definition was in Makefile or Makefile.local. So we strip the
Makefile down to little more than the list of sub-directories and
the logic to include all of the sub-directories' Makefile.local
fragments.

Then, all of the real work can happen inside of Makefile.local.
2010-03-31 22:12:01 -07:00
Ben Gamari
266ab595a2 Build and link against notmuch shared library, install notmuch.h
Signed-off-by: Ingmar Vanhassel <ingmar@exherbo.org>
2010-03-31 17:38:27 -07:00
Carl Worth
86232e62ab Makefile: Fix Makefiles to depend on all child Makefile fragments.
We were previously maintaining two lists of the child Makefile
fragments---one for the includes and another for the dependencies. So,
of course, they drifted and the dependency list wasn't up to date.

We fix this by adding a single subdirs variable, and then using GNU
Makefile substitution to generate both the include and the dependency
lists.

Some side effect of this change caused the '=' assignment of the dir
variable to not work anymore. I'm not sure why that is, but using ':='
makes sense here and fixes the problem.
2010-03-10 10:59:57 -08:00
Carl Worth
f47bec55bd Makefile: Use 'emacs --quick' for a less noisy build of "make install-emacs".
I don't really notice if it goes any quicker, but it's sure nice to have
less spew now.
2010-03-10 10:58:46 -08:00
Carl Worth
985263cf51 Makefile: Simplify the conditional message of the all target.
We wamt a simple "make" to call the 'all' target and then print a
message when done, but we don't want "make install" which depends on
that same 'all' target to print the message.

We previously did this with a separate 'all-without-message' target,
which was inelegant because it caused all users of the target to
carefully depend on 'all-without-message' rather than 'all'.

Instead, we now use a single 'all' target but with a Makefile
conditional that examines the MAKECMDGOALS variable to determine
whether to print the message.
2010-03-10 10:44:44 -08:00
Carl Worth
2b8131f079 Makefile: Add a meesage after "make" telling the user to run "make install"
As one command completes, it's kind of the tool to indicate which
command the user should execute next.
2010-03-09 17:03:11 -08:00
Carl Worth
6b92ca5a05 Makefile: Rename all_deps to global_deps
The "all" inside this variable name was easy to confuse with the
separate "all" target. This variable specifies dependencies that apply
to every target, so use "global" instead.
2010-03-09 17:01:55 -08:00
David Bremner
bbda0a0156 emacs: Move emacs UI (currently just one file) to subdirectory.
Add emacs/Makefile.local and emacs/Makefile. Move emacs targets into
emacs/Makefile.local, but leave the byte compilation rule in the top
level Makefile.
2010-03-09 12:13:33 -08:00
martin f. krafft
1ef33800df Install zsh completion file
According to the Debian zsh maintainer Clint Adams, this is the first
time that a package installs its own completer into zsh. Part of the
reason this is not usually done is because zsh does not provide a stable
API.

We agreed to try it, given that notmuch is expected to change quite
a bit initially. If there are problems or the completer goes stable,
we'll move it into the upstream zsh repository.

Signed-off-by: martin f. krafft <madduck@debian.org>
2010-01-14 18:12:13 +13:00
Carl Worth
59265c0233 Makefile: Mention "./configure --help" now that it exists.
Since we're directing the user to ./confgiure for more options,
actually tell the user how to discover what those options are.
2009-12-04 16:09:40 -08:00
Carl Worth
40e584ecfc Makefile: Silence compiler errors during dependency generation.
We have a bootstrapping issue with our dependency generation. When the
Makefile.config doesn't exist yet, the complete compilation flags are
not yet available for passing to the compiler to generate the
dependencies.

But we don't have explicit rules to create these dependency files,
(just the implicit rule that is created by the -include), so we can't
control when make will attempt to create them.

We do have a dependency of the dependency files on Makefile.config, so
make should eventually call the compiler with the correct flags and
everything should be good. So in the meantime, silence any complaints.
2009-12-04 15:40:54 -08:00
Carl Worth
4b0327004a Makefile: Inform user that they might want to call ./configure explicitly.
If the Makefile does this for the user, then no arguments are passed. So
it's only polite to let the user know that it's possible to get pass those
arguments.
2009-12-04 15:32:05 -08:00
Carl Worth
943f415f81 configure: Support the capturing of CFLAGS and CXXFLAGS at configure time.
These variables can now be set via configure time via environment
variables like so:

	CFLAGS=-g ./configure

and subsequent builds will remember these values. The values can
still be overridden at compile time by passing make variables:

      make CFLAGS=-O2

The CXXFLAGS variable is optional. If unset at either configure
time or at compile time, it will inherit its value from the
CFLAGS variable. (Though if explicitly set at configure time
it must be explicitly overriden at compile time---just overriding
CFLAGS will not override CXXFLAGS as well.)
2009-12-04 15:20:12 -08:00
Carl Worth
c7f971e8c0 Fix quiet compilation to print the user's CFLAGS, CXXFLAGS, LDFLAGS.
The only reason I ever call "make V=1" myself, (other than when
debugging the compiler command-line for some reason), is to ensure
whether my CFLAGS, (like "-g -O0" or "-O2"), are actually making it to
the command-line.

But these are hard to find in the V=1 output, and really, we should
just print these even in the quiet case. So do that.
2009-12-04 15:08:37 -08:00
Carl Worth
222ee87dfe configure: Resolve all pkg-config flags at configure time.
Previously, we were resolving these within the Makefile. This had
the problem that if pkg-config was not present, the Makefile would
still invoke it resulting in ugly errors before the configure script
was even run, (which would finally present a kind error message about
pkg-config not being present).
2009-12-01 18:03:31 -08:00
Carl Worth
e806e723c8 Makefile: Split warnings into two sets (WARN_CFLAGS and WARN_CXXFLAGS)
Some C++ compilers complain about -Wmissing-declarations not being
valid, so avoid passing it except when compiling a C file.
2009-12-01 16:42:50 -08:00
Carl Worth
af4928eb3a Makefile: Switch from echo to printf for better portability.
Some systems have an echo implementation which doesn't know how to
interpret a sequence of "\n". The word is that printf should be much
more portable, so let's try that instead.
2009-12-01 16:38:47 -08:00
Carl Worth
650f6ac573 configure: Assimilate new getlinetest into recent configure conventions.
We're now using printf to print what we're checking before we check. We're
also making variables such as HAVE_GETLINE available to both make and to
the C pre-processor.

With this, the local getline implementation is now only compiled if not
available on the system.
2009-12-01 16:33:25 -08:00
Carl Worth
880b21a097 Makefile: Incorporate getline implementation into the build.
It's unconditional for a very short time. We expect to soon be
building it only if necessary.
2009-12-01 16:33:17 -08:00
Carl Worth
7c2c26bc4e Makefile: Add new "install-bash" target for bash completion support
It was problematic to have this in "make install" since it would
unconditionally try to install to /etc, (even if a non-privileged user
was attempting an install to a prefix in the user's home directory,
for example).
2009-12-01 10:14:00 -08:00
Carl Worth
98b93a7d5a Remove Makefile.config from the repository.
Instead of shipping a default version, we now add a rule to automatically
run configure if necessary to create Makefile.config.
2009-12-01 08:34:09 -08:00
Jan Janak
685a8ad23b makefile: Declare clean target as phony.
This ensures that make clean always proceeds, even if the user
accidentally creates a file named 'clean'. Also, it ignores errors in
rm and other commands.

Signed-off-by: Jan Janak <jan@ryngle.com>
2009-11-23 03:41:31 +01:00
Carl Worth
1266d8511e Makefile: Fix to work even with GZIP environment variable set.
The rule here was written to assume that if the GZIP environment
variable was set that it would be the gzip binary to execute,
(similar to the CC and CXX variables). But GZIP is actually used
to pass arguments to gzip, so we have to use a different name.
2009-11-22 04:45:16 +01:00
Chris Wilson
530df68258 Makefile: Magic silent rules.
Use the facilities of GNU make to create a magic function that will
on the first invocation print a description of how to enable verbose
compile lines and then print the quiet rule.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Carl Worth <cworth@cworth.org>
Cc: Mikhail Gusarov <dottedmag@dottedmag.net>

[ickle: Rebased, and duplicate command string eliminated.]
[ickle: Fixed verbose bug pointed out by Mikhail]
2009-11-22 04:29:29 +01:00
Carl Worth
21f3252436 Makefile: Fix the fallback emacs install path.
When pkg-config can't be used to find out where to install emacs
files, we fallback to a hard-coded directory. Only, we were falling
back to the wrong thing, (one that emacs doesn't look into by
default).
2009-11-21 11:40:37 +01:00
Jed Brown
49132ebc76 Drop redundant CFLAGS, was already included in CXXFLAGS 2009-11-21 01:17:31 +01:00
Jan Janak
5150b15b87 Makefile: Make object targets depend on Makefiles
All objects need to be recompiled when any of the Makefiles changes, so
we make them all depend on all the Makefiles.

Signed-off-by: Jan Janak <jan@ryngle.com>
2009-11-20 13:44:09 +01:00
Carl Worth
0a575c9580 Makefile: Hard-code emacs_lispdir if emacs pkg-config file not available
Using pkg-config to find this variable is nice if it works. Go back to
the previously used value if it doesn't.
2009-11-20 13:07:42 +01:00
Carl Worth
1ddba66a3f Makefile: Remove unused variable emacs_startdir
This was added in a prelimnary version of a previous commit that would
automatically load notmuch.el for anyone running emacs. It's not used
at all in the current Makefile.
2009-11-20 12:58:42 +01:00
Jeffrey C. Ollie
d98718d104 Improve installation of emacs mode.
1) Add a separate targets to build and install emacs mode.

2) Don't hardcode the installation directory, instead use emacs'
   pkg-config module.

3) Install a byte compiled version of the emacs mode.

4) Install the emacs mode in emacs' site-lisp directory.  Put
   "(require 'notmuch)" in your .emacs to load it automatically.

5) Ignore byte-compiled emacs files.

Signed-off-by: Jeffrey C. Ollie <jeff@ocjtech.us>
Reviewed-by: Ingmar Vanhassel <ingmar@exherbo.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
2009-11-20 10:34:29 +01:00
Chris Wilson
4a6a1ed654 Makefile: evaluate pkg-config once
Currently the same `pkg-config ...` is executed for every target, so
just store the results in a variable.
2009-11-19 00:20:20 +01:00
Ingmar Vanhassel
2ce25b93a7 Typsos 2009-11-18 03:21:36 -08:00
Carl Worth
e12a6b91ac Makefile: Change default install prefix from /usr to /usr/local
We'll be a much more polite package this way. And the user can change
the prefix by editing Makefile.config. Still to be done is to make
configure write out Makefile.config and to add a --prefix option to
configure.
2009-11-17 13:05:16 -08:00
Carl Worth
5f5e9b8662 Makefile: Fix dependency generation for files in sub-directories.
Otherwise, things in the lib sub-directory weren't getting recompiled
even when lib/notmuch.h was changed.

The original rule we were using came from the GNU Makefile manual, but
only handled files in the current directory, not file in
sub-directories as we use here with our non-recursive Makefile.

So the .deps files being created were being put in the right place,
(such as .deps/lib/database.d), but the compiler was generating a
dependency for "database.o" rather than "lib/database.o" like we
want. We were already trying to do a sed job on that name to add a
dependency for the .d file as well. But the sed job was failing since
the expected pattern wasn't there, (the directory name was missing).

So the fix is simply to use basename to construct the search pattern,
and then use the name with the directory in the replacement (rather
than the back-reference).
2009-11-12 22:24:55 -08:00
Carl Worth
da5a2e2fe6 Makefile: Change default flags to -O2.
We've now verified that it's reliable for the user to override CFLAGS
on the command line, so just make the user do to get a debug build.
2009-11-10 08:36:41 -08:00
Carl Worth
946c94b6a1 Makefile: Make the top-level Makefile a little more independent.
Previously, the top-level Makefile was explicitly adding -I./lib to
the compiler flags. However, that's something that's much better done
from within the Makefile.local fragment within the lib directory
itself.
2009-11-10 08:34:54 -08:00
Carl Worth
1a6208bfbd Makefile: Simplify setting of CFLAGS, etc.
We were previously using separate CFLAGS and NOTMUCH_CFLAGS variables
in an attempt to allow the user to specify CFLAGS on the command-line.

However, that's just a lot of extra noise in the Makefile when we can
instead let the user specify what is desired for CFLAGS and then use
an override to append the things we require. So our Makefile is much
neater now.
2009-11-10 08:27:48 -08:00
Carl Worth
97c7cffdc6 Makefile: Fix dependency generation to make .d files themselves dependent.
I saw this recommendation in the implementation notes for "Recursive
Make Considered Harmful" and then the further recommendation for
implementing the idea in the GNU make manual.

The idea is that if any of the files change then we need to regenerate
the dependency file before we regenerate any targets.

The approach from the GNU make manual is simpler in that it just uses
a sed script to fix up the output of an extra invocation of the
compiler, (as opposed to the approach in the implementation notes from
the paper's author which use a wrapper script for the compiler that's
always invoked rather than the compiler itself).
2009-11-10 08:04:54 -08:00
Carl Worth
c5dccd851a Implement a non-recursive make.
The idea here is that every Makefile at each lower level will be an
identical, tiny file that simply defers to a top-level make.

Meanwhile, the Makefile.local file at each level is a Makefile snippet
to be included at the top-level into a large, flat Makefile. As such,
it needs to define its rules with the entire relative directory to
each file, (typically in $(dir)). The local files can also append to
variables such as SRCS and CLEAN for files to be analyzed for
dependencies and to be cleaned.
2009-11-10 07:24:10 -08:00
Carl Worth
3cdb24d38a Makefile: Hide away auto-generated dependency file as .depends.
Instead of the old name of Makefile.dep. The idea being that the
user really doesn't need to see this by default, (and if debugging
the Makefile, the rules will make the name obvious).
2009-11-09 16:24:50 -08:00
Carl Worth
1465493210 libify: Move library sources down into lib directory.
A "make" invocation still works from the top-level, but not from
down inside the lib directory yet.
2009-11-09 16:24:03 -08:00
Carl Worth
73ee42be36 Makefile: Fix install target to depend on the all target.
Otherwise, it would just fail if you hadn't run "make" already.
2009-11-06 09:33:44 -08:00
Carl Worth
fa226a7a10 Drop date.c file, (use identical function from GMime instead).
We had originally copied this function in at a time when notmuch
wasn't actually depending on the GMime library. Now that it does,
we might as well call the function that exists there rather
than having a private copy of it.
2009-11-02 14:36:33 -08:00
Carl Worth
f6183a92b5 Makefile: Rewrite to use NOTMUCH rather than MY in variable names.
I was about to refer to these names in some documentation, so I
wanted a slightly better name for them.
2009-11-02 07:18:49 -08:00
Carl Worth
1a579dfe6b Add a simple manual page for notmuch.
By pulling content out of notmuch help, and also the messages
printed by "notmuch setup".
2009-11-02 07:18:31 -08:00
Carl Worth
2b819ae83d Makefile: Add a simple target for "make install".
The more I do here, the less I see the need for autotools.
2009-10-30 12:00:55 -07:00
Carl Worth
f9bbd7baa0 Add full-text indexing using the GMime library for parsing.
This is based on the old notmuch-index-message.cc from early in
the history of notmuch, but considerably cleaned up now that
we have some experience with Xapian and know just what we want
to index, (rather than just blindly trying to index exactly
what sup does).

This does slow down notmuch_database_add_message a *lot*, but I've
got some ideas for getting some time back.
2009-10-28 12:50:10 -07:00
Carl Worth
2affed0851 Move terms and tags code to a new tags.cc file.
We want to start using this from both message.cc and thread.cc so we
need it in a place we can share the code. This also requires a new
notmuch-private-cxx.h header file for interfaces that include
C++-specific datatypes (such as Xapian::Document).
2009-10-26 05:53:40 -07:00