1ca0551cfSopenharmony_ci# Copyright (c) 2023-2024 Huawei Device Co., Ltd. 2ca0551cfSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 3ca0551cfSopenharmony_ci# you may not use this file except in compliance with the License. 4ca0551cfSopenharmony_ci# You may obtain a copy of the License at 5ca0551cfSopenharmony_ci# 6ca0551cfSopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 7ca0551cfSopenharmony_ci# 8ca0551cfSopenharmony_ci# Unless required by applicable law or agreed to in writing, software 9ca0551cfSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 10ca0551cfSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11ca0551cfSopenharmony_ci# See the License for the specific language governing permissions and 12ca0551cfSopenharmony_ci# limitations under the License. 13ca0551cfSopenharmony_ci 14ca0551cfSopenharmony_ciBOUNDS_CHECK_DIR := $(abspath ../../../third_party/bounds_checking_function) 15ca0551cfSopenharmony_ciINCLUDES = -I$(PWD) -I$(BOUNDS_CHECK_DIR)/include 16ca0551cfSopenharmony_ci 17ca0551cfSopenharmony_ciCODEGEN_SOURCE_DIR := $(PWD)/codegen 18ca0551cfSopenharmony_ciCODEGEN_SOURCE := $(wildcard $(CODEGEN_SOURCE_DIR)/*.cpp) 19ca0551cfSopenharmony_ciCODEGEN_OBJ_DIR := $(BUILD_DIR)/codegen 20ca0551cfSopenharmony_ciCODEGEN_OBJS := $(addprefix $(CODEGEN_OBJ_DIR)/, $(patsubst %.cpp, %.o, $(notdir $(CODEGEN_SOURCE)))) 21ca0551cfSopenharmony_ci 22ca0551cfSopenharmony_ciMETADATA_SOURCE_DIR := $(PWD)/metadata 23ca0551cfSopenharmony_ciMETADATA_SOURCE := $(wildcard $(METADATA_SOURCE_DIR)/*.cpp) 24ca0551cfSopenharmony_ciMETADATA_OBJ_DIR := $(BUILD_DIR)/metadata 25ca0551cfSopenharmony_ciMETADATA_OBJS := $(addprefix $(METADATA_OBJ_DIR)/, $(patsubst %.cpp, %.o, $(notdir $(METADATA_SOURCE)))) 26ca0551cfSopenharmony_ci 27ca0551cfSopenharmony_ciPARSER_SOURCE_DIR := $(PWD)/parser 28ca0551cfSopenharmony_ciPARSER_SOURCE := $(wildcard $(PARSER_SOURCE_DIR)/*.cpp) 29ca0551cfSopenharmony_ciPARSER_OBJS_DIR := $(BUILD_DIR)/parser 30ca0551cfSopenharmony_ciPARSER_OBJS := $(addprefix $(PARSER_OBJS_DIR)/, $(patsubst %.cpp, %.o, $(notdir $(PARSER_SOURCE)))) 31ca0551cfSopenharmony_ci 32ca0551cfSopenharmony_ciAST_SOURCE_DIR := $(PWD)/ast 33ca0551cfSopenharmony_ciAST_SOURCE := $(wildcard $(AST_SOURCE_DIR)/*.cpp) 34ca0551cfSopenharmony_ciAST_OBJS_DIR := $(BUILD_DIR)/ast 35ca0551cfSopenharmony_ciAST_OBJS := $(addprefix $(AST_OBJS_DIR)/, $(patsubst %.cpp, %.o, $(notdir $(AST_SOURCE)))) 36ca0551cfSopenharmony_ci 37ca0551cfSopenharmony_ciUTIL_SOURCE_DIR := $(PWD)/util 38ca0551cfSopenharmony_ciUTIL_SOURCE := $(wildcard $(UTIL_SOURCE_DIR)/*.cpp) 39ca0551cfSopenharmony_ciUTIL_OBJS_DIR := $(BUILD_DIR)/util 40ca0551cfSopenharmony_ciUTIL_OBJS := $(addprefix $(UTIL_OBJS_DIR)/, $(patsubst %.cpp, %.o, $(notdir $(UTIL_SOURCE)))) 41ca0551cfSopenharmony_ci 42ca0551cfSopenharmony_ciBOUNDS_CHECK_SOURCE_DIR := $(abspath ../../../third_party/bounds_checking_function/src) 43ca0551cfSopenharmony_ciBOUNDS_CHECK_SOURCE := $(wildcard $(BOUNDS_CHECK_SOURCE_DIR)/*.c) 44ca0551cfSopenharmony_ciBOUNDS_CHECK_OBJS_DIR := $(BUILD_DIR)/bounds_checking_function 45ca0551cfSopenharmony_ciBOUNDS_CHECK_OBJS := $(addprefix $(BOUNDS_CHECK_OBJS_DIR)/, $(patsubst %.c, %.o, $(notdir $(BOUNDS_CHECK_SOURCE)))) 46ca0551cfSopenharmony_ci 47ca0551cfSopenharmony_ciMAIN_SOURCE := $(wildcard *.cpp) 48ca0551cfSopenharmony_ciMAIN_OBJS := $(addprefix $(BUILD_DIR)/, $(patsubst %.cpp, %.o, $(MAIN_SOURCE))) 49ca0551cfSopenharmony_ci 50ca0551cfSopenharmony_ciall:$(TARGET) 51ca0551cfSopenharmony_ci 52ca0551cfSopenharmony_ci$(TARGET) : $(BOUNDS_CHECK_OBJS) $(UTIL_OBJS) $(HASH_OBJS) $(AST_OBJS) $(PARSER_OBJS) $(CODEGEN_OBJS) $(METADATA_OBJS) $(MAIN_OBJS) 53ca0551cfSopenharmony_ci $(Q) $(CXX) $(CXXFLAGS) $(INCLUDES) $^ -o $@ 54ca0551cfSopenharmony_ci $(Q) echo $(TARGET):build successful. 55ca0551cfSopenharmony_ci 56ca0551cfSopenharmony_ci$(BUILD_DIR)/%.o : %.cpp 57ca0551cfSopenharmony_ci $(Q) mkdir -p $(BUILD_DIR) 58ca0551cfSopenharmony_ci $(Q) $(CXX) $(CXXFLAGS) $(INCLUDES) -c $^ -o $@ 59ca0551cfSopenharmony_ci 60ca0551cfSopenharmony_ci$(CODEGEN_OBJ_DIR)/%.o : $(CODEGEN_SOURCE_DIR)/%.cpp 61ca0551cfSopenharmony_ci $(Q) mkdir -p $(CODEGEN_OBJ_DIR) 62ca0551cfSopenharmony_ci $(Q) $(CXX) $(CXXFLAGS) $(INCLUDES) -c $^ -o $@ 63ca0551cfSopenharmony_ci 64ca0551cfSopenharmony_ci$(METADATA_OBJ_DIR)/%.o : $(METADATA_SOURCE_DIR)/%.cpp 65ca0551cfSopenharmony_ci $(Q) mkdir -p $(METADATA_OBJ_DIR) 66ca0551cfSopenharmony_ci $(Q) $(CXX) $(CXXFLAGS) $(INCLUDES) -c $^ -o $@ 67ca0551cfSopenharmony_ci 68ca0551cfSopenharmony_ci$(PARSER_OBJS_DIR)/%.o : $(PARSER_SOURCE_DIR)/%.cpp 69ca0551cfSopenharmony_ci $(Q) mkdir -p $(PARSER_OBJS_DIR) 70ca0551cfSopenharmony_ci $(Q) $(CXX) $(CXXFLAGS) $(INCLUDES) -c $^ -o $@ 71ca0551cfSopenharmony_ci 72ca0551cfSopenharmony_ci$(AST_OBJS_DIR)/%.o : $(AST_SOURCE_DIR)/%.cpp 73ca0551cfSopenharmony_ci $(Q) mkdir -p $(AST_OBJS_DIR) 74ca0551cfSopenharmony_ci $(Q) $(CXX) $(CXXFLAGS) $(INCLUDES) -c $^ -o $@ 75ca0551cfSopenharmony_ci 76ca0551cfSopenharmony_ci$(UTIL_OBJS_DIR)/%.o : $(UTIL_SOURCE_DIR)/%.cpp 77ca0551cfSopenharmony_ci $(Q) mkdir -p $(UTIL_OBJS_DIR) 78ca0551cfSopenharmony_ci $(Q) $(CXX) $(CXXFLAGS) $(INCLUDES) -c $^ -o $@ 79ca0551cfSopenharmony_ci 80ca0551cfSopenharmony_ci$(BOUNDS_CHECK_OBJS_DIR)/%.o : $(BOUNDS_CHECK_SOURCE_DIR)/%.c 81ca0551cfSopenharmony_ci $(Q) mkdir -p $(BOUNDS_CHECK_OBJS_DIR) 82ca0551cfSopenharmony_ci $(Q) $(CXX) $(CXXFLAGS) $(INCLUDES) -c $^ -o $@ 83ca0551cfSopenharmony_ci 84ca0551cfSopenharmony_ciclean: 85ca0551cfSopenharmony_ci $(Q) rm -rf $(TARGET) $(BUILD_DIR) 86ca0551cfSopenharmony_ci 87ca0551cfSopenharmony_ci.PHONY:all clean