github.com/nvi-inc/fsgo@v0.2.1/versions/Makefile (about) 1 FSPATH=/usr2/fs 2 export FSPATH 3 4 # Needed to override included Makefile 5 default: version all/all.go 6 7 define ALLGOHEADER 8 // Copyright 2019 NVI Inc. All rights reserved. 9 // Use of this source code is governed by a MIT 10 // license that can be found in the LICENSE file. 11 12 package all 13 endef 14 export ALLGOHEADER 15 16 all/all.go: $(shell ls) . 17 echo "$$ALLGOHEADER" > $@ 18 for d in fs[0-9]*; do \ 19 echo "import _ \"github.com/nvi-inc/fsgo/versions/$$d\"" >> all/all.go; \ 20 done 21 gofmt -w $@ 22 23 # Get version number 24 FS_VERSION := $(shell git --git-dir=$(FSPATH)/.git describe --always --tags 2>/dev/null) 25 26 files = consts.go main.go methods.go types_386.go types_amd64.go types.go utils.go version.go rdbe.go 27 28 version: $(addprefix fs$(FS_VERSION)/, $(files)) 29 30 fs$(FS_VERSION)/%.go: base/%.go 31 mkdir -p fs$(FS_VERSION) 32 cp -a base/$(notdir $@) $@ 33 34 fs$(FS_VERSION)/version.go: $(FSPATH)/Makefile 35 mkdir -p fs$(FS_VERSION) 36 /bin/echo -n -e "package fs\nconst FieldSystemVersion = \"$(FS_VERSION)\"" > $@ 37 38 fs$(FS_VERSION)/types.go: ./utils/types.sh $(FSPATH)/include/fscom.h 39 mkdir -p fs$(FS_VERSION) 40 ./utils/types.sh > $@ 41 42 fs$(FS_VERSION)/types_%.go: fs$(FS_VERSION)/types.go utils/cgo/cgo Makefile 43 mkdir -p fs$(FS_VERSION) 44 export GOARCH=$(basename $*);\ 45 ./utils/cgo/cgo -godefs $< |\ 46 sed -e 's/PadCgo/padCgo/' -e 's/uint8/byte/' -e 's/int8/byte/' |\ 47 gofmt > $@ 48 rm -r _obj 49 50 utils/cgo/cgo: 51 cd utils/cgo; go build