[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH RFC] tools/xenlight: Create xenlight Makefile



On Fri, Dec 16, 2016 at 12:27:31PM +0800, George Dunlap wrote:
> On Fri, Dec 16, 2016 at 7:20 AM, Ronald Rojas <ronladred@xxxxxxxxx> wrote:
> > Create a basic Makefile to build and install libxenlight Golang
> > bindings.  Also add a template.
> 
> What's this template again?

I use 'template' to mean the same thing as 'stub package'. I can change the 
wording to say 'stub package' instead if that's more clear.
> 
> >
> > ---
> >
> > Eventually this patch will contain the actual bindings package; for
> > now it just includes a stub package.
> >
> > To Do:
> > - Have configure detect golang bindings properly
> >
> > CC: xen-devel <xen-devel@xxxxxxxxxxxxx>
> > CC: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> > CC: Wei Liu <wei.liu2@xxxxxxxxxx>
> > CC: George Dunlap <george.dunlap@xxxxxxxxxx>
> > CC: George Dunlap <dunlapg@xxxxxxxxx>
> > ---
> >  tools/Makefile                    | 16 ++++++++++++++++
> >  tools/golang/Makefile             | 33 +++++++++++++++++++++++++++++++++
> >  tools/golang/xenlight/xenlight.go |  7 +++++++
> >  3 files changed, 56 insertions(+)
> >  create mode 100644 tools/golang/Makefile
> >  create mode 100644 tools/golang/xenlight/xenlight.go
> >
> > diff --git a/tools/Makefile b/tools/Makefile
> > index 71515b4..f2198e0 100644
> > --- a/tools/Makefile
> > +++ b/tools/Makefile
> > @@ -11,6 +11,8 @@ SUBDIRS-y += misc
> >  SUBDIRS-y += examples
> >  SUBDIRS-y += hotplug
> >  SUBDIRS-y += xentrace
> > +SUBDIRS-y += golang
> > +#FIXME: Have golang controlled by a configure variable
> >  SUBDIRS-$(CONFIG_XCUTILS) += xcutils
> >  SUBDIRS-$(CONFIG_X86) += firmware
> >  SUBDIRS-y += console
> > @@ -311,6 +313,20 @@ subdir-install-debugger/gdbsx: .phony
> >  subdir-all-debugger/gdbsx: .phony
> >         $(MAKE) -C debugger/gdbsx all
> >
> > +subdir-all-golang/xenlight: .phony
> > +       $(MAKE) -C golang all
> > +
> > +subdir-clean-golang/xenlight: .phony
> > +       $(MAKE) -C golang clean
> > +
> > +subdir-install-golang/xenlight: .phony
> > +       $(MAKE) -C golang install
> > +
> > +subdir-build-golang/xenlight: .phony
> > +       $(MAKE) -C golang build
> > +
> > +subdir-distclean-golang/xenlight: .phony
> > +       $(MAKE) -C golang distclean
> >
> >  subdir-clean-debugger/kdd subdir-distclean-debugger/kdd: .phony
> >         $(MAKE) -C debugger/kdd clean
> > diff --git a/tools/golang/Makefile b/tools/golang/Makefile
> > new file mode 100644
> > index 0000000..eead226
> > --- /dev/null
> > +++ b/tools/golang/Makefile
> > @@ -0,0 +1,33 @@
> > +XEN_ROOT=$(CURDIR)/../..
> > +include $(XEN_ROOT)/tools/Rules.mk
> > +
> > +BINARY = xenlight.a
> > +GO ?= go
> > +
> > +.PHONY: all
> > +all: build
> > +
> > +.PHONY: build
> > +build: xenlight/xenlight.a
> 
> I think eventually we'll want to have a makefile in tools/golang which
> calls the makefiles in tools/golang/xenlight and other directories;
> but since we have only one at the moment, I think this is probably
> fine.
I'll make a list so that if I have time late down the line, I'll remember 
to do this. 
> 
> > +.PHONY: install
> > +install: build
> > +       if [ ! -f $(BINARY) ]; then \
> > +               mkdir $(GOPATH)/src/xenlight; \
> > +               $(INSTALL_PROG) xenlight/xenlight.go 
> > $(GOPATH)/src/xenlight/xenlight.go; \
> > +               echo "this"; \
> > +       fi
> 
> A couple of things.
> 
> First, as we discussed on IRC, the if[] clause is not necessary --
> make will automatically stop if one of the prerequisites isn't
> available.
ok. I will delete the 'if' clause.
> 
> Secondly -- this is a bit confusing, but the "install" section of the
> parts of the tree that actually build things don't install files
> directly onto the host filesystem.  Instead, they install into
> $(DESTDIR) (which is xen.git/dist/install), and then the final step of
> "make install" will copy everything from dist/install into the host
> filesystem.
> 
> Also, you shouldn't do a plain mkdir, but should use $(INSTALL_DIR).
> And since the file you're installing is not going to be executed, you
> should use $(INSTALL_DATA).  (I didn't realize that distinction
> existed until I looked at tools/libxl/Makefile).
> 
> So this should look more like:
> 
> install: build
>   $(INSTALL_DIR) $(DESTDIR)$(GOLANG_SRC)
>   $(INSTALL_DATA) xenlight/xenlight.go $(DESTDIR)$(GOLANG_SRC)
Ok, I will change the the install rule with the appropriate changes
> 
> And we want the package name to be "xenproject.org/xenlight", so that
> we can put up a repo at git://xenproject.org/xenlight and have people
> download it automatically.  So GOLANG_SRC should be set by default to
> $(GOPATH)/src/xenproject.org/xenlight
Fixed
> 
> With that done I think we might be ready to add some golang code. :-)
> 
>  -George

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.