Matthias Andreas Benkard | f59e097 | 2018-04-10 22:01:34 +0200 | [diff] [blame] | 1 | # Copyright 2015 Andrew Gottemoller. |
| 2 | # |
| 3 | # This software is a copyrighted work licensed under the terms of the |
| 4 | # Weld license. Please consult the file "WELD_LICENSE" for |
| 5 | # details. |
| 6 | |
| 7 | # This is the entry point into the weld build system. This file should |
| 8 | # be included by a project's root level makefile' |
| 9 | |
| 10 | |
| 11 | # Weld doesn't use implicit rules so turn them off |
| 12 | .SUFFIXES : |
| 13 | |
| 14 | |
| 15 | # Figure out the path of this makefile |
| 16 | weld_makefile := $(lastword $(MAKEFILE_LIST)) |
| 17 | weld_path := $(dir $(weld_makefile)) |
| 18 | |
| 19 | |
| 20 | # If a config file is specified, include it |
| 21 | -include $(config_file) |
| 22 | |
| 23 | # Set the defaults |
| 24 | include $(weld_path)/config.mk |
| 25 | |
| 26 | # Verify the config file has set all the necessary variables |
| 27 | ifeq ($(source_path),) |
| 28 | $(error csdk_path is not set) |
| 29 | endif |
| 30 | |
| 31 | ifeq ($(build_path),) |
| 32 | $(error build_path is not set) |
| 33 | endif |
| 34 | |
| 35 | ifeq ($(arch),) |
| 36 | $(error arch is not set) |
| 37 | endif |
| 38 | |
| 39 | ifeq ($(mode),) |
| 40 | $(error mode is not set) |
| 41 | endif |
| 42 | |
| 43 | ifeq ($(shell_name),) |
| 44 | $(error shell_name is not set) |
| 45 | endif |
| 46 | |
| 47 | ifeq ($(platform),) |
| 48 | $(error platform is not set) |
| 49 | endif |
| 50 | |
| 51 | ifeq ($(c_toolchain),) |
| 52 | $(error c_toolchain is not set) |
| 53 | endif |
| 54 | |
| 55 | |
| 56 | # Set derived path values |
| 57 | include $(weld_path)/paths.mk |
| 58 | |
| 59 | # Include shell functions and standard utility functions |
| 60 | include $(weld_path)/shell/$(shell_name).mk |
| 61 | include $(weld_path)/utils.mk |
| 62 | |
| 63 | # Discover and include all the specified component definitions found |
| 64 | # for this project |
| 65 | include $(weld_path)/def.mk |
| 66 | include $(weld_path)/disc.mk |
| 67 | |
| 68 | |
| 69 | # Define the top level targets |
| 70 | .DEFAULT_GOAL := build |
| 71 | |
| 72 | |
| 73 | .PHONY : build |
| 74 | build : $(build_target_list) |
| 75 | |
| 76 | .PHONE : headers |
| 77 | headers : $(headers_target_list) |
| 78 | |
| 79 | .PHONY : clean |
| 80 | clean : $(clean_target_list) |
| 81 | |
| 82 | .PHONE : clean_headers |
| 83 | clean_headers : $(clean_headers_target_list) |
| 84 | |
| 85 | $(sort $(directory_list)) : |
| 86 | $(call make_directory,$@) |