github.com/robotn/xgb@v0.0.0-20190912153532-2cb92d044934/Makefile (about) 1 # This Makefile is used by the developer. It is not needed in any way to build 2 # a checkout of the XGB repository. 3 # It will be useful, however, if you are hacking at the code generator. 4 # i.e., after making a change to the code generator, run 'make' in the 5 # xgb directory. This will build xgbgen and regenerate each sub-package. 6 # 'make test' will then run any appropriate tests (just tests xproto right now). 7 # 'make bench' will test a couple of benchmarks. 8 # 'make build-all' will then try to build each extension. This isn't strictly 9 # necessary, but it's a good idea to make sure each sub-package is a valid 10 # Go package. 11 12 # My path to the X protocol XML descriptions. 13 XPROTO=/usr/share/xcb 14 15 # All of the XML files in my /usr/share/xcb directory EXCEPT XKB. -_- 16 # This is intended to build xgbgen and generate Go code for each supported 17 # extension. 18 all: build-xgbgen \ 19 bigreq.xml composite.xml damage.xml dpms.xml dri2.xml \ 20 ge.xml glx.xml randr.xml record.xml render.xml res.xml \ 21 screensaver.xml shape.xml shm.xml xc_misc.xml \ 22 xevie.xml xf86dri.xml xf86vidmode.xml xfixes.xml xinerama.xml \ 23 xprint.xml xproto.xml xselinux.xml xtest.xml \ 24 xvmc.xml xv.xml 25 26 build-xgbgen: 27 (cd xgbgen && go build) 28 29 # Builds each individual sub-package to make sure its valid Go code. 30 build-all: bigreq.b composite.b damage.b dpms.b dri2.b ge.b glx.b randr.b \ 31 record.b render.b res.b screensaver.b shape.b shm.b xcmisc.b \ 32 xevie.b xf86dri.b xf86vidmode.b xfixes.b xinerama.b \ 33 xprint.b xproto.b xselinux.b xtest.b xv.b xvmc.b 34 35 %.b: 36 (cd $* ; go build) 37 38 # Installs each individual sub-package. 39 install: bigreq.i composite.i damage.i dpms.i dri2.i ge.i glx.i randr.i \ 40 record.i render.i res.i screensaver.i shape.i shm.i xcmisc.i \ 41 xevie.i xf86dri.i xf86vidmode.i xfixes.i xinerama.i \ 42 xprint.i xproto.i xselinux.i xtest.i xv.i xvmc.i 43 go install 44 45 %.i: 46 (cd $* ; go install) 47 48 # xc_misc is special because it has an underscore. 49 # There's probably a way to do this better, but Makefiles aren't my strong suit. 50 xc_misc.xml: build-xgbgen 51 mkdir -p xcmisc 52 xgbgen/xgbgen --proto-path $(XPROTO) $(XPROTO)/xc_misc.xml > xcmisc/xcmisc.go 53 54 %.xml: build-xgbgen 55 mkdir -p $* 56 xgbgen/xgbgen --proto-path $(XPROTO) $(XPROTO)/$*.xml > $*/$*.go 57 58 # Just test the xproto core protocol for now. 59 test: 60 (cd xproto ; go test) 61 62 # Force all xproto benchmarks to run and no tests. 63 bench: 64 (cd xproto ; go test -run 'nomatch' -bench '.*' -cpu 1,2,3,6) 65 66 # gofmt all non-auto-generated code. 67 # (auto-generated code is already gofmt'd.) 68 # Also do a column check (80 cols) after a gofmt. 69 # But don't check columns on auto-generated code, since I don't care if they 70 # break 80 cols. 71 gofmt: 72 gofmt -w *.go xgbgen/*.go examples/*.go examples/*/*.go xproto/xproto_test.go 73 colcheck *.go xgbgen/*.go examples/*.go examples/*/*.go xproto/xproto_test.go 74 75 push: 76 git push origin master 77 git push github master 78