Debian Codegraph @

tools/golang/xenlight/Makefile

raw
1 XEN_ROOT=$(CURDIR)/../../..
2 include $(XEN_ROOT)/tools/Rules.mk
3
4 # Standing boldly against convention, we insist on installing the
5 # package source under $(prefix)/share/gocode
6 GOCODE_DIR ?= $(prefix)/share/gocode/
7 GOXL_INSTALL_DIR = $(GOCODE_DIR)/src/$(XEN_GOCODE_URL)/xenlight/
8
9 GO ?= go
10
11 LIBXL_SRC_DIR = $(XEN_ROOT)/tools/libs/light
12
13 .PHONY: all
14 all: build
15
16 GOXL_GEN_FILES = types.gen.go helpers.gen.go
17
18 # This exploits the 'multi-target pattern rule' trick.
19 # gentypes.py should be executed only once to make all the targets.
20 $(subst .gen.,.%.,$(GOXL_GEN_FILES)): gengotypes.py $(LIBXL_SRC_DIR)/libxl_types.idl $(LIBXL_SRC_DIR)/idl.py
21 LIBXL_SRC_DIR=$(LIBXL_SRC_DIR) $(PYTHON) gengotypes.py $(LIBXL_SRC_DIR)/libxl_types.idl $(@D)/types.gen.go $(@D)/helpers.gen.go
22
23 # Go will do its own dependency checking, and not actuall go through
24 # with the build if none of the input files have changed.
25 #
26 # NB that because the users of this library need to be able to
27 # recompile the library from source, it needs to include '-lxenlight'
28 # in the LDFLAGS; and thus we need to add -L$(XEN_libxenlight) here
29 # so that it can find the actual library.
30 .PHONY: build
31 build: xenlight.go $(GOXL_GEN_FILES)
32 CGO_CFLAGS="$(CFLAGS_libxenlight) $(CFLAGS_libxentoollog) $(APPEND_CFLAGS)" CGO_LDFLAGS="$(call xenlibs-ldflags,light toollog) $(APPEND_LDFLAGS)" $(GO) vet
33 CGO_CFLAGS="$(CFLAGS_libxenlight) $(CFLAGS_libxentoollog) $(APPEND_CFLAGS)" CGO_LDFLAGS="$(call xenlibs-ldflags,light toollog) $(APPEND_LDFLAGS)" $(GO) build -x
34
35 .PHONY: install
36 install: build
37 $(INSTALL_DIR) $(DESTDIR)$(GOXL_INSTALL_DIR)
38 $(INSTALL_DATA) xenlight.go $(DESTDIR)$(GOXL_INSTALL_DIR)
39 $(INSTALL_DATA) types.gen.go $(DESTDIR)$(GOXL_INSTALL_DIR)
40 $(INSTALL_DATA) helpers.gen.go $(DESTDIR)$(GOXL_INSTALL_DIR)
41
42 .PHONY: uninstall
43 rm -rf $(DESTDIR)$(GOXL_INSTALL_DIR)
44
45 .PHONY: clean
46 clean:
47
48 .PHONY: distclean
49 distclean: clean
50
51 -include $(DEPS_INCLUDE)