source: trunk/kBuild/header.kmk@ 69

Last change on this file since 69 was 69, checked in by bird, 21 years ago

early coding.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.0 KB
Line 
1# $Id: header.kmk 69 2004-05-29 06:20:31Z bird $
2## @file
3#
4# kBuild - File included at top of makefile.
5#
6# Copyright (c) 2004 knut st. osmundsen <bird-srcspam@anduin.net>
7#
8#
9# This file is part of kBuild.
10#
11# kBuild is free software; you can redistribute it and/or modify
12# it under the terms of the GNU General Public License as published by
13# the Free Software Foundation; either version 2 of the License, or
14# (at your option) any later version.
15#
16# kBuild is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with kBuild; if not, write to the Free Software
23# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24#
25#
26
27ifndef __header_kmk__
28# start-of-file-content
29
30#
31# default rule
32#
33all: all_recursive
34
35#
36# Try avoid inference rules.
37#
38.SUFFIXES:
39SUFFIXES :=
40
41#
42# Environment unifications
43#
44ifndef BUILD_TYPE
45ifndef BUILD_MODE
46$(error "define BUILD_TYPE you moron!")
47endif
48BUILD_TYPE := $(BUILD_MODE)
49endif
50
51
52#
53# Common definitions.
54#
55PATH_CURRENT := $(CURDIR)
56PATH_ROOT := $(DEPTH)
57ifndef PATH_KBUILD
58PATH_KBUILD := $(PATH_ROOT)/kBuild
59endif
60
61PATH_OUT := $(PATH_ROOT)/out/$(BUILD_TARGET)/$(BUILD_TYPE)
62PATH_OBJ := $(PATH_OUT)/obj
63PATH_BIN := $(PATH_OUT)/bin
64PATH_LIB := $(PATH_OUT)/lib
65PATH_DOC := $(PATH_ROOT)/out/doc
66PATH_TOOLS_W32 := $(PATH_KBUILD)/bin/x86.win32
67PATH_TOOLS_LNX := $(PATH_KBUILD)/bin/x86.linux
68PATH_TOOLS_OS2 := $(PATH_KBUILD)/bin/x86.os2
69# fixme
70PATH_TARGET = $(PATH_OUT)
71
72# kBuild files which might be of interest.
73FILE_KBUILD_HEADER := $(PATH_KBUILD)/header.kmk
74FILE_KBUILD_CONFIG := $(PATH_KBUILD)/config.kmk
75FILE_KBUILD_FOOTER := $(PATH_KBUILD)/footer.kmk
76
77
78#
79# Get rid of the GNU Make default stuff
80#
81include $(PATH_KBUILD)/StampOutPredefines.kmk
82
83
84#
85# PLATFORMS (host)
86#
87_BUILD_PLATFORM_OK := 0
88# OS/2
89ifeq ($(BUILD_PLATFORM),OS2)
90_BUILD_PLATFORM_OK := 1
91ifndef BUILD_TARGET
92BUILD_TARGET := OS2
93endif
94PATH_TOOLS := $(PATH_TOOLS_OS2)
95EXEC_X86_WIN32 := $(PATH_TOOLS)/bin/innopec.exe
96HOSTSUFF_EXE := .exe
97endif
98
99# Linux
100ifeq ($(BUILD_PLATFORM),LINUX)
101_BUILD_PLATFORM_OK := 1
102ifndef BUILD_TARGET
103BUILD_TARGET := LINUX
104endif
105PATH_TOOLS := $(PATH_TOOLS_LNX)
106EXEC_X86_WIN32 := wine
107HOSTSUFF_EXE :=
108endif
109
110# Win32
111ifeq ($(BUILD_PLATFORM),WIN32)
112ifndef BUILD_TARGET
113BUILD_TARGET := WIN32
114endif
115_BUILD_PLATFORM_OK := 1
116PATH_TOOLS := $(PATH_TOOLS_W32)
117EXEC_X86_WIN32 :=
118HOSTSUFF_EXE := .exe
119endif
120
121# assert build platform
122ifeq ($(_BUILD_PLATFORM_OK),0)
123$(error "BUILD_PLATFORM value '$(BUILD_PLATFORM)' was not recongized")
124endif
125
126
127#
128# Standard kBuild tools.
129#
130DEP := $(PATH_TOOLS)/kDep$(HOSTSUFF_EXE)
131# Standard Unix shell utils.
132MKDIR := $(PATH_TOOLS)/mkdir$(HOSTSUFF_EXE)
133RM := $(PATH_TOOLS)/rm$(HOSTSUFF_EXE)
134CP := $(PATH_TOOLS)/mv$(HOSTSUFF_EXE)
135MV := $(PATH_TOOLS)/cp$(HOSTSUFF_EXE)
136SED := $(PATH_TOOLS)/sed$(HOSTSUFF_EXE)
137CAT := $(PATH_TOOLS)/cat$(HOSTSUFF_EXE)
138# Bourn shell clone.
139MAKESHELL := $(PATH_TOOLS)/ash$(HOSTSUFF_EXE)
140SHELL := $(MAKESHELL)
141export SHELL MAKESHELL
142
143
144#
145# This is how we find the closest config.kmk.
146# It's a little hacky but I think it works fine.
147#
148_CFGDIR := .
149_CFGFILES :=
150define def_include_config
151_CFGDIR := $(_CFGDIR)/$(1)
152_CFGFILES += $(wildcard $(_CFGDIR)/config.kmk $(_CFGDIR)/config.kMk)
153endef
154# walk down the _RELATIVE_ path specified by DEPTH.
155$(foreach d,$(subst /, ,$(DEPTH)), $(eval $(call def_include_config,$(d))) )
156# add the default config file.
157_CFGFILE := $(firstword $(_CFGFILES) $(FILE_KBUILD_CONFIG))
158_CFGFILES :=
159_CFGDIR :=
160
161# Include the config.kmk we found file (or the default one).
162include $(_CFGFILE)
163
164
165# end-of-file-content
166__header_kmk__ := 1
167endif # __header_kmk__
Note: See TracBrowser for help on using the repository browser.