aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 35989ea3adb3f56356338aafbd83be6eabfd7aaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# This file is part of Grot.
# Copyright (C) 2009, 2010 Sergey Poznyakoff
#
# Grot 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 3, or (at your option)
# any later version.
#
# Grot 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 grot.  If not, see <http://www.gnu.org/licenses/>.

CFLAGS = -O2 -g
CPPFLAGS = -I/usr/include/mysql -I/usr/local/include/mysql
LDFLAGS = -L/usr/lib/mysql -L/usr/local/lib/mysql
LIBS = -lmysqlclient

prefix = /usr
distdir = $(PROJECT)-$(VERSION)
bindir = $(prefix)/bin
mandir = $(prefix)/man

##

PROJECT = grot
VERSION = 1.0

ALLDEFS = -DPACKAGE="\"$(PROJECT)\"" -DVERSION="\"$(VERSION)\""

.c.o:
	$(CC) $(CFLAGS) $(CPPFLAGS) $(ALLDEFS) $(DEFS) -c -o $@ $<

all: grot

grot_SOURCES = \
 grot.c\
 cmdline.c

grot_HEADERS = grot.h

grot_MANS = grot.1 grot.cfg.5

grot_OBJECTS = $(grot_SOURCES:.c=.o)

EXTRA_DIST = cmdline.opt getopt.m4 grot.cfg

grot.o: grot.h grot.c

cmdline.c: cmdline.opt
	m4 -s getopt.m4 $< | sed '1d' > $@

grot: $(grot_OBJECTS)
	$(CC) -ogrot $(grot_OBJECTS) $(LDFLAGS) $(LIBS)

clean:
	rm -f $(grot_OBJECTS) grot

install: install-bin install-man

install-bin: grot
	test -d $(DESTDIR)/$(bindir) || mkdir -p $(DESTDIR)/$(bindir)
	cp grot $(DESTDIR)/$(bindir)

install-man: $(grot_MANS)
	for file in $(grot_MANS); \
	do \
		num=`expr "$$file" : '.*\.\([0-9]\)'`; \
		dir=$(DESTDIR)/$(mandir)/man$$num; \
		test -d $$dir || mkdir -p $$dir; \
		cp $$file $$dir; \
	done

distfiles = \
 AUTHORS\
 COPYING\
 INSTALL\
 README\
 NEWS\
 Makefile\
 $(grot_SOURCES)\
 $(grot_HEADERS)\
 $(grot_MANS)\
 $(EXTRA_DIST)

distdir:
	rm -rf $(distdir) 
	test -d $(distdir) || mkdir -p $(distdir)
	for file in $(distfiles); \
	do \
		cp $$file $(distdir); \
	done

dist:
	make distdir
	tar -c -f - $(distdir) | gzip -c - > $(distdir).tar.gz
	rm -rf $(distdir)

distcheck:
	make dist
	gzip -c -d $(distdir).tar.gz | tar -x -f -
	mkdir $(distdir)/_inst
	cd $(distdir) && make && \
	make install DESTDIR=_inst && \
	make clean
	rm -rf $(distdir)





Return to:

Send suggestions and report system problems to the System administrator.