Fetching contributors…
Cannot retrieve contributors at this time
119 lines (79 sloc) 3.67 KB
# gitless Makefile for quIRC
CC ?= gcc
CFLAGS = -Wall -Wextra -Werror -pedantic -std=gnu99 -D_GNU_SOURCE $(OPTFLAGS)
AWK := gawk
PREFIX := /usr/local
LIBS = -lm -lncurses $(OBJS) $(OPTLIBS)
OBJS := ttyraw.o ttyesc.o irc.o ctcp.o bits.o strbuf.o ctbuf.o colour.o buffer.o names.o numeric_text.o config.o input.o logging.o types.o cmd.o complete.o
INCLUDE := $(OBJS:.o=.h) version.h osconf.h ctbuf_h.d buffer_h.d config_c.d config_h.d input_h.d
-include config.mak
all: quirc doc
install: all doc
install -D -m0755 quirc $(PREFIX)/bin/quirc
install -D -m0644 quirc.1 $(PREFIX)/man/man1/quirc.1
install -D -m0644 readme.htm $(PREFIX)/share/doc/quirc/readme.htm
install -D -m0644 readme.css $(PREFIX)/share/doc/quirc/readme.css
install -D -m0644 config_ref.htm $(PREFIX)/share/doc/quirc/config_ref.htm
install -D -m0644 tutorial.htm $(PREFIX)/share/doc/quirc/tutorial.htm
-rm $(PREFIX)/bin/quirc
-rm $(PREFIX)/man/man1/quirc.1
-rm $(PREFIX)/share/doc/quirc/readme.htm
-rm $(PREFIX)/share/doc/quirc/readme.css
-rm $(PREFIX)/share/doc/quirc/config_ref.htm
-rm $(PREFIX)/share/doc/quirc/tutorial.htm
quirc: quirc.c $(OBJS) $(INCLUDE)
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $< $(LIBS) $(DEFINES)
-rm -f *.o *.d quirc genconfig genkeymap
realclean: clean
-rm -f c_init.c README version.h config_* keymap.c keymod.h quirc.1 numeric.h numeric_text.c
doc: README config_ref.htm quirc.1
README: readme.htm
-sed -e "s/&apos;/'/g" -e "s/&quot;/\"/g" < readme.htm | html2text -nobs -o README
# warning, this explodes if PREFIX contains a !
echo ".\\\"\n.\\\"This man page is automatically generated from by a sedscript; edit, not this file, and 'make doc' to apply the changes.">quirc.1
sed -e "s!\$$PREFIX!$(PREFIX)!g" < >> quirc.1
# a %.o /always/ depends on its %.h as well as its %.c
%.o: %.c %.h
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ $(DEFINES)
# dependency files have no work to do
touch $@
cmd.o: buffer_h.d names.h irc.h logging.h strbuf.h types.h
ttyesc.o: ttyesc.c ttyesc.h bits.h config_h.d
irc.o: irc.c irc.h bits.h buffer_h.d colour.h names.h numeric.h numeric_text.h osconf.h ctcp.h
bits.o: bits.c bits.h ttyesc.h colour.h
ctbuf_h.d: ctbuf.h colour.h
ctcp.c: types.h buffer_h.d config_h.d version.h
colour.o: colour.c colour.h c_init.c ttyesc.h
buffer.o: buffer.c buffer.h ttyesc.h colour.h bits.h names.h text.h irc.h version.h input_h.d logging.h osconf.h ctbuf_h.d
buffer_h.d: buffer.h colour.h config_h.d input_h.d irc.h types.h
config.o: config_c.d config_h.d names.h bits.h colour.h text.h ttyesc.h version.h
config_c.d: config.c config_check.c config_def.c config_need.c config_rcread.c config_pargs.c config_help.c keymap.c
config_h.d: config.h config_globals.h version.h keymod.h
config_%: config.cdl genconfig
./genconfig $@ < config.cdl > $@ || (rm $@ && false)
genconfig: genconfig.c strbuf.h strbuf.o
$(CC) $(CFLAGS) $(CPPFLAGS) $< $(LDFLAGS) strbuf.o -o $@
input_h.d: input.h keymod.h
input.o: input.c input_h.d ttyesc.h names.h buffer_h.d irc.h bits.h config_h.d logging.h complete.h config_set.c
logging.o: types.h bits.h
names.o: names.c names.h buffer_h.d irc.h
complete.o: input_h.d names.h buffer_h.d irc.h strbuf.h cmd.h
./$< > $@
./$< > $@
c_init.c: colour.def c_init.awk
$(AWK) -f c_init.awk colour.def > c_init.c
genkeymap: genkeymap.c strbuf.h strbuf.o
$(CC) $(CFLAGS) $(CPPFLAGS) $< $(LDFLAGS) strbuf.o -o $@
keymod.h: keys genkeymap
./genkeymap h < keys > $@ || (rm $@ && false)
keymap.c: keys genkeymap
./genkeymap c < keys > $@ || (rm $@ && false)