[新增] Makefile 文件

This commit is contained in:
gaoyang3513
2023-10-16 18:51:47 +08:00
parent 205aa31030
commit 470e322b2e
6 changed files with 72 additions and 2107 deletions

67
Makefile Normal file
View File

@ -0,0 +1,67 @@
#*******************************************************************************
# None
# Author :
# Version : V1.0.0 20xx.xx.xx
# Description :
# Note : gaoyang3513@163.com Modified 20xx.xx.xx
#*******************************************************************************
#*******************************************************************************
# Functions
#*******************************************************************************
#*******************************************************************************
# Path information
#*******************************************************************************
LOCAL_DIR := $(shell pwd)
LIBTIRPC_DIR := $(LOCAL_DIR)/libtirpc-1.3.1
RPCSVC_DIR := $(LOCAL_DIR)/rpcsvc-proto-1.4.2
NFS_DIR := $(LOCAL_DIR)/nfs-utils-2.5.2
#SDK_TOP := $(realpath $(LOCAL_DIR)/..)
#----------------------------------
OUTPUT_DIR := $(LOCAL_DIR)/output
INSTALL_DIR := $(LOCAL_DIR)/install
#*******************************************************************************
# Variables
#*******************************************************************************
MULTI_CORES ?= $(shell grep -c ^processor /proc/cpuinfo)
#*******************************************************************************
# Compile configure
#*******************************************************************************
#*******************************************************************************
# Targets
#*******************************************************************************
# Build all
BUILD_ALL = checkenv
BUILD_ALL += nfs-utils
CLEAN_ALL := $(shell echo $(addsuffix _clean,$(BUILD_ALL)) | awk '{for(i=NF;i>=1;i--) printf("%s ",$$i)}')
.PHONY: $(BUILD_ALL) $(CLEAN_ALL)
all: $(BUILD_ALL)
@echo "Finish building"
clean: $(CLEAN_ALL)
@echo "Finish cleaning"
checkenv:
@if [ ! -e $(OUTPUT_DIR) ]; then mkdir -p $(OUTPUT_DIR); fi;
@if [ ! -e $(INSTALL_DIR) ]; then mkdir -p $(INSTALL_DIR); fi;
nfs-utils:
if [ ! -e $(NFS_DIR)/configure ]; then \
cd $(NFS_DIR); \
./autogen.sh; \
fi
if [ ! -e $(NFS_DIR)/Makefile ]; then \
cd $(NFS_DIR); \
./configure --prefix=$(INSTALL_DIR) --disable-nfsv4 --disable-gss --disable-uuid --disable-mount --sbindir=$(INSTALL_DIR)/sbin/ --with-statedir=$(INSTALL_DIR)/var/lig/nfs/; \
fi
$(MAKE) -C $(NFS_DIR) all install
nfs-utils_clean:
$(MAKE) -C $(NFS_DIR) clean;