blob: 94b47a290217df51628fae6f0cd8509fbee628f8 [file] [log] [blame]
Matthias Andreas Benkardf59e0972018-04-10 22:01:34 +02001# 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
16weld_makefile := $(lastword $(MAKEFILE_LIST))
17weld_path := $(dir $(weld_makefile))
18
19
20# If a config file is specified, include it
21-include $(config_file)
22
23# Set the defaults
24include $(weld_path)/config.mk
25
26# Verify the config file has set all the necessary variables
27ifeq ($(source_path),)
28 $(error csdk_path is not set)
29endif
30
31ifeq ($(build_path),)
32 $(error build_path is not set)
33endif
34
35ifeq ($(arch),)
36 $(error arch is not set)
37endif
38
39ifeq ($(mode),)
40 $(error mode is not set)
41endif
42
43ifeq ($(shell_name),)
44 $(error shell_name is not set)
45endif
46
47ifeq ($(platform),)
48 $(error platform is not set)
49endif
50
51ifeq ($(c_toolchain),)
52 $(error c_toolchain is not set)
53endif
54
55
56# Set derived path values
57include $(weld_path)/paths.mk
58
59# Include shell functions and standard utility functions
60include $(weld_path)/shell/$(shell_name).mk
61include $(weld_path)/utils.mk
62
63# Discover and include all the specified component definitions found
64# for this project
65include $(weld_path)/def.mk
66include $(weld_path)/disc.mk
67
68
69# Define the top level targets
70.DEFAULT_GOAL := build
71
72
73.PHONY : build
74build : $(build_target_list)
75
76.PHONE : headers
77headers : $(headers_target_list)
78
79.PHONY : clean
80clean : $(clean_target_list)
81
82.PHONE : clean_headers
83clean_headers : $(clean_headers_target_list)
84
85$(sort $(directory_list)) :
86 $(call make_directory,$@)