xref: /freebsd/contrib/pkgconf/Makefile.lite (revision a3cefe7f2b4df0f70ff92d4570ce18e517af43ec)
1# Copyright (c) 2019 William Pitcock <nenolod@dereferenced.org>
2#
3# Permission to use, copy, modify, and/or distribute this software for any
4# purpose with or without fee is hereby granted, provided that the above
5# copyright notice and this permission notice appear in all copies.
6#
7# This software is provided 'as is' and without any warranty, express or
8# implied.  In no event shall the authors be liable for any damages arising
9# from the use of this software.
10
11# pkgconf-lite is a staticly-linked version of pkgconf that does not include
12# all features, notably it does not include cross-compile support and MSVC
13# support.  It does not include the libpkgconf library.
14
15SRCS = \
16	libpkgconf/argvsplit.c		\
17	libpkgconf/audit.c		\
18	libpkgconf/bsdstubs.c		\
19	libpkgconf/cache.c		\
20	libpkgconf/client.c		\
21	libpkgconf/dependency.c		\
22	libpkgconf/fileio.c		\
23	libpkgconf/fragment.c		\
24	libpkgconf/parser.c		\
25	libpkgconf/path.c		\
26	libpkgconf/personality.c	\
27	libpkgconf/pkg.c		\
28	libpkgconf/queue.c		\
29	libpkgconf/tuple.c		\
30	cli/getopt_long.c		\
31	cli/main.c
32OBJS = ${SRCS:.c=.o}
33CFLAGS = ${STATIC} -DPKGCONF_LITE -I. -Ilibpkgconf -Icli -DSYSTEM_LIBDIR=\"${SYSTEM_LIBDIR}\" -DSYSTEM_INCLUDEDIR=\"${SYSTEM_INCLUDEDIR}\" -DPKG_DEFAULT_PATH=\"${PKG_DEFAULT_PATH}\"
34STATIC =
35STRIP = strip
36
37all: pkgconf-lite
38
39libpkgconf/config.h:
40	@echo '#define PACKAGE_NAME "pkgconf-lite"' >> $@
41	@echo '#define PACKAGE_BUGREPORT "https://git.dereferenced.org/pkgconf/pkgconf/issues"' >> $@
42	@echo '#define PACKAGE_VERSION "2.5.1"' >> $@
43	@echo '#define PACKAGE PACKAGE_NAME " " PACKAGE_VERSION' >> $@
44	@echo '#define HAVE_STRLCPY' >> $@
45	@echo '#define HAVE_STRLCAT' >> $@
46	@echo '#define HAVE_STRNDUP' >> $@
47
48pkgconf-lite: preflight libpkgconf/config.h ${OBJS}
49	${CC} ${STATIC} -o $@ ${OBJS}
50	${STRIP} $@
51
52clean:
53	rm -f libpkgconf/config.h
54	rm -f ${OBJS}
55	rm -f pkgconf-lite
56
57preflight: preflight-system-libdir preflight-system-includedir preflight-pkg-default-path
58
59preflight-system-libdir:
60	@if test -z "${SYSTEM_LIBDIR}"; then		\
61		echo "SYSTEM_LIBDIR not set.";		\
62		exit 1;					\
63	fi
64
65preflight-system-includedir:
66	@if test -z "${SYSTEM_INCLUDEDIR}"; then	\
67		echo "SYSTEM_INCLUDEDIR not set.";	\
68		exit 1;					\
69	fi
70
71preflight-pkg-default-path:
72	@if test -z "${PKG_DEFAULT_PATH}"; then		\
73		echo "PKG_DEFAULT_PATH not set.";	\
74		exit 1;					\
75	fi
76
77.PHONY: preflight preflight-system-libdir preflight-system-includedir preflight-pkg-default-path clean
78