| [1aee7d9] | 1 | # $Id$ |
|---|
| 2 | |
|---|
| [ac70242] | 3 | srcdir = @srcdir@ |
|---|
| 4 | VPATH = @srcdir@ |
|---|
| 5 | prefix = @prefix@ |
|---|
| 6 | exec_prefix = @exec_prefix@ |
|---|
| [3354cea5] | 7 | datadir = @datadir@/barnowl |
|---|
| [ac70242] | 8 | bindir = @bindir@ |
|---|
| 9 | mandir = @mandir@ |
|---|
| 10 | |
|---|
| [7d4fbcd] | 11 | CC=@CC@ |
|---|
| [d09e5a1] | 12 | LIBS=@LIBS@ -L./libfaim -lfaim |
|---|
| [5ff830a] | 13 | CFLAGS=@CFLAGS@ -I. -I./libfaim -DDATADIR=\"${datadir}\" -DOWL_SVN_REVNO=$(shell ./svkversion) |
|---|
| [7d4fbcd] | 14 | LDFLAGS=@LDFLAGS@ |
|---|
| [15bd5ef] | 15 | XSUBPPDIR=@XSUBPPDIR@ |
|---|
| [4ad3480] | 16 | XSUBPPFLAGS=@XSUBPPFLAGS@ |
|---|
| [aaf6071] | 17 | INSTALL=@INSTALL@ |
|---|
| 18 | INSTALL_PROGRAM=@INSTALL_PROGRAM@ |
|---|
| 19 | INSTALL_DATA=@INSTALL_DATA@ |
|---|
| [7ccc780] | 20 | ATHSTATIC=@ATHSTATIC@ |
|---|
| [aaf6071] | 21 | |
|---|
| 22 | BASE_SRCS=list.c message.c mainwin.c popwin.c zephyr.c messagelist.c \ |
|---|
| 23 | commands.c global.c text.c fmtext.c editwin.c util.c logging.c \ |
|---|
| [f1e629d] | 24 | perlconfig.c keys.c functions.c zwrite.c viewwin.c help.c filter.c \ |
|---|
| [aaf6071] | 25 | regex.c history.c view.c dict.c variable.c filterelement.c pair.c \ |
|---|
| [aa5f725] | 26 | keypress.c keymap.c keybinding.c cmd.c context.c zcrypt.c \ |
|---|
| [864ed35] | 27 | aim.c buddy.c buddylist.c timer.c style.c errqueue.c \ |
|---|
| [9c7a701] | 28 | zbuddylist.c muxevents.c popexec.c obarray.c select.c |
|---|
| [aaf6071] | 29 | OWL_SRC = owl.c |
|---|
| 30 | TESTER_SRC = tester.c |
|---|
| 31 | |
|---|
| [3354cea5] | 32 | EXE = barnowl |
|---|
| [b547aa4] | 33 | PERL_MODULES = Jabber |
|---|
| 34 | MODULE_DIRS = $(PERL_MODULES:%=perl/modules/%) |
|---|
| [3354cea5] | 35 | |
|---|
| [aaf6071] | 36 | BASE_OBJS = $(BASE_SRCS:.c=.o) |
|---|
| [7d4fbcd] | 37 | |
|---|
| [f1e629d] | 38 | GEN_C = varstubs.c perlglue.c perlwrap.c |
|---|
| [aaf6071] | 39 | GEN_H = owl_prototypes.h |
|---|
| 40 | GEN_O = $(GEN_C:.c=.o) |
|---|
| 41 | |
|---|
| 42 | OBJS = $(BASE_OBJS) $(GEN_O) |
|---|
| 43 | |
|---|
| [0ff8fb57] | 44 | AUTOGEN=$(GEN_C) $(GEN_H) |
|---|
| 45 | #AUTOGEN=$(GEN_C) |
|---|
| [7d4fbcd] | 46 | |
|---|
| [1cf3f8d3] | 47 | HEADERS=$(GEN_H) owl.h config.h test.h |
|---|
| [07f715f] | 48 | |
|---|
| [7f1f1e7] | 49 | $(EXE): $(AUTOGEN) $(OBJS) owl.o libfaim |
|---|
| [7ccc780] | 50 | $(ATHSTATIC) $(CC) -o $(EXE) owl.o $(OBJS) $(LDFLAGS) $(LIBS) |
|---|
| [7d4fbcd] | 51 | |
|---|
| [094009a] | 52 | tester: $(AUTOGEN) $(OBJS) tester.o |
|---|
| [7ccc780] | 53 | $(ATHSTATIC) $(CC) -o tester tester.o $(OBJS) $(LDFLAGS) $(LIBS) |
|---|
| [7d4fbcd] | 54 | |
|---|
| [50558dc] | 55 | %.o: %.c $(HEADERS) |
|---|
| 56 | $(CC) -c $(CFLAGS) $< -o $@ |
|---|
| 57 | |
|---|
| 58 | # zcrypt is old crufty DES code I don't want to touch |
|---|
| 59 | # Disable all warnings when compiling it |
|---|
| 60 | zcrypt.o: zcrypt.c $(HEADERS) |
|---|
| 61 | $(CC) -c $(CFLAGS) $< -w -o $@ |
|---|
| 62 | |
|---|
| [7d4fbcd] | 63 | test: tester |
|---|
| 64 | ./tester reg |
|---|
| 65 | |
|---|
| [b547aa4] | 66 | clean: libfaimclean modules_clean |
|---|
| [3354cea5] | 67 | $(RM) $(EXE) tester *.o $(AUTOGEN) owl_prototypes.h.new |
|---|
| [7d4fbcd] | 68 | |
|---|
| [d09e5a1] | 69 | distclean: clean libfaimdistclean |
|---|
| [42c33a6] | 70 | $(RM) config.cache config.log config.status Makefile config.h TAGS *~ core |
|---|
| [7d4fbcd] | 71 | |
|---|
| [b547aa4] | 72 | .PHONY: $(MODULE_DIRS) |
|---|
| 73 | |
|---|
| 74 | modules: $(MODULE_DIRS) |
|---|
| 75 | modules_clean: |
|---|
| 76 | for i in $(MODULE_DIRS); do \ |
|---|
| 77 | cd $$i; test ! -f Makefile || make clean; \ |
|---|
| 78 | done |
|---|
| 79 | |
|---|
| 80 | $(MODULE_DIRS): %: %/Makefile |
|---|
| 81 | ( cd $@ && make $(notdir $@).par ) |
|---|
| 82 | |
|---|
| 83 | $(MODULE_DIRS:=/Makefile): %/Makefile: %/Makefile.PL |
|---|
| 84 | ( cd $(dir $@) && perl -I../../lib Makefile.PL ) |
|---|
| 85 | |
|---|
| [0ff8fb57] | 86 | proto: owl_prototypes.h |
|---|
| [7d4fbcd] | 87 | |
|---|
| [11be665] | 88 | perlglue.c: perlglue.xs Makefile |
|---|
| [15bd5ef] | 89 | perl $(XSUBPPDIR)/xsubpp $(XSUBPPFLAGS) -prototypes perlglue.xs > perlglue.c |
|---|
| [7d4fbcd] | 90 | |
|---|
| 91 | varstubs.c: variable.c stubgen.pl |
|---|
| 92 | perl stubgen.pl > varstubs.c |
|---|
| 93 | |
|---|
| [f1e629d] | 94 | perlwrap.c: perlwrap.pm encapsulate.pl |
|---|
| 95 | perl encapsulate.pl perlwrap.pm owl_perlwrap_codebuff > perlwrap.c |
|---|
| 96 | |
|---|
| [aaf6071] | 97 | # Only move owl_prototypes.h into place if the new one is different |
|---|
| [0ff8fb57] | 98 | owl_prototypes.h: codelist.pl varstubs.c $(BASE_SRCS) |
|---|
| 99 | perl codelist.pl > owl_prototypes.h.new |
|---|
| 100 | @cmp -s owl_prototypes.h.new $@ || { \ |
|---|
| [8c92848] | 101 | test -f $@ && echo 'Interfaces changed!'; \ |
|---|
| [0ff8fb57] | 102 | echo mv -f owl_prototypes.h.new $@; \ |
|---|
| 103 | mv -f owl_prototypes.h.new $@; } |
|---|
| 104 | #owl_prototypes.h: |
|---|
| [aaf6071] | 105 | |
|---|
| [d5ebf3a] | 106 | .PHONY: tags clean distclean proto test check-syntax |
|---|
| [aaf6071] | 107 | |
|---|
| 108 | tags: TAGS |
|---|
| 109 | |
|---|
| 110 | TAGS: $(BASE_SRCS) $(OWL_SRC) $(TESTER_SRC) $(GEN_C) owl.h $(GEN_H) |
|---|
| 111 | etags $(BASE_SRCS) $(OWL_SRC) $(TESTER_SRC) $(GEN_C) owl.h $(GEN_H) |
|---|
| 112 | |
|---|
| [50558dc] | 113 | $(BASE_OBJS) varstubs.h: owl.h config.h owl_prototypes.h |
|---|
| [d09e5a1] | 114 | |
|---|
| 115 | libfaim: libfaim/libfaim.a |
|---|
| 116 | |
|---|
| 117 | libfaim/libfaim.a: |
|---|
| 118 | (cd libfaim; $(MAKE)) |
|---|
| 119 | |
|---|
| 120 | libfaimclean: |
|---|
| 121 | (cd libfaim; $(MAKE) clean) |
|---|
| 122 | |
|---|
| 123 | libfaimdistclean: |
|---|
| 124 | (cd libfaim; $(MAKE) distclean) |
|---|
| [aaf6071] | 125 | |
|---|
| [b547aa4] | 126 | all: $(EXE) $(MODULE_DIRS) |
|---|
| [ac70242] | 127 | |
|---|
| 128 | install: all installdirs |
|---|
| [88cbd0a] | 129 | ${INSTALL_PROGRAM} $(EXE) ${DESTDIR}${bindir}/$(EXE) |
|---|
| 130 | ${INSTALL_DATA} doc/owl.1 ${DESTDIR}${mandir}/man1/barnowl.1 |
|---|
| [b547aa4] | 131 | ${INSTALL} -d ${DESTDIR}${datadir}/lib |
|---|
| [e98a9f9] | 132 | ${INSTALL} -d ${DESTDIR}${datadir}/modules |
|---|
| [2bdfed9] | 133 | tar -C perl/lib --exclude .svn -cf - . | tar -C ${DESTDIR}${datadir}/lib -xf - |
|---|
| [b547aa4] | 134 | for i in $(PERL_MODULES); do \ |
|---|
| [e98a9f9] | 135 | ${INSTALL_DATA} perl/modules/$$i/$$i.par ${DESTDIR}${datadir}/modules/$$i.par; \ |
|---|
| [b547aa4] | 136 | done |
|---|
| [ac70242] | 137 | |
|---|
| 138 | installdirs: mkinstalldirs |
|---|
| [88cbd0a] | 139 | ${srcdir}/mkinstalldirs ${DESTDIR}${bindir} ${DESTDIR}${mandir}/man1 ${DESTDIR}${datadir} |
|---|
| [d5ebf3a] | 140 | |
|---|
| 141 | # For emacs flymake-mode |
|---|
| 142 | check-syntax: proto |
|---|
| 143 | $(CC) $(CFLAGS) -Wall -Wextra -pedantic -fsyntax-only $(CHK_SOURCES) |
|---|