github.com/ezbercih/terraform@v0.1.1-0.20140729011846-3c33865e0839/Makefile (about)

     1  CGO_CFLAGS:=-I$(CURDIR)/vendor/libucl/include
     2  CGO_LDFLAGS:=-L$(CURDIR)/vendor/libucl
     3  LIBUCL_NAME=libucl.a
     4  TEST?=./...
     5  
     6  # Windows-only
     7  ifeq ($(OS), Windows_NT)
     8  	# The Libucl library is named libucl.dll
     9  	LIBUCL_NAME=libucl.dll
    10  
    11  	# Add the current directory on the path so the DLL is available.
    12  	export PATH := $(CURDIR):$(PATH)
    13  endif
    14  
    15  export CGO_CFLAGS CGO_LDFLAGS PATH
    16  
    17  default: test
    18  
    19  bin: config/y.go libucl
    20  	@sh -c "$(CURDIR)/scripts/build.sh"
    21  
    22  dev: config/y.go libucl
    23  	@TF_DEV=1 sh -c "$(CURDIR)/scripts/build.sh"
    24  
    25  libucl: vendor/libucl/$(LIBUCL_NAME)
    26  
    27  test: config/y.go libucl
    28  	TF_ACC= go test $(TEST) $(TESTARGS) -timeout=10s
    29  
    30  testacc: config/y.go libucl
    31  	@if [ "$(TEST)" = "./..." ]; then \
    32  		echo "ERROR: Set TEST to a specific package"; \
    33  		exit 1; \
    34  	fi
    35  	TF_ACC=1 go test $(TEST) -v $(TESTARGS)
    36  
    37  testrace: config/y.go libucl
    38  	TF_ACC= go test -race $(TEST) $(TESTARGS)
    39  
    40  updatedeps: config/y.go
    41  	go get -u -v ./...
    42  
    43  config/y.go: config/expr.y
    44  	cd config/ && \
    45  		go tool yacc -p "expr" expr.y
    46  
    47  vendor/libucl/libucl.a: vendor/libucl
    48  	cd vendor/libucl && \
    49  		cmake cmake/ && \
    50  		make
    51  
    52  vendor/libucl/libucl.dll: vendor/libucl
    53  	cd vendor/libucl && \
    54  		$(MAKE) -f Makefile.w32 && \
    55  		cp .obj/libucl.dll . && \
    56  		cp libucl.dll $(CURDIR)
    57  
    58  vendor/libucl:
    59  	rm -rf vendor/libucl
    60  	mkdir -p vendor/libucl
    61  	git clone https://github.com/hashicorp/libucl.git vendor/libucl
    62  	cd vendor/libucl && \
    63  		git checkout fix-win32-compile
    64  
    65  clean:
    66  	rm -rf vendor
    67  
    68  .PHONY: clean default libucl test updatedeps