1 # Copyright (c) 2019 AT&T Intellectual Property.
2 # Copyright (c) 2019 Nokia.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
17 BUILD_DIR:=$(ROOT_DIR)/build
19 COVEROUT := $(BUILD_DIR)/cover.out
20 COVERHTML := $(BUILD_DIR)/cover.html
22 GOOS=$(shell go env GOOS)
24 GOBUILD=$(GOCMD) build -a -installsuffix cgo
25 GOTEST=$(GOCMD) test -v -coverprofile $(COVEROUT)
27 GOFILES := $(shell find $(ROOT_DIR) -name '*.go' -not -name '*_test.go') go.mod go.sum
28 GOFILES_NO_VENDOR := $(shell find $(ROOT_DIR) -path ./vendor -prune -o -name "*.go" -not -name '*_test.go' -print)
30 APP:=$(BUILD_DIR)/xapp-sim
40 GO111MODULE=on GO_ENABLED=0 GOOS=linux $(GOBUILD) -o $@ ./test/xapp
43 GO111MODULE=on GO_ENABLED=0 GOOS=linux $(GOTEST) -c -o $@ ./pkg/xapp
44 RMR_SEED_RT=config/uta_rtg.rt $@ -f config/config-file.yaml -test.coverprofile $(COVEROUT)
45 go tool cover -html=$(COVEROUT) -o $(COVERHTML)
51 fmt: $(GOFILES_NO_VENDOR)
53 @(RESULT="$$(gofmt -l $^)"; test -z "$${RESULT}" || (echo -e "gofmt failed:\n$${RESULT}" && false) )
56 @echo " > Cleaning build cache"
57 @-rm -rf $(APP) $(APPTST) 2> /dev/null