X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=Makefile;h=6d01540486fc0ebc8d201e61e365292896adc232;hb=HEAD;hp=4edffec2dcd06e7975482408f08741e94a7b21f7;hpb=2e78e42c5896b61b77ab3a97e45704f6749161b2;p=ric-plt%2Fxapp-frame.git diff --git a/Makefile b/Makefile index 4edffec..6d01540 100755 --- a/Makefile +++ b/Makefile @@ -13,46 +13,29 @@ # See the License for the specific language governing permissions and # limitations under the License. -ROOT_DIR:=. -BUILD_DIR:=$(ROOT_DIR)/build +.DEFAULT: go-build -COVEROUT := $(BUILD_DIR)/cover.out -COVERHTML := $(BUILD_DIR)/cover.html +default: go-build -GOOS=$(shell go env GOOS) -GOCMD=go -GOBUILD=$(GOCMD) build -a -installsuffix cgo -GOTEST=$(GOCMD) test -v -coverprofile $(COVEROUT) +build: go-build -GOFILES := $(shell find $(ROOT_DIR) -name '*.go' -not -name '*_test.go') go.mod go.sum -GOFILES_NO_VENDOR := $(shell find $(ROOT_DIR) -path ./vendor -prune -o -name "*.go" -not -name '*_test.go' -print) +test: go-test -APP:=$(BUILD_DIR)/xapp-sim -APPTST:=$(APP)_test - -.PHONY: FORCE - -.DEFAULT: build - -default: build - -$(APP): $(GOFILES) - GO111MODULE=on GO_ENABLED=0 GOOS=linux $(GOBUILD) -o $@ ./test/xapp - -$(APPTST): $(GOFILES) - GO111MODULE=on GO_ENABLED=0 GOOS=linux $(GOTEST) -c -o $@ ./pkg/xapp - RMR_SEED_RT=config/uta_rtg.rt $@ -f config/config-file.yaml -test.coverprofile $(COVEROUT) - go tool cover -html=$(COVEROUT) -o $(COVERHTML) - -build: $(APP) +#------------------------------------------------------------------------------ +# +# Build and test targets +# +#-------------------------------------------------------------------- ---------- +ROOT_DIR:=$(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +CACHE_DIR:=$(abspath $(ROOT_DIR)/cache) -test: $(APPTST) -fmt: $(GOFILES_NO_VENDOR) - gofmt -w -s $^ - @(RESULT="$$(gofmt -l $^)"; test -z "$${RESULT}" || (echo -e "gofmt failed:\n$${RESULT}" && false) ) +XAPP_NAME:=xapp +XAPP_ROOT:=test +XAPP_TESTENV:="RMR_SEED_RT=config/uta_rtg.rt CFG_FILE=$(ROOT_DIR)config/config-file.json" +include build/make.go.mk -clean: - @echo " > Cleaning build cache" - @-rm -rf $(APP) $(APPTST) 2> /dev/null - go clean 2> /dev/null +XAPP_NAME:=xapp +XAPP_ROOT:=pkg +XAPP_TESTENV:="RMR_SEED_RT=config/uta_rtg.rt CFG_FILE=$(ROOT_DIR)config/config-file.json" +include build/make.go.mk