This repository has been archived by the owner on Jan 25, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile
83 lines (70 loc) · 2.43 KB
/
Makefile
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
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
.PHONY: all proto build debug test cover package gcua-se-el6 gcua-se-el7 clean
VERSION:=1.$(shell date -u +%Y%m%d.%H%M%S)
PACKAGE_NAME:="gcua"
DESCRIPTION:="Google Compute User Accounts."
LICENSE:="Apache 2.0"
MAINTAINER:="[email protected]"
VENDOR:="Google Inc."
URL:="https://github.com/GoogleCloudPlatform/compute-user-accounts"
LIBC_VERSION=2.12
LIBSTDCXX_VERSION=4.4.7
SOCKET_PATH:=/var/run/gcua.socket
BTARGET:=build
GOFLAGS=-ldflags "-X main.version=${VERSION} -X github.com/GoogleCloudPlatform/compute-user-accounts/server.socketPath=${SOCKET_PATH}"
TTARGET:=test
TFLAGS:=
SOURCES:= \
${GOPATH}/bin/gcua=/usr/share/google/ \
${GOPATH}/bin/authorizedkeys=/usr/share/google/ \
nssplugin/bin/libnss_google.so.2.0.1=/usr/lib/ \
etc/init.d/gcua \
etc/sudoers.d/gcua \
etc/systemd/system/gcua.service \
FPM_ARGS:= \
-s dir -n ${PACKAGE_NAME} -v ${VERSION} -a native --license ${LICENSE} \
-m ${MAINTAINER} --description ${DESCRIPTION} --url ${URL} --vendor ${VENDOR} \
--config-files etc/ \
--after-install etc/after-install.sh \
--before-remove etc/before-remove.sh \
--after-remove etc/after-remove.sh ${SOURCES}
all: build
build:
@$(MAKE) ${BTARGET} $(MFLAGS) -C nssplugin
@go get ${GOFLAGS} ./...
debug: BTARGET:=debug
debug: build
test:
@$(MAKE) ${TTARGET} $(MFLAGS) -C nssplugin
@go test ${TFLAGS} ./...
cover: TFLAGS:=-cover
cover: TTARGET:=cover
cover: test
package: build
@mkdir -p pkg
@fpm -t deb -p pkg/ \
-d "libc6 >= ${LIBC_VERSION}" -d "libstdc++6 >= ${LIBSTDCXX_VERSION}" \
-d "openssh-server" ${FPM_ARGS}
@fpm -t rpm -p pkg/ \
-d "glibc >= ${LIBC_VERSION}" -d "libstdc++ >= ${LIBSTDCXX_VERSION}" \
-d "openssh-server" ${FPM_ARGS}
gcua-se-el6:
@rpmbuild -ba selinux/el6/gcua-se-el6.spec
gcua-se-el7:
@rpmbuild -ba selinux/el7/gcua-se-el7.spec
clean:
@rm -rf pkg
@go clean -i ./...
@$(MAKE) $@ $(MFLAGS) -C nssplugin