Skip to content

Commit 393cc54

Browse files
committed
Use custom SED_INPLACE
depending of platform detection
1 parent 463a59d commit 393cc54

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

Makefile

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
DIST := dist
22
IMPORT := code.gitea.io/gitea
3+
4+
SED_INPLACE := sed -i
5+
6+
ifeq ($(OS), Windows_NT)
7+
EXECUTABLE := gitea.exe
8+
else
9+
EXECUTABLE := gitea
10+
UNAME_S := $(shell uname -s)
11+
ifeq ($(UNAME_S),Darwin)
12+
SED_INPLACE := sed -i ''
13+
endif
14+
endif
15+
316
BINDATA := modules/{options,public,templates}/bindata.go
417
STYLESHEETS := $(wildcard public/less/index.less public/less/_*.less)
518
JAVASCRIPTS :=
@@ -66,11 +79,10 @@ generate-swagger:
6679
@hash swagger > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
6780
go get -u github.com/go-swagger/go-swagger/cmd/swagger; \
6881
fi
69-
swagger generate spec -o ./public/swagger.v1.tmp
70-
sed "s;\".ref\": \"#/definitions/GPGKey\";\"type\": \"object\";g" ./public/swagger.v1.tmp > ./public/swagger.v1.tmp2
71-
sed "s;^ \".ref\": \"#/definitions/Repository\"; \"type\": \"object\";g" ./public/swagger.v1.tmp2 > ./public/swagger.v1.json
72-
rm ./public/swagger.v1.tmp ./public/swagger.v1.tmp2
73-
82+
swagger generate spec -o ./public/swagger.v1.json
83+
$(SED_INPLACE) "s;\".ref\": \"#/definitions/GPGKey\";\"type\": \"object\";g" ./public/swagger.v1.json
84+
$(SED_INPLACE) "s;^ \".ref\": \"#/definitions/Repository\"; \"type\": \"object\";g" ./public/swagger.v1.json
85+
7486
.PHONY: errcheck
7587
errcheck:
7688
@hash errcheck > /dev/null 2>&1; if [ $$? -ne 0 ]; then \

0 commit comments

Comments
 (0)