2022-10-25 23:33:59 +08:00
|
|
|
#//////////////////////////////////////////////////////////////////
|
|
|
|
#//
|
|
|
|
#// Filename: Makefile
|
|
|
|
#//
|
|
|
|
#// Version: 1.0
|
|
|
|
#// Created: 2022年10月25日 23时10分18秒
|
|
|
|
#// Revision: none
|
|
|
|
#//
|
|
|
|
#// Author: alpha
|
|
|
|
#// Organization: alpha
|
2022-10-26 01:03:45 +08:00
|
|
|
#// Contacts: chenxinquan@kylinos.cn
|
2022-10-25 23:33:59 +08:00
|
|
|
#//
|
|
|
|
#//////////////////////////////////////////////////////////////////
|
|
|
|
#
|
|
|
|
#//////////////////////////////////////////////////////////////////
|
|
|
|
#// Description:
|
|
|
|
#//////////////////////////////////////////////////////////////////
|
|
|
|
#
|
|
|
|
#//////////////////////////////////////////////////////////////////
|
|
|
|
#// Log:
|
|
|
|
#//////////////////////////////////////////////////////////////////
|
|
|
|
#
|
|
|
|
#//////////////////////////////////////////////////////////////////
|
|
|
|
#// Todo:
|
|
|
|
#//
|
|
|
|
#//////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
PRO_NAME = genmai
|
|
|
|
PRO_VERSION = 2022.10.25
|
|
|
|
#PRO_TOP_DIR=${.CURDIR}
|
|
|
|
PRO_TOP_DIR = $(shell pwd)
|
|
|
|
|
|
|
|
BUILD_DIR = ${PRO_TOP_DIR}/build
|
|
|
|
|
2022-11-16 21:52:33 +08:00
|
|
|
SRC_DIR = ${PRO_TOP_DIR}/src
|
|
|
|
BIN_DIR = ${PRO_TOP_DIR}/bin
|
2022-10-25 23:33:59 +08:00
|
|
|
|
|
|
|
# TODO: make it can configurable
|
|
|
|
MAKE = make
|
2022-11-17 11:58:01 +08:00
|
|
|
GO_COMPILER := GO111MODULE=on go
|
2022-10-25 23:33:59 +08:00
|
|
|
|
|
|
|
all: build
|
|
|
|
build::
|
2022-10-25 23:39:05 +08:00
|
|
|
clean::
|
|
|
|
realclean::
|
2022-10-25 23:33:59 +08:00
|
|
|
|
|
|
|
################################################################
|
|
|
|
# pre
|
|
|
|
build:: pre-build
|
|
|
|
|
|
|
|
pre-build:
|
|
|
|
if [ ! -d ${BUILD_DIR} ]; then mkdir ${BUILD_DIR}; fi
|
|
|
|
|
|
|
|
################################################################
|
|
|
|
# begin
|
|
|
|
build:: begin-build
|
2022-10-25 23:39:05 +08:00
|
|
|
clean:: begin-clean
|
|
|
|
realclean:: begin-realclean
|
2022-10-25 23:33:59 +08:00
|
|
|
|
|
|
|
begin-build:
|
|
|
|
@echo
|
|
|
|
@echo "----------------------------------------------------------------"
|
|
|
|
@echo " >>> Building genmai (version ${PRO_VERSION})"
|
|
|
|
@echo "----------------------------------------------------------------"
|
|
|
|
|
2022-10-25 23:39:05 +08:00
|
|
|
begin-clean:
|
|
|
|
@echo
|
|
|
|
@echo "----------------------------------------------------------------"
|
|
|
|
@echo " >>> Cleaning project"
|
|
|
|
@echo "----------------------------------------------------------------"
|
|
|
|
|
|
|
|
begin-realclean:
|
|
|
|
@echo
|
|
|
|
@echo "----------------------------------------------------------------"
|
|
|
|
@echo " >>> Cleaning project"
|
|
|
|
@echo "----------------------------------------------------------------"
|
|
|
|
|
2022-10-25 23:33:59 +08:00
|
|
|
################################################################
|
|
|
|
# genmai
|
|
|
|
build:: genmai-build
|
2022-10-25 23:39:05 +08:00
|
|
|
clean:: genmai-clean
|
|
|
|
realclean:: genmai-realclean
|
2022-10-25 23:33:59 +08:00
|
|
|
|
2022-11-01 22:36:38 +08:00
|
|
|
GENMAI_DIR= ${PRO_TOP_DIR}/genmai
|
2022-10-25 23:33:59 +08:00
|
|
|
|
|
|
|
genmai-build: pre-build
|
|
|
|
@echo ">"
|
2022-11-17 11:58:01 +08:00
|
|
|
cd ${SRC_DIR} && ${GO_COMPILER} build -o ${BUILD_DIR}
|
2022-10-25 23:33:59 +08:00
|
|
|
|
2022-10-25 23:39:05 +08:00
|
|
|
genmai-clean:
|
|
|
|
@echo ">"
|
|
|
|
if [ -e ${BUILD_DIR} ]; then rm -rf ${BUILD_DIR}; fi
|
|
|
|
|
|
|
|
genmai-realclean:
|
|
|
|
@echo ">"
|
|
|
|
if [ -e ${BUILD_DIR} ]; then rm -rf ${BUILD_DIR}; fi
|
|
|
|
|
2022-10-25 23:33:59 +08:00
|
|
|
################################################################
|
|
|
|
# end
|
|
|
|
build:: end-build
|
2022-10-25 23:39:05 +08:00
|
|
|
clean:: end-clean
|
|
|
|
realclean:: end-realclean
|
2022-10-25 23:33:59 +08:00
|
|
|
|
|
|
|
end-build:
|
|
|
|
@echo
|
|
|
|
@echo "----------------------------------------------------------------"
|
|
|
|
@echo " >>> Built genmai successfully"
|
|
|
|
@echo "----------------------------------------------------------------"
|
|
|
|
|
2022-10-25 23:39:05 +08:00
|
|
|
end-clean:
|
|
|
|
@echo "----------------------------------------------------------------"
|
|
|
|
@echo " >>> Cleaned project successfully"
|
|
|
|
@echo "----------------------------------------------------------------"
|
|
|
|
|
|
|
|
end-realclean:
|
|
|
|
@echo "----------------------------------------------------------------"
|
|
|
|
@echo " >>> Cleaned project successfully"
|
|
|
|
@echo "----------------------------------------------------------------"
|
|
|
|
|
2022-10-25 23:47:38 +08:00
|
|
|
################################################################
|
|
|
|
# help
|
|
|
|
help:
|
|
|
|
@echo
|
|
|
|
@echo "----------------------------------------------------------------"
|
|
|
|
@echo " >>> Help"
|
|
|
|
@echo "----------------------------------------------------------------"
|
|
|
|
@echo "Building targets:"
|
|
|
|
@echo "all -- build genmai source tree."
|
|
|
|
@echo "build -- build all source tree."
|
|
|
|
@echo
|
|
|
|
@echo "Cleaning targets:"
|
|
|
|
@echo "clean -- remove 'build' directory"
|
|
|
|
@echo "realclean -- clean everything was built"
|
|
|
|
@echo
|
|
|
|
|
2022-11-01 22:36:38 +08:00
|
|
|
|
|
|
|
################################################################
|
|
|
|
################################################################
|
|
|
|
# utils
|
|
|
|
run: build
|
|
|
|
${BUILD_DIR}/main -system -kernel
|
|
|
|
|
|
|
|
test: clean build
|
|
|
|
${BUILD_DIR}/main -system -kernel
|
|
|
|
|
2022-10-25 23:33:59 +08:00
|
|
|
.PHONY: all genmai
|