[2826] | 1 | # $Id: Makefile.kmk 2899 2006-12-24 03:20:40Z bird $# $Id: Makefile.kmk 2899 2006-12-24 03:20:40Z bird $
|
---|
[2821] | 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 |
|
---|
[2859] | 28 | DEPTH = ..
|
---|
| 29 | include $(PATH_KBUILD)/header.kmk
|
---|
| 30 |
|
---|
| 31 | DEFAULT_PASSES := $(filter-out PACKING, $(DEFAULT_PASSES)) # annoying on windows.
|
---|
| 32 |
|
---|
[2821] | 33 | #
|
---|
[2825] | 34 | # Template for testcases.
|
---|
| 35 | #
|
---|
| 36 | TEMPLATE_TST = Testcase template
|
---|
| 37 | ifneq ($(filter win nt win32 win64,$(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__
|
---|
[2861] | 43 | TEMPLATE_TST_SDKS = WIN32SDK W2K3DDKX86
|
---|
| 44 | #TEMPLATE_SDKS.x86 = WIN32SDK W2K3DDKX86
|
---|
| 45 | #TEMPLATE_SDKS.amd64 = WIN64SDK W2K3DDKAMD64
|
---|
[2825] | 46 |
|
---|
| 47 | ## @todo this is a kBuild bug!
|
---|
| 48 | TEMPLATE_TST_LIBS = \
|
---|
| 49 | $$(PATH_TOOL_VCC70_LIB)/msvcrt.lib
|
---|
| 50 | else
|
---|
| 51 | ifneq ($(filter os2,$(BUILD_TARGET)),)
|
---|
| 52 | TEMPLATE_TST_TOOL = GCC3OMF
|
---|
| 53 | TEMPLATE_TST_ASFLAGS = -f obj
|
---|
| 54 | TEMPLATE_TST_LIBS = os2 gcc end
|
---|
| 55 | else
|
---|
| 56 | TEMPLATE_TST_TOOL = GCC3
|
---|
| 57 | TEMPLATE_TST_ASFLAGS = -f elf
|
---|
| 58 | TEMPLATE_TST_LIBS = gcc
|
---|
| 59 | endif
|
---|
[2899] | 60 | TEMPLATE_TST_CFLAGS = -Wall -pedantic -g -std=gnu99
|
---|
[2825] | 61 | TEMPLATE_TST_CFLAGS.release = -O2
|
---|
| 62 | TEMPLATE_TST_LDFLAGS =
|
---|
| 63 | endif
|
---|
| 64 | TEMPLATE_TST_INCS = .
|
---|
| 65 |
|
---|
| 66 |
|
---|
| 67 | #
|
---|
| 68 | # The kLdr DLL.
|
---|
| 69 | #
|
---|
[2821] | 70 | DLLS = kLdr
|
---|
| 71 | kLdr_ASTOOL = NASM
|
---|
[2825] | 72 | ifneq ($(filter win nt win32 win64,$(BUILD_TARGET)),)
|
---|
| 73 | kLdr_TOOL = GCC3
|
---|
| 74 | kLdr_TOOL = VCC70
|
---|
[2858] | 75 | kLdr_CFLAGS = -W3 -Zl -ML
|
---|
[2825] | 76 | kLdr_ASFLAGS = -f win
|
---|
[2858] | 77 | kLdr_LDFLAGS = -Entry:DllMain@12 -Debug
|
---|
[2825] | 78 | kLdr_DEFS = __WIN__
|
---|
[2861] | 79 | # crap, this doesn't work right either:
|
---|
| 80 | #kLdr_SDKS = WIN32SDK W2K3DDKX86
|
---|
| 81 | kLdr_SDKS = W2K3DDKX86 WIN32SDK
|
---|
| 82 | #kLdr_SDKS.x86 = WIN32SDK W2K3DDKX86
|
---|
| 83 | #kLdr_SDKS.amd64 = WIN64SDK W2K3DDKAMD64
|
---|
[2858] | 84 | kLdr_LIBS = \
|
---|
[2861] | 85 | $$(PATH_TOOL_VCC70_LIB)/LIBC.lib \
|
---|
| 86 | $(PATH_SDK_W2K3DDKX86_LIB)/ntdll.lib
|
---|
[2825] | 87 | else
|
---|
| 88 | ifneq ($(filter os2,$(BUILD_TARGET)),)
|
---|
| 89 | kLdr_TOOL = GCC3OMF
|
---|
| 90 | kLdr_ASFLAGS = -f obj
|
---|
| 91 | kLdr_LIBS = os2 gcc end
|
---|
| 92 | else
|
---|
| 93 | kLdr_TOOL = GCC3
|
---|
| 94 | kLdr_ASFLAGS = -f elf
|
---|
| 95 | kLdr_LIBS = gcc
|
---|
| 96 | endif
|
---|
| 97 | kLdr_CFLAGS = -Wall -pedantic
|
---|
| 98 | kLdr_LDFLAGS = -nostdlib
|
---|
| 99 | endif
|
---|
| 100 | kLdr_INCS = .
|
---|
[2821] | 101 | kLdr_SOURCES = \
|
---|
| 102 | kLdr.c \
|
---|
[2836] | 103 | kLdrDyld.c \
|
---|
| 104 | kLdrDyldFind.c \
|
---|
[2835] | 105 | kLdrDyldMod.c \
|
---|
[2846] | 106 | kLdrDyldOS.c \
|
---|
[2825] | 107 | kLdrHlp.c \
|
---|
| 108 | kLdrHlpHeap.c \
|
---|
| 109 | kLdrRdr.c \
|
---|
| 110 | kLdrRdrFile.c \
|
---|
[2827] | 111 | kLdrMod.c \
|
---|
[2854] | 112 | kLdrModLX.c \
|
---|
[2877] | 113 | kLdrModPE.c \
|
---|
| 114 | kLdrModNative.c
|
---|
[2821] | 115 | kLdr_SOURCES.os2 = \
|
---|
| 116 | kLdr-os2.def \
|
---|
[2886] | 117 | kLdr-os2.c \
|
---|
[2883] | 118 | kLdrHlp-gcc.c \
|
---|
[2821] | 119 | kLdrA-os2.asm
|
---|
[2833] | 120 | kLdr_SOURCES.win = \
|
---|
| 121 | kLdr-win.def \
|
---|
| 122 | kLdr-win.c
|
---|
| 123 | kLdr_SOURCES.win32 = $(kLdr_SOURCES.win)
|
---|
| 124 | kLdr_SOURCES.win64 = $(kLdr_SOURCES.win)
|
---|
[2821] | 125 |
|
---|
| 126 | #
|
---|
| 127 | # The OS/2 stub program.
|
---|
[2825] | 128 | #
|
---|
| 129 | PROGRAMS.os2 = kLdrExeStub-os2
|
---|
[2821] | 130 | kLdrExeStub-os2_TOOL = GCC3OMF
|
---|
| 131 | kLdrExeStub-os2_ASTOOL = NASM
|
---|
| 132 | kLdrExeStub-os2_ASFLAGS = -f obj
|
---|
[2884] | 133 | #kLdrExeStub-os2_LDFLAGS = -nostdlib
|
---|
| 134 | kLdrExeStub-os2_LDFLAGS = -nostdlib -Zstack 64
|
---|
[2821] | 135 | kLdrExeStub-os2_LIBS = $(TARGET_kLdr)
|
---|
[2884] | 136 | #kLdrExeStub-os2_SOURCES = kLdrExeStub-os2.asm
|
---|
| 137 | kLdrExeStub-os2_SOURCES = kLdrExeStub-os2A.asm kLdrExeStub-os2.c
|
---|
[2825] | 138 |
|
---|
[2874] | 139 | #
|
---|
| 140 | # The Windows stub program.
|
---|
| 141 | #
|
---|
| 142 | PROGRAMS.win = kLdrExeStub-win
|
---|
| 143 | PROGRAMS.win32 = kLdrExeStub-win
|
---|
| 144 | PROGRAMS.win64 = kLdrExeStub-win
|
---|
| 145 | kLdrExeStub-win_TOOL = VCC70
|
---|
| 146 | kLdrExeStub-win_SDKS = WIN32SDK
|
---|
| 147 | kLdrExeStub-win_INCS = .
|
---|
| 148 | kLdrExeStub-win_DEFS = __WIN__
|
---|
| 149 | kLdrExeStub-win_CFLAGS = -W3 -Zl
|
---|
| 150 | kLdrExeStub-win_CFLAGS.debug = -Zi
|
---|
[2875] | 151 | kLdrExeStub-win_LDFLAGS = -Entry:WindowsMain -SubSystem:Console -FIXED:NO
|
---|
[2874] | 152 | kLdrExeStub-win_LIBS = $(TARGET_kLdr:.dll=.lib)
|
---|
| 153 | kLdrExeStub-win_SOURCES = kLdrExeStub-win.c
|
---|
| 154 |
|
---|
| 155 |
|
---|
[2821] | 156 | ##
|
---|
| 157 | ## The (stub) utility.
|
---|
[2825] | 158 | ##
|
---|
[2821] | 159 | #PROGRAMS = kLdrUtil
|
---|
| 160 |
|
---|
[2825] | 161 |
|
---|
| 162 | #
|
---|
| 163 | # Heap testcase.
|
---|
| 164 | #
|
---|
| 165 | PROGRAMS += tstkLdrHeap
|
---|
| 166 | tstkLdrHeap_TEMPLATE = TST
|
---|
| 167 | tstkLdrHeap_SOURCES = \
|
---|
| 168 | tstkLdrHeap.c \
|
---|
| 169 | kLdrHlp.c \
|
---|
| 170 | kLdrHlpHeap.c \
|
---|
| 171 |
|
---|
[2858] | 172 | #
|
---|
| 173 | # Heap testcase.
|
---|
| 174 | #
|
---|
| 175 | PROGRAMS += tstkLdrMod
|
---|
| 176 | tstkLdrMod_TEMPLATE = TST
|
---|
| 177 | tstkLdrMod_SOURCES = \
|
---|
| 178 | tstkLdrMod.c
|
---|
| 179 | ifneq ($(filter win win32 win64 nt,$(BUILD_TARGET)),)
|
---|
| 180 | tstkLdrMod_LIBS = $(TARGET_kLdr:.dll=.lib)
|
---|
| 181 | else
|
---|
| 182 | tstkLdrMod_LIBS = $(TARGET_kLdr)
|
---|
| 183 | endif
|
---|
[2825] | 184 |
|
---|
[2858] | 185 |
|
---|
| 186 |
|
---|
[2821] | 187 | # generate rules.
|
---|
[2859] | 188 | include $(PATH_KBUILD)/footer.kmk
|
---|
[2821] | 189 |
|
---|