Makefile 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. # Copyright 2023 The libz-go Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style
  3. # license that can be found in the LICENSE file.
  4. .PHONY: all clean dev download edit editor generate work test windows windows-dev
  5. DIR = /tmp/libz
  6. TAR = zlib-1.3.1.tar.gz
  7. URL = https://zlib.net/$(TAR)
  8. all: editor
  9. golint 2>&1
  10. staticcheck 2>&1
  11. build_all_targets:
  12. ./build_all_targets.sh
  13. echo done
  14. clean:
  15. rm -f log-* cpu.test mem.test *.out go.work*
  16. go clean
  17. clean-dev:
  18. rm -rf include/linux/amd64/ include/windows/*
  19. rm -f internal/autogen/windows*.mod
  20. rm -f ccgo_linux_amd64.go internal/example/ccgo_linux_amd64.go internal/minigzip/ccgo_linux_amd64.go
  21. rm -f ccgo_windows.go internal/example/ccgo_windows.go internal/minigzip/ccgo_windows.go
  22. edit:
  23. @if [ -f "Session.vim" ]; then novim -S & else novim -p Makefile go.mod builder.json all_test.go generator.go & fi
  24. editor:
  25. gofmt -l -s -w .
  26. go test -c -o /dev/null
  27. go install -v ./...
  28. go build -o /dev/null generator*.go
  29. download:
  30. @if [ ! -f $(TAR) ]; then wget $(URL) ; fi
  31. generate: download
  32. mkdir -p $(DIR) || true
  33. rm -rf $(DIR)/*
  34. GO_GENERATE_DIR=$(DIR) go run generator*.go
  35. go build -v ./...
  36. go test -v -count=1 ./...
  37. git status
  38. dev: download
  39. mkdir -p $(DIR) || true
  40. rm -rf $(DIR)/*
  41. echo -n > /tmp/ccgo.log
  42. GO_GENERATE_DIR=$(DIR) GO_GENERATE_DEV=1 go run -tags=ccgo.dmesg,ccgo.assert generator*.go
  43. go build -v ./...
  44. go test -v -count=1 ./...
  45. git status
  46. test:
  47. go test -v -timeout 24h -count=1
  48. windows: download
  49. mkdir -p $(DIR) || true
  50. rm -rf $(DIR)/*
  51. GO_GENERATE_WIN=1 GO_GENERATE_DIR=$(DIR) go run generator*.go
  52. GOOS=windows GOARCH=amd64 go build -v ./...
  53. GOOS=windows GOARCH=amd64 go test -v -c -o /dev/null
  54. GOOS=windows GOARCH=arm64 go build -v ./...
  55. GOOS=windows GOARCH=arm64 go test -v -c -o /dev/null
  56. git status
  57. windows_386: download
  58. mkdir -p $(DIR) || true
  59. rm -rf $(DIR)/*
  60. GO_GENERATE_WIN32=1 GO_GENERATE_DIR=$(DIR) go run generator*.go
  61. GOOS=windows GOARCH=386 go build -v ./...
  62. GOOS=windows GOARCH=386 go test -v -c -o /dev/null
  63. git status
  64. windows-dev: download
  65. mkdir -p $(DIR) || true
  66. rm -rf $(DIR)/*
  67. echo -n > /tmp/ccgo.log
  68. GO_GENERATE_WIN=1 GO_GENERATE_DIR=$(DIR) GO_GENERATE_DEV=1 go run -tags=ccgo.dmesg,ccgo.assert generator*.go
  69. GOOS=windows GOARCH=amd64 go build -v ./...
  70. GOOS=windows GOARCH=amd64 go test -v -c -o /dev/null
  71. GOOS=windows GOARCH=arm64 go build -v ./...
  72. GOOS=windows GOARCH=arm64 go test -v -c -o /dev/null
  73. git status
  74. windows_386-dev: download
  75. mkdir -p $(DIR) || true
  76. rm -rf $(DIR)/*
  77. echo -n > /tmp/ccgo.log
  78. GO_GENERATE_WIN32=1 GO_GENERATE_DIR=$(DIR) GO_GENERATE_DEV=1 go run -tags=ccgo.dmesg,ccgo.assert generator*.go
  79. GOOS=windows GOARCH=386 go build -v ./...
  80. GOOS=windows GOARCH=386 go test -v -c -o /dev/null
  81. git status
  82. work:
  83. rm -f go.work*
  84. go work init
  85. go work use .
  86. go work use ../ccgo/v4
  87. go work use ../ccgo/v3
  88. go work use ../cc/v4
  89. go work use ../libc