1# Copyright 2020 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# This is a minimal Makefile to show how to use the Cloud Spanner C++ client
16# for developers that use make(1) as their build system.
17
18# The CXX, CXXFLAGS and CXXLD variables are hard-coded. These values work for
19# our tests, but applications would typically make them configurable parameters.
20CXX=g++
21CXXFLAGS=-std=c++11
22CXXLD=$(CXX)
23
24all: quickstart
25
26# Configuration variables to compile and link against the Cloud Spanner C++
27# client library.
28SPANNER_DEPS := spanner_client
29SPANNER_CXXFLAGS   := $(shell pkg-config $(SPANNER_DEPS) --cflags)
30SPANNER_CXXLDFLAGS := $(shell pkg-config $(SPANNER_DEPS) --libs-only-L)
31SPANNER_LIBS       := $(shell pkg-config $(SPANNER_DEPS) --libs-only-l)
32
33# A target using the Cloud Spanner C++ client library.
34quickstart: quickstart.cc
35	$(CXXLD) $(CXXFLAGS) $(SPANNER_CXXFLAGS) $(SPANNER_CXXLDFLAGS) -o $@ $^ $(SPANNER_LIBS)
36