fish-shell/Makefile.in
axel 1d69e70b7a Initial blocking implementation
darcs-hash:20051211222101-ac50b-6e11220bd608187fbb32a0313b5b73dbdc8354fc.gz
2005-12-12 08:21:01 +10:00

469 lines
18 KiB
Makefile

#
# Copyright (C) 2005 Axel Liljencrantz
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#
# Makefile for the fish shell. Can build fish and associated
# applications, install them, recalculate dependencies and also create
# binary distributions in tar.bz2 tar.gz and rpm formats.
#
#
# The fish buildprocess is quite complex. Do not stare directly into
# the Makefile. Doing so may cause nausea, dizziness and
# hallucinations.
#
# Compiler flags
CC := @CC@
CFLAGS := @CFLAGS@ @INCLUDEDIR@ -Wall -std=gnu99 -fno-strict-aliasing
CPPFLAGS=@CPPFLAGS@
LDFLAGS:= -l@CURSESLIB@ @LIBS@ @LDFLAGS@ @LIBDIR@
INSTALL:=@INSTALL@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
mandir = @mandir@
sysconfdir = @sysconfdir@
fishdir = @fishdir@
fishfile = @fishfile@
fishinputfile = @fishinputfile@
docdir = @docdir@
# All objects used by fish, that are compiled from an ordinary .c file
# using an ordinary .h file.
COMMON_OBJS := function.o builtin.o common.o complete.o env.o exec.o \
expand.o highlight.o history.o kill.o parser.o proc.o reader.o \
sanity.o tokenizer.o util.o wildcard.o wgetopt.o wutil.o input.o \
output.o intern.o env_universal.o env_universal_common.o \
input_common.o event.o signal.o io.o
# builtin_help.h exists, but builtin_help.c is autogenerated
COMMON_OBJS_WITH_HEADER := builtin_help.o
# main.c exists, but main.h does not, etc.
COMMON_OBJS_WITH_CODE := builtin_set.o builtin_commandline.o builtin_ulimit.c
# All objects that the system needs to build fish
FISH_OBJS := $(COMMON_OBJS) $(COMMON_OBJS_WITH_CODE) $(COMMON_OBJS_WITH_HEADER) main.o
FISH_PAGER_OBJS := fish_pager.o common.o output.o util.o wutil.o tokenizer.o input_common.o env_universal.o env_universal_common.o
FISH_TESTS_OBJS := $(COMMON_OBJS) $(COMMON_OBJS_WITH_CODE) $(COMMON_OBJS_WITH_HEADER) fish_tests.o
FISHD_OBJS := fishd.o env_universal_common.o common.o util.o wutil.o \
#All objects that the system needs to build mimedb
MIME_OBJS := mimedb.o xdgmimealias.o xdgmime.o xdgmimeglob.o \
xdgmimeint.o xdgmimemagic.o xdgmimeparent.o wutil.o
#
# Files containing documentation for builtins. Should be listed
# alphabetically, since this is the order in which they will be written
# in the help file.
#
BUILTIN_DOC_SRC := doc_src/source.txt doc_src/and.txt \
doc_src/begin.txt doc_src/bg.txt doc_src/bind.txt \
doc_src/block.txt doc_src/break.txt doc_src/builtin.txt \
doc_src/case.txt doc_src/cd.txt doc_src/command.txt \
doc_src/commandline.txt doc_src/complete.txt doc_src/continue.txt \
doc_src/else.txt doc_src/end.txt doc_src/eval.txt doc_src/exec.txt \
doc_src/exit.txt doc_src/fg.txt doc_src/for.txt \
doc_src/function.txt doc_src/functions.txt doc_src/if.txt \
doc_src/jobs.txt doc_src/not.txt doc_src/or.txt doc_src/random.txt \
doc_src/return.txt doc_src/read.txt doc_src/set.txt \
doc_src/status.txt doc_src/switch.txt doc_src/ulimit.txt \
doc_src/while.txt
#
# Files generated by running doxygen on the files in $(BUILTIN_DOC_SRC)
#
BUILTIN_DOC_HDR := $(BUILTIN_DOC_SRC:.txt=.doxygen)
#
# Files containing documentation for external commands. Should be listed
# alphabetically, since this is the order in which they will be written
# in the help file.
#
CMD_DOC_SRC := doc_src/count.txt doc_src/dirh.txt doc_src/dirs.txt \
doc_src/fishd.txt doc_src/help.txt doc_src/mimedb.txt \
doc_src/nextd.txt doc_src/open.txt doc_src/popd.txt \
doc_src/prevd.txt doc_src/psub.txt doc_src/pushd.txt \
doc_src/set_color.txt doc_src/tokenize.txt doc_src/type.txt \
doc_src/umask.txt doc_src/vared.txt
#
# Files generated by running doxygen on the files in $(CMD_DOC_SRC)
#
CMD_DOC_HDR := $(CMD_DOC_SRC:.txt=.doxygen)
TEST_IN := $(wildcard tests/test*.in)
#
# Files that should be added to the tar archives
#
# Files in ./doc_src/
DOC_SRC_DIR_FILES := doc_src/Doxyfile.in doc_src/doc.hdr \
$(BUILTIN_DOC_SRC) $(CMD_DOC_SRC) doc_src/fish.1.in
# Files in ./
MAIN_DIR_FILES := Doxyfile Doxyfile.user Makefile.in configure \
configure.ac config.h.in install-sh set_color.c count.c \
key_reader.c tokenize.c gen_hdr.sh gen_hdr2.c $(MIME_OBJS:.o=.h) \
$(MIME_OBJS:.o=.c) $(COMMON_OBJS_WITH_HEADER:.o=.h) \
$(COMMON_OBJS:.o=.h) $(COMMON_OBJS_WITH_CODE:.o=.c) \
$(COMMON_OBJS:.o=.c) builtin_help.hdr fish.spec.in INSTALL README \
user_doc.head.html xsel-0.9.6.tar ChangeLog config.sub \
config.guess fish_tests.c main.c fish_pager.c fishd.c
# Files in ./init/
INIT_DIR_FILES :=init/fish.in init/fish_complete.fish.in \
init/fish_function.fish init/fish_inputrc \
init/fish_interactive.fish.in
# Files in ./tests/
TESTS_DIR_FILES := $(TEST_IN) $(TEST_IN:.in=.out) $(TEST_IN:.in=.err) \
$(TEST_IN:.in=.status) tests/test.fish tests/gen_output.fish
COMPLETIONS_DIR_FILES := $(wildcard init/completions/*.fish)
# Programs to build
PROGRAMS:=fish set_color tokenize @XSEL@ mimedb count fish_pager fishd
# Manuals to install
MANUALS:=doc_src/fish.1 @XSEL_MAN_PATH@ \
doc_src/builtin_doc/man/man1/mimedb.1 \
doc_src/builtin_doc/man/man1/set_color.1 \
doc_src/builtin_doc/man/man1/tokenize.1 \
doc_src/builtin_doc/man/man1/count.1
#Make everything needed for installing fish
all: $(PROGRAMS) user_doc
# User documentation, describing the features of the fish shell.
user_doc: doc.h Doxyfile.user user_doc.head.html
doxygen Doxyfile.user
#Source code documentation. Also includes user documentation.
doc: *.h *.c doc.h Doxyfile builtin_help.c
doxygen;
# PDF version of the source code documentation.
doc/refman.pdf: doc
cd doc/latex;
make;
mv refman.pdf ..;
cd ../..;
rm -r doc/latex;
test: $(PROGRAMS) fish_tests
./fish_tests; cd tests; ../fish <test.fish;
xsel-0.9.6:
tar -xf xsel-0.9.6.tar
xsel-0.9.6/xsel: xsel-0.9.6
cd xsel-0.9.6; ./configure; make
# doc.h is a compilation of the various snipptes of text used both for
# the user documentation and for internal help functions into a single
# file that can be parsed dy Doxygen to generate the user
# documentation.
doc.h:$(BUILTIN_DOC_SRC) $(CMD_DOC_SRC) doc_src/doc.hdr
cat doc_src/doc.hdr >doc.h;
echo "/** \page builtins Builtin commands" >>doc.h;
cat $(BUILTIN_DOC_SRC) >>doc.h;
echo "*/" >>doc.h
echo "/** \page commands External commands" >>doc.h;
echo "\c fish is shipped with commands which do not use any internal parts of the shell, and are therefore not written as builtins, but separate commands." >>doc.h
cat $(CMD_DOC_SRC) >>doc.h;
echo "*/" >>doc.h
# This rule creates complete doxygen headers from each of the various
# snipptes of text used both for the user documentation and for
# internal help functions, that can be parsed to Doxygen to generate
# the internal help function text.
%.doxygen:%.txt
echo "/** \page " `basename $*` >$@;
cat $*.txt >>$@;
echo "*/" >>$@
# Generate the internal help functions by making doxygen create
# man-pages which are then converted into C code. The convertion path
# looks like this:
#
# .txt file
# ||
# (make)
# ||
# \/
# .doxygen file
# ||
# (doxygen)
# ||
# \/
# man file
# ||
# (man)
# ||
# \/
# formated text
# with escape
# sequences
# ||
# \/
# (gen_hdr2)
# ||
# \/
# .c file
#
# Which is an awful, clunky and ugly way of producing
# documentation. There ought to be something simpler.
builtin_help.c: $(BUILTIN_DOC_HDR) doc_src/count.doxygen gen_hdr2 gen_hdr.sh builtin_help.hdr $(CMD_DOC_HDR)
cd doc_src; doxygen; cd ..;
cp builtin_help.hdr builtin_help.c;
for i in $(BUILTIN_DOC_HDR) doc_src/count.doxygen ; do \
echo ' hash_put( &tbl, L"'`basename $$i .doxygen`'",' >>$@; \
./gen_hdr.sh $$i >>$@; \
echo " );" >>$@; \
echo >>$@; \
done;
echo "}" >>builtin_help.c
#
# Generate help texts for external fish commands, like set_color and
# mimedb. Depends on builtin_help.c to make sure doxygen gets run to
# generate the man files.
#
%.c : %.doxygen gen_hdr2 builtin_help.c
echo "// This file was automatically generated, do not edit" >$@
echo "#include <stdlib.h>" >>$@
echo "#include <stdio.h>" >>$@
echo >>$@
echo "void print_help()" >>$@
echo "{" >>$@
echo ' printf( "%s",' >>$@
./gen_hdr.sh $*.doxygen >>$@
echo ");" >>$@
echo "}" >>$@
#man -- doc_src/builtin_doc/man/man1/`basename $@ .c`.1 | cat -s | ./gen_hdr2 >>$@
install: all
$(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
for i in $(PROGRAMS); do\
$(INSTALL) -m 755 $$i $(DESTDIR)$(bindir) ; \
done;
$(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)$(fishdir)
$(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)$(fishdir)/completions
$(INSTALL) -m 644 init/fish $(DESTDIR)$(sysconfdir)$(fishfile)
for i in init/fish_interactive.fish init/fish_function.fish init/fish_complete.fish ; do \
$(INSTALL) -m 644 $$i $(DESTDIR)$(sysconfdir)$(fishdir); \
done;
for i in $(COMPLETIONS_DIR_FILES); do \
$(INSTALL) -m 644 $$i $(DESTDIR)$(sysconfdir)$(fishdir)/completions/; \
done;
$(INSTALL) -m 644 init/fish_inputrc $(DESTDIR)$(sysconfdir)$(fishinputfile);
$(INSTALL) -m 755 -d $(DESTDIR)$(docdir)
for i in user_doc/html/* ChangeLog; do \
if test -f $$i; then \
$(INSTALL) -m 644 $$i $(DESTDIR)$(docdir); \
fi; \
done;
$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1
for i in $(MANUALS); do \
$(INSTALL) -m 644 $$i $(DESTDIR)$(mandir)/man1/; \
done;
@echo If you want to use fish as the default shell, remember to first
@echo add the line \'$(DESTDIR)$(bindir)/fish\' to the file \'/etc/shells\'.
uninstall:
for i in $(PROGRAMS); do \
rm -f $(DESTDIR)$(bindir)/$$i; \
done;
rm -f $(DESTDIR)$(bindir)/xsel
rm -f $(DESTDIR)$(sysconfdir)$(fishfile)
rm -f $(DESTDIR)$(sysconfdir)$(fishinputfile)
rm -r $(DESTDIR)$(sysconfdir)$(fishdir)
rm -r $(DESTDIR)$(docdir)
for i in fish.1* @XSEL_MAN@ mimedb.1* set_color.1* tokenize.1* count.1*; do \
rm $(DESTDIR)$(mandir)/man1/$$i; \
done;
# The fish shell
fish: $(FISH_OBJS)
$(CC) $(FISH_OBJS) $(LDFLAGS) -o $@
fish_pager: $(FISH_PAGER_OBJS)
$(CC) $(FISH_PAGER_OBJS) $(LDFLAGS) -o $@
fishd: $(FISHD_OBJS)
$(CC) $(FISHD_OBJS) $(LDFLAGS) -o $@
fish_tests: $(FISH_TESTS_OBJS)
$(CC) $(FISH_TESTS_OBJS) $(LDFLAGS) -o $@
mimedb: $(MIME_OBJS) util.o common.o doc_src/mimedb.c
$(CC) ${MIME_OBJS} util.o common.o doc_src/mimedb.c $(LDFLAGS) -o $@
set_color: set_color.o doc_src/set_color.c
$(CC) set_color.o doc_src/set_color.c $(LDFLAGS) -o $@
tokenize: tokenize.o doc_src/tokenize.c
$(CC) tokenize.o doc_src/tokenize.c $(LDFLAGS) -o $@
# Test program for the tokenizer library
tokenizer_test: tokenizer.c tokenizer.h util.o wutil.o common.o
$(CC) ${CFLAGS} tokenizer.c util.o wutil.o common.o -D TOKENIZER_TEST $(LDFLAGS) -o $@
key_reader: key_reader.o input_common.o common.o env_universal.o env_universal_common.o util.o wutil.o
$(CC) key_reader.o input_common.o common.o env_universal.o env_universal_common.o util.o wutil.o $(LDFLAGS) -o $@
depend:
makedepend -fMakefile.in -Y *.c
# Copy all the source files into a new directory and use tar to create
# an archive from it. Simplest way I could think of to make an archive
# witout backups, autogenerated files, etc.
#
# Uses install instead of mkdir so build won't fail if the directory
# exists
fish-@PACKAGE_VERSION@.tar: $(DOC_SRC_DIR_FILES) $(MAIN_DIR_FILES) $(INIT_DIR_FILES) $(TEST_DIR_FILES) $(COMPLETIONS_DIR_FILES) ChangeLog
rm -rf fish-@PACKAGE_VERSION@
$(INSTALL) -d fish-@PACKAGE_VERSION@
$(INSTALL) -d fish-@PACKAGE_VERSION@/doc_src
$(INSTALL) -d fish-@PACKAGE_VERSION@/init
$(INSTALL) -d fish-@PACKAGE_VERSION@/init/completions
$(INSTALL) -d fish-@PACKAGE_VERSION@/tests
cp -f $(DOC_SRC_DIR_FILES) fish-@PACKAGE_VERSION@/doc_src
cp -f $(MAIN_DIR_FILES) fish-@PACKAGE_VERSION@/
cp -f $(INIT_DIR_FILES) fish-@PACKAGE_VERSION@/init/
cp -f $(COMPLETIONS_DIR_FILES) fish-@PACKAGE_VERSION@/init/completions/
cp -f $(TESTS_DIR_FILES) fish-@PACKAGE_VERSION@/tests/
tar -c fish-@PACKAGE_VERSION@ >fish-@PACKAGE_VERSION@.tar
rm -rf fish-@PACKAGE_VERSION@
fish-@PACKAGE_VERSION@.tar.gz: fish-@PACKAGE_VERSION@.tar
gzip -f --best -c fish-@PACKAGE_VERSION@.tar >fish-@PACKAGE_VERSION@.tar.gz
fish-@PACKAGE_VERSION@.tar.bz2: fish-@PACKAGE_VERSION@.tar
bzip2 -f --best -k fish-@PACKAGE_VERSION@.tar
# Create .rpm file for the current systems architecture and an
# .src.rpm file.
rpm: fish-@PACKAGE_VERSION@.tar.bz2
cp fish.spec /usr/src/redhat/SPECS/
cp fish-@PACKAGE_VERSION@.tar.bz2 /usr/src/redhat/SOURCES/
rpmbuild -ba --clean /usr/src/redhat/SPECS/fish.spec
mv /usr/src/redhat/RPMS/*/fish*@PACKAGE_VERSION@*.rpm .
mv /usr/src/redhat/SRPMS/fish*@PACKAGE_VERSION@*.src.rpm .
distclean: clean
rm -f fish.spec doc_src/fish.1 doc_src/Doxyfile
rm -f init/fish init/fish_interactive.fish init/fish_complete.fish
rm -f config.status config.log config.h Makefile
clean:
rm -f *.o doc.h doc_src/*.doxygen doc_src/*.c builtin_help.c
rm -f tests/tmp.err tests/tmp.out tests/tmp.status tests/foo.txt
rm -f tokenizer_test fish key_reader set_color tokenize gen_hdr2 mimedb
rm -f fishd fish_pager count
rm -f fish-@PACKAGE_VERSION@.tar
rm -f fish-@PACKAGE_VERSION@.tar.gz
rm -f fish-@PACKAGE_VERSION@.tar.bz2
rm -rf doc;
rm -rf user_doc;
rm -rf doc_src/builtin_doc
rm -rf fish-@PACKAGE_VERSION@
rm -rf xsel-0.9.6/
# DO NOT DELETE THIS LINE -- make depend depends on it.
builtin.o: config.h util.h wutil.h builtin.h function.h complete.h proc.h
builtin.o: parser.h reader.h env.h expand.h common.h wgetopt.h sanity.h
builtin.o: tokenizer.h builtin_help.h wildcard.h input_common.h input.h
builtin.o: intern.h
builtin_commandline.o: config.h util.h builtin.h common.h wgetopt.h reader.h
builtin_commandline.o: proc.h parser.h tokenizer.h input_common.h input.h
builtin_help.o: config.h util.h common.h builtin_help.h
builtin_set.o: config.h util.h builtin.h env.h expand.h common.h wgetopt.h
builtin_set.o: proc.h parser.h
common.o: config.h util.h wutil.h common.h expand.h proc.h wildcard.h
common.o: parser.h
complete.o: config.h util.h tokenizer.h wildcard.h proc.h parser.h function.h
complete.o: complete.h builtin.h env.h exec.h expand.h common.h reader.h
complete.o: history.h intern.h wutil.h
env.o: config.h util.h wutil.h proc.h common.h env.h sanity.h expand.h
env.o: history.h reader.h parser.h env_universal.h env_universal_common.h
env_universal.o: util.h common.h wutil.h env_universal_common.h
env_universal.o: env_universal.h
env_universal_common.o: util.h common.h wutil.h env_universal_common.h
exec.o: config.h util.h common.h wutil.h proc.h exec.h parser.h builtin.h
exec.o: function.h env.h wildcard.h sanity.h expand.h env_universal.h
exec.o: env_universal_common.h
expand.o: config.h util.h common.h wutil.h env.h proc.h parser.h expand.h
expand.o: wildcard.h exec.h tokenizer.h complete.h
fishd.o: util.h common.h wutil.h env_universal_common.h
fish_pager.o: config.h util.h wutil.h common.h complete.h output.h
fish_pager.o: input_common.h env_universal.h env_universal_common.h
fish_tests.o: config.h util.h common.h proc.h reader.h builtin.h function.h
fish_tests.o: complete.h wutil.h env.h expand.h parser.h tokenizer.h
function.o: config.h util.h function.h proc.h parser.h common.h intern.h
highlight.o: config.h util.h wutil.h highlight.h tokenizer.h proc.h parser.h
highlight.o: builtin.h function.h env.h expand.h sanity.h common.h complete.h
highlight.o: output.h
history.o: config.h util.h wutil.h history.h common.h reader.h env.h sanity.h
input.o: config.h util.h wutil.h reader.h proc.h common.h sanity.h
input.o: input_common.h input.h parser.h env.h expand.h
input_common.o: config.h util.h common.h wutil.h input_common.h
input_common.o: env_universal.h env_universal_common.h
intern.o: config.h util.h common.h intern.h
kill.o: config.h util.h wutil.h kill.h proc.h sanity.h common.h env.h
kill.o: expand.h exec.h parser.h
main.o: config.h util.h common.h reader.h builtin.h function.h complete.h
main.o: wutil.h env.h sanity.h proc.h parser.h expand.h intern.h
mimedb.o: config.h xdgmime.h util.h
output.o: config.h util.h wutil.h expand.h common.h output.h highlight.h
parser.o: config.h util.h common.h wutil.h proc.h parser.h tokenizer.h exec.h
parser.o: wildcard.h function.h builtin.h builtin_help.h env.h expand.h
parser.o: reader.h sanity.h env_universal.h env_universal_common.h
proc.o: config.h util.h wutil.h proc.h common.h reader.h sanity.h env.h
reader.o: config.h util.h wutil.h highlight.h reader.h proc.h parser.h
reader.o: complete.h history.h common.h sanity.h env.h exec.h expand.h
reader.o: tokenizer.h kill.h input_common.h input.h function.h output.h
sanity.o: config.h util.h common.h sanity.h proc.h history.h reader.h kill.h
sanity.o: wutil.h
set_color.o: config.h
tokenize.o: config.h
tokenizer.o: config.h util.h wutil.h tokenizer.h common.h wildcard.h
util.o: config.h util.h common.h wutil.h
wgetopt.o: config.h wgetopt.h wutil.h
wildcard.o: config.h util.h wutil.h complete.h common.h wildcard.h reader.h
wildcard.o: expand.h
wutil.o: config.h util.h common.h wutil.h
xdgmimealias.o: xdgmimealias.h xdgmime.h xdgmimeint.h
xdgmime.o: xdgmime.h xdgmimeint.h xdgmimeglob.h xdgmimemagic.h xdgmimealias.h
xdgmime.o: xdgmimeparent.h
xdgmimeglob.o: xdgmimeglob.h xdgmime.h xdgmimeint.h
xdgmimeint.o: xdgmimeint.h xdgmime.h
xdgmimemagic.o: xdgmimemagic.h xdgmime.h xdgmimeint.h
xdgmimeparent.o: xdgmimeparent.h xdgmime.h xdgmimeint.h