source: trunk/kLdr/Makefile.kmk@ 2955

Last change on this file since 2955 was 2955, checked in by bird, 19 years ago

Completed kldrModMachOParseLoadCommands and kldrModMachOSize. Added an kLdrErrStr API.

  • Property svn:keywords set to Id
File size: 4.9 KB
Line 
1# $Id: Makefile.kmk 2955 2007-02-07 07:07:16Z bird $# $Id: Makefile.kmk 2955 2007-02-07 07:07:16Z bird $
2## @file
3#
4# kBuild Makefile for the kLdr.
5#
6# Copyright (c) 2006 knut st. osmundsen <bird@anduin.net>
7#
8#
9# This file is part of kLdr.
10#
11# kLdr 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# kLdr 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 kLdr; if not, write to the Free Software
23# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24#
25#
26
27
28DEPTH = ..
29include $(PATH_KBUILD)/header.kmk
30
31DEFAULT_PASSES := $(filter-out PACKING, $(DEFAULT_PASSES)) # annoying on windows.
32
33#
34# Template for testcases.
35#
36TEMPLATE_TST = Testcase template
37ifneq ($(filter win,$(BUILD_TARGET)),)
38 TEMPLATE_TST_TOOL = VCC70
39 TEMPLATE_TST_CFLAGS = -W3 -Zi -Zl -MD
40 TEMPLATE_TST_CFLAGS.release = -O2
41 TEMPLATE_TST_ASFLAGS = -f win
42 TEMPLATE_TST_DEFS = __WIN__
43 TEMPLATE_TST_SDKS = WINPSDK W2K3DDK
44
45## @todo this is a kBuild bug? $$(PATH_TOOL_VCC70_LIB)
46 TEMPLATE_TST_LIBS = \
47 $$(PATH_TOOL_VCC70_LIB)/msvcrt.lib
48else
49 ifneq ($(filter os2,$(BUILD_TARGET)),)
50 TEMPLATE_TST_TOOL = GCC3OMF
51 TEMPLATE_TST_ASFLAGS = -f obj
52 TEMPLATE_TST_LIBS = os2 gcc end
53 else
54 TEMPLATE_TST_TOOL = GCC3
55 TEMPLATE_TST_ASFLAGS = -f elf
56 TEMPLATE_TST_LIBS = gcc
57 endif
58 TEMPLATE_TST_CFLAGS = -Wall -pedantic -g -std=gnu99
59 TEMPLATE_TST_CFLAGS.release = -O2
60 TEMPLATE_TST_LDFLAGS =
61endif
62TEMPLATE_TST_INCS = .
63
64
65#
66# The kLdr DLL.
67#
68DLLS = kLdr
69kLdr_ASTOOL = NASM
70ifneq ($(filter win nt win32 win64,$(BUILD_TARGET)),)
71 kLdr_TOOL = GCC3
72 kLdr_TOOL = VCC70
73 kLdr_CFLAGS = -W3 -Zl -ML
74 kLdr_ASFLAGS = -f win
75 kLdr_LDFLAGS = -Entry:DllMain@12 -Debug
76 kLdr_DEFS = __WIN__
77 kLdr_SDKS.x86 = WIN32SDK W2K3DDKX86
78 kLdr_SDKS.amd64 = WIN64SDK W2K3DDKAMD64
79 kLdr_LIBS = \
80 $(PATH_TOOL_VCC70_LIB)/LIBC.lib \
81 $(PATH_SDK_W2K3DDKX86_LIB)/ntdll.lib
82else
83 ifneq ($(filter os2,$(BUILD_TARGET)),)
84 kLdr_TOOL = GCC3OMF
85 kLdr_ASFLAGS = -f obj
86 kLdr_LIBS = os2 gcc end
87 else
88 kLdr_TOOL = GCC3
89 kLdr_ASFLAGS = -f elf
90 kLdr_LIBS = gcc
91 endif
92 kLdr_CFLAGS = -Wall -pedantic
93 kLdr_LDFLAGS = -nostdlib
94endif
95kLdr_INCS = .
96kLdr_SOURCES = \
97 kLdr.c \
98 kLdrDyld.c \
99 kLdrDyldFind.c \
100 kLdrDyldMod.c \
101 kLdrDyldOS.c \
102 kLdrErr.c \
103 kLdrHlp.c \
104 kLdrHlpHeap.c \
105 kLdrHlpMem.c \
106 kLdrHlpPath.c \
107 kLdrHlpSem.c \
108 kLdrHlpStr.c \
109 kLdrMisc.c \
110 kLdrRdr.c \
111 kLdrRdrFile.c \
112 kLdrMod.c \
113 kLdrModLX.c \
114 kLdrModMachO.c \
115 kLdrModNative.c \
116 kLdrModPE.c
117kLdr_SOURCES.os2 = \
118 kLdr-os2.def \
119 kLdr-os2.c \
120 kLdrHlp-gcc.c \
121 kLdrA-os2.asm
122kLdr_SOURCES.win = \
123 kLdr-win.def \
124 kLdr-win.c
125kLdr_SOURCES.win32 = $(kLdr_SOURCES.win)
126kLdr_SOURCES.win64 = $(kLdr_SOURCES.win)
127
128kLdrErr.c_DEPS = $(PATH_TARGET)/kldrErrConsts.h
129kLdrErr.c_INCS = $(PATH_TARGET)
130
131#
132# The OS/2 stub program.
133#
134PROGRAMS.os2 = kLdrExeStub-os2
135kLdrExeStub-os2_TOOL = GCC3OMF
136kLdrExeStub-os2_ASTOOL = NASM
137kLdrExeStub-os2_ASFLAGS = -f obj
138#kLdrExeStub-os2_LDFLAGS = -nostdlib
139kLdrExeStub-os2_LDFLAGS = -nostdlib -Zstack 64
140kLdrExeStub-os2_LIBS = $(TARGET_kLdr)
141#kLdrExeStub-os2_SOURCES = kLdrExeStub-os2.asm
142kLdrExeStub-os2_SOURCES = kLdrExeStub-os2A.asm kLdrExeStub-os2.c
143
144#
145# The Windows stub program.
146#
147PROGRAMS.win = kLdrExeStub-win
148PROGRAMS.win32 = kLdrExeStub-win
149PROGRAMS.win64 = kLdrExeStub-win
150kLdrExeStub-win_TOOL = VCC70
151kLdrExeStub-win_SDKS = WIN32SDK
152kLdrExeStub-win_INCS = .
153kLdrExeStub-win_DEFS = __WIN__
154kLdrExeStub-win_CFLAGS = -W3 -Zl
155kLdrExeStub-win_CFLAGS.debug = -Zi
156kLdrExeStub-win_LDFLAGS = -Entry:WindowsMain -SubSystem:Console -FIXED:NO
157kLdrExeStub-win_LIBS = $(TARGET_kLdr:.dll=.lib)
158kLdrExeStub-win_SOURCES = kLdrExeStub-win.c
159
160
161##
162## The (stub) utility.
163##
164#PROGRAMS = kLdrUtil
165
166
167#
168# Heap testcase.
169#
170PROGRAMS += tstkLdrHeap
171tstkLdrHeap_TEMPLATE = TST
172tstkLdrHeap_SOURCES = \
173 tstkLdrHeap.c \
174 kLdrHlp.c \
175 kLdrHlpHeap.c \
176 kLdrHlpMem.c \
177 kLdrHlpPath.c \
178 kLdrHlpSem.c \
179 kLdrHlpStr.c \
180
181#
182# Heap testcase.
183#
184PROGRAMS += tstkLdrMod
185tstkLdrMod_TEMPLATE = TST
186tstkLdrMod_SOURCES = \
187 tstkLdrMod.c
188ifneq ($(filter win win32 win64 nt,$(BUILD_TARGET)),)
189tstkLdrMod_LIBS = $(TARGET_kLdr:.dll=.lib)
190else
191tstkLdrMod_LIBS = $(TARGET_kLdr)
192endif
193
194
195
196# Generate rules.
197include $(PATH_KBUILD)/footer.kmk
198
199
200#
201# Generate case statements for kLdrErrStr().
202#
203$(PATH_TARGET)/kldrErrConsts.h: kLdr.h Makefile.kmk | $(call DIRDEP,$(PATH_TARGET))
204 $(RM) -f $@
205 $(SED) \
206 -e '/^#define *\(KLDR_ERR_[^ ()]*\) .*$$/!d' \
207 -e 's/^#define *\(KLDR_ERR_[^ ()]*\) .*$$/ERR_CONST(\1)/' \
208 -e '/KLDR_ERR_[^_]*_BASE/d' \
209 kLdr.h > $@
210
Note: See TracBrowser for help on using the repository browser.