metaentry.c: Include <bsd/string.h> only on non-BSD platforms.
[metastore.git] / Makefile
blob5c54f70694b8a2144d14a09c57aa33ceaca33fab
2 # Copyright (C) 2007 David Härdeman <david@hardeman.nu>
4 # This program is free software; you can redistribute it and/or modify it
5 # under the terms of the GNU General Public License as published by the
6 # Free Software Foundation; only version 2 of the License is applicable.
8 # This program is distributed in the hope that it will be useful, but
9 # WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # General Public License for more details.
13 # You should have received a copy of the GNU General Public License along
14 # with this program; if not, write to the Free Software Foundation, Inc.,
15 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 # Generic settings
20 PROJ_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
21 METASTORE_VER := $(shell "$(PROJ_DIR)"/version.sh)
23 CC = gcc
24 CFLAGS += -g -Wall -pedantic -std=c99 -D_FILE_OFFSET_BITS=64 -O2
25 CFLAGS += -DMETASTORE_VER="\"$(METASTORE_VER)\""
26 LDFLAGS +=
27 LIBS += -lbsd
28 INCLUDES =
29 INSTALL = install
30 INSTALL_PROGRAM = ${INSTALL} -c
31 INSTALL_DATA = ${INSTALL} -c -m 644
32 COMPILE = $(CC) $(INCLUDES) $(CFLAGS) $(CPPFLAGS)
33 LINK = $(CC) $(CFLAGS) $(LDFLAGS)
34 OBJECTS = utils.o metastore.o metaentry.o
35 HEADERS = utils.h metastore.h metaentry.h
36 MANPAGES = man1/metastore.1
38 SRCS_DIR := $(PROJ_DIR)src/
39 MANS_DIR := $(PROJ_DIR)
41 DESTDIR ?=
42 PREFIX = /usr/local
43 EXECPREFIX = $(PREFIX)
44 DATAROOTDIR = ${PREFIX}/share
45 BINDIR = ${EXECPREFIX}/bin
46 MANDIR = ${DATAROOTDIR}/man
48 vpath %.c $(SRCS_DIR)
49 vpath %.h $(SRCS_DIR)
50 vpath %.1 $(MANS_DIR)
53 # Targets
56 all: metastore
57 .DEFAULT: all
60 %.o: %.c $(HEADERS)
61 $(COMPILE) -o $@ -c $<
64 metastore: $(OBJECTS)
65 $(LINK) -o $@ $^ $(LIBS)
68 install: all $(MANPAGES)
69 $(INSTALL) -d $(DESTDIR)$(MANDIR)/man1/
70 $(INSTALL_DATA) $(filter %.1,$^) $(DESTDIR)$(MANDIR)/man1/
71 $(INSTALL) -d $(DESTDIR)$(BINDIR)/
72 $(INSTALL_PROGRAM) metastore $(DESTDIR)$(BINDIR)/
75 uninstall:
76 - rm -f $(addprefix $(DESTDIR)$(MANDIR)/,$(MANPAGES))
77 - rm -f $(DESTDIR)$(BINDIR)/metastore
80 clean:
81 - rm -f *.o metastore
84 .PHONY: install uninstall clean all