summaryrefslogtreecommitdiff
path: root/Makefile
blob: a57f966402f959478d63d4e8dda59187855eaad3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#########################################################################################
# GAYE Abdoulaye Walsimou, <walsimou@walsimou.com>
# Copyright(C) 2009 GAYE Abdoulaye Walsimou. All rights reserved.
#
# This program is free software; you can distribute it and/or modify it
# under the terms of the GNU General Public License
# (Version 2 or later) published by the Free Software Foundation.
#
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
#########################################################################################
#
# \file         Makefile
# \brief	root Makefile of Embtoolkit
# \author       GAYE Abdoulaye Walsimou, <walsimou@walsimou.com>
# \date         May 2009
#########################################################################################
VERSION = 0
PATCHLEVEL = 1
SUBLEVEL = 0
EXTRAVERSION = -Beta1
KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION

EMBTK_ROOT := $(shell pwd)
export EMBTK_ROOT

# SHELL used by kbuild
CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
	  else if [ -x /bin/bash ]; then echo /bin/bash; \
	  else echo sh; fi ; fi)
export CONFIG_SHELL

HOST_ARCH := `$(CONFIG_SHELL) $(EMBTK_ROOT)/scripts/config.guess`
HOST_BUILD := $(HOST_ARCH)
export HOST_ARCH HOST_BUILD

HOSTCC       = gcc
HOSTCXX      = g++
HOSTCFLAGS   = -Wall
HOSTCXXFLAGS = -O2
export HOSTCC HOSTCXX HOSTCFLAGS HOSTCXXFLAGS

ifeq ($(Q),)
Q:=
else
Q:=@
endif
export Q

-include .config

ifeq ($(CONFIG_EMBTK_DOWNLOAD_DIR),)
DOWNLOAD_DIR := $(EMBTK_ROOT)/dl
endif

ifeq ($(CONFIG_EMBTK_DOTCONFIG),)
EMBTK_BUILD := xconfig
else
EMBTK_BUILD := startbuild
endif

All: $(EMBTK_BUILD)

xconfig: basic
ifeq ($(CONFIG_EMBTK_DOTCONFIG),y)
	$(Q)$(MAKE) -f scripts/Makefile.build obj=scripts/kconfig xconfig
else
	@if [ -e $(EMBTK_ROOT)/.config.old ]; then \
	cp  $(EMBTK_ROOT)/.config.old  $(EMBTK_ROOT)/.config; \
	$(Q)$(MAKE) -f scripts/Makefile.build obj=scripts/kconfig xconfig; \
	else \
	$(Q)$(MAKE) -f scripts/Makefile.build obj=scripts/kconfig xconfig; \
	fi
endif

menuconfig: basic
	$(Q)$(MAKE) -f scripts/Makefile.build obj=scripts/kconfig menuconfig

basic:
	$(Q)$(MAKE) -f scripts/Makefile.build obj=scripts/basic

clean: rmallpath
	$(Q)$(MAKE) -f scripts/Makefile.clean obj=scripts/kconfig
	$(Q)$(MAKE) -f scripts/Makefile.clean obj=scripts/basic
	$(Q)rm -rf .config kbuild.log .fakeroot*

startbuild: buildtoolchain rootfs_build

include mk/macros.mk
include mk/target-mcu.mk
include mk/initialpath.mk
include mk/toolchain.mk
include mk/packages.mk
include mk/rootfs.mk

busybox_config:
ifeq ($(CONFIG_EMBTK_DOTCONFIG),)
	$(call EMBTK_GENERIC_MESSAGE,"Please run make xconfig and configure EmbToolkit first")
	@echo
	@echo
else ifeq ($(CONFIG_EMBTK_HAVE_ROOTFS),)
	$(call EMBTK_GENERIC_MESSAGE,"Please run make xconfig and enable build of root filesystem")
	@echo
	@echo
else ifeq ($(CONFIG_EMBTK_ROOTFS_HAVE_BB),)
	$(call EMBTK_GENERIC_MESSAGE,"Please run make xconfig and enable build of Busybox")
	@echo
	@echo
else
	$(MAKE) mkinitialpath
	$(MAKE) download_busybox $(BB_BUILD_DIR)/.decompressed \
	$(BB_BUILD_DIR)/.Config.in.renewed
	KCONFIG_CONFIG=$(BB_BUILD_DIR)/.config \
	scripts/kconfig/qconf $(BB_BUILD_DIR)/Config.in.new
endif

help:
	$(call EMBTK_GENERIC_MESSAGE,"Embedded systems Toolkit help. Please visit - http://embtoolkit.org -for more details")
	@echo " ---------------------------"
	@echo "| Building and configuring: |"
	@echo " ---------------------------"
	@echo "make xconfig:    Show EmbToolkit configure GUI and let you to"
	@echo "                 configure your toolchain and your root filesystem."
	@echo "make menuconfig: Same as xconfig but using this time ncurse GUI."
	@echo
	@echo " -----------"
	@echo "| Cleaning: |"
	@echo " -----------"
	@echo "make clean:      Remove all built files, but keep downloaded"
	@echo "                 packages and host tools."
	@echo "make distclean:  Same as clean, but remove all downloaded packages."
	@echo