...

Text file src/github.com/jezek/xgb/Makefile

Documentation: github.com/jezek/xgb

     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.
    13ifndef XPROTO
    14XPROTO=/usr/share/xcb
    15endif
    16
    17# All of the XML files in my /usr/share/xcb directory EXCEPT XKB. -_-
    18# This is intended to build xgbgen and generate Go code for each supported
    19# extension.
    20all: build-xgbgen \
    21		 bigreq.xml composite.xml damage.xml dpms.xml dri2.xml \
    22		 ge.xml glx.xml randr.xml record.xml render.xml res.xml \
    23		 screensaver.xml shape.xml shm.xml xc_misc.xml \
    24		 xevie.xml xf86dri.xml xf86vidmode.xml xfixes.xml xinerama.xml \
    25		 xprint.xml xproto.xml xselinux.xml xtest.xml \
    26		 xvmc.xml xv.xml
    27
    28build-xgbgen:
    29	(cd xgbgen && go build)
    30
    31# Builds each individual sub-package to make sure its valid Go code.
    32build-all: bigreq.b composite.b damage.b dpms.b dri2.b ge.b glx.b randr.b \
    33					 record.b render.b res.b screensaver.b shape.b shm.b xcmisc.b \
    34					 xevie.b xf86dri.b xf86vidmode.b xfixes.b xinerama.b \
    35					 xprint.b xproto.b xselinux.b xtest.b xv.b xvmc.b
    36
    37%.b:
    38	(cd $* ; go build)
    39
    40# Installs each individual sub-package.
    41install: bigreq.i composite.i damage.i dpms.i dri2.i ge.i glx.i randr.i \
    42					 record.i render.i res.i screensaver.i shape.i shm.i xcmisc.i \
    43					 xevie.i xf86dri.i xf86vidmode.i xfixes.i xinerama.i \
    44					 xprint.i xproto.i xselinux.i xtest.i xv.i xvmc.i
    45	go install
    46
    47%.i:
    48	(cd $* ; go install)
    49
    50# xc_misc is special because it has an underscore.
    51# There's probably a way to do this better, but Makefiles aren't my strong suit.
    52xc_misc.xml: build-xgbgen
    53	mkdir -p xcmisc
    54	xgbgen/xgbgen --proto-path $(XPROTO) $(XPROTO)/xc_misc.xml > xcmisc/xcmisc.go
    55
    56%.xml: build-xgbgen
    57	mkdir -p $*
    58	xgbgen/xgbgen --proto-path $(XPROTO) $(XPROTO)/$*.xml > $*/$*.go
    59
    60# Just test the xproto core protocol for now.
    61test:
    62	(cd xproto ; go test)
    63
    64# Force all xproto benchmarks to run and no tests.
    65bench:
    66	(cd xproto ; go test -run 'nomatch' -bench '.*' -cpu 1,2,3,6)
    67
    68# gofmt all non-auto-generated code.
    69# (auto-generated code is already gofmt'd.)
    70# Also do a column check (80 cols) after a gofmt.
    71# But don't check columns on auto-generated code, since I don't care if they
    72# break 80 cols.
    73gofmt:
    74	gofmt -w *.go xgbgen/*.go examples/*.go examples/*/*.go xproto/xproto_test.go
    75	colcheck *.go xgbgen/*.go examples/*.go examples/*/*.go xproto/xproto_test.go
    76
    77push:
    78	git push origin master
    79	git push github master
    80

View as plain text