build: add rules for building fsck

Add rules for building fsck. Two ways to build fsck:
  * make fsck
  * ${ChubaoFS_SRC_DIR}/build/build.sh fsck
The target is cfs-fsck.

Signed-off-by: Sheng Yong <shengyong2021@gmail.com>
This commit is contained in:
Sheng Yong 2021-07-27 19:45:28 +08:00
parent ef15fdf1f2
commit 819e97eb0e
2 changed files with 20 additions and 2 deletions

View File

@ -7,6 +7,7 @@ BIN_CLIENT := $(BIN_PATH)/cfs-client
BIN_CLIENT2 := $(BIN_PATH)/cfs-client2
BIN_AUTHTOOL := $(BIN_PATH)/cfs-authtool
BIN_CLI := $(BIN_PATH)/cfs-cli
BIN_FSCK := $(BIN_PATH)/cfs-fsck
BIN_LIBSDK := $(BIN_PATH)/libsdk
COMMON_SRC := build/build.sh Makefile
@ -16,6 +17,7 @@ CLIENT_SRC := $(wildcard client/*.go client/fs/*.go sdk/*.go)
CLIENT2_SRC := $(wildcard clientv2/*.go clientv2/fs/*.go sdk/*.go)
AUTHTOOL_SRC := $(wildcard authtool/*.go)
CLI_SRC := $(wildcard cli/*.go)
FSCK_SRC := $(wildcard fsck/*.go fsck/cmd/*.go)
LIBSDK_SRC := $(wildcard libsdk/*.go)
RM := $(shell [ -x /bin/rm ] && echo "/bin/rm" || echo "/usr/bin/rm" )
@ -25,8 +27,8 @@ default: all
phony := all
all: build
phony += build server authtool client client2 cli
build: server authtool client cli libsdk
phony += build server authtool client client2 cli fsck
build: server authtool client cli libsdk fsck
server: $(BIN_SERVER)
@ -38,6 +40,8 @@ authtool: $(BIN_AUTHTOOL)
cli: $(BIN_CLI)
fsck: $(BIN_FSCK)
libsdk: $(BIN_LIBSDK)
$(BIN_SERVER): $(COMMON_SRC) $(SERVER_SRC)
@ -55,6 +59,9 @@ $(BIN_AUTHTOOL): $(COMMON_SRC) $(AUTHTOOL_SRC)
$(BIN_CLI): $(COMMON_SRC) $(CLI_SRC)
@build/build.sh cli
$(BIN_FSCK): $(COMMON_SRC) $(FSCK_SRC)
@build/build.sh fsck
$(BIN_LIBSDK): $(COMMON_SRC) $(LIBSDK_SRC)
@build/build.sh libsdk

View File

@ -287,6 +287,14 @@ build_cli() {
popd >/dev/null
}
build_fsck() {
pre_build
pushd $SrcPath >/dev/null
echo -n "build cfs-fsck "
go build $MODFLAGS -ldflags "${LDFlags}" -o ${BuildBinPath}/cfs-fsck ${SrcPath}/fsck/*.go && echo "success" || echo "failed"
popd >/dev/null
}
build_libsdk() {
pre_build_server
case `uname` in
@ -349,6 +357,9 @@ case "$cmd" in
"cli")
build_cli
;;
"fsck")
build_fsck
;;
"libsdk")
build_libsdk
;;