Chameleon

Chameleon Commit Details

Date:2011-08-03 08:06:13 (8 years 3 months ago)
Author:Evan Lojewski
Commit:1263
Parents: 1262
Message:Update i386 makefiles
Changes:
A/branches/xZen/src/arch/Makefile
M/branches/xZen/src/arch/i386/libsaio/Makefile
M/branches/xZen/src/modules/Makefile
M/branches/xZen/src/arch/i386/boot0/Makefile
M/branches/xZen/src/arch/i386/boot1/Makefile
M/branches/xZen/src/arch/i386/boot2/Makefile
M/branches/xZen/src/arch/i386/libsaio/load.c
M/branches/xZen/src/arch/i386/libsaio/console.c
M/branches/xZen/src/arch/i386/Make.rules
M/branches/xZen/src/Makefile
M/branches/xZen/src/arch/i386/libsa/Makefile

File differences

branches/xZen/src/modules/Makefile
4949
5050
5151
52
52
5353
5454
5555
......
5757
5858
5959
60
60
6161
6262
6363
@${MKDIRS} "$(SYMROOT)/modules/"
$(SYMROOT)/boot_modules.c: ${OBJROOT} ${SYMROOT}/modules/ ${OBJROOT} $(addprefix $(OBJROOT)/, ${MODULE_OBJS})
$(SYMROOT)/boot_modules.c: $(SYMROOT) $(OBJROOT) ${SYMROOT}/modules/ ${OBJROOT} $(addprefix $(OBJROOT)/, ${MODULE_OBJS})
ifeq ($(BUILT_IN),yes)
@echo "// Autogenerated - do not modify" > $@
@echo "#include \"../../i386/modules/ModuleSystem/include/modules.h\"" >> $@
@echo "void start_built_in_modules() {" >> $@
endif
$(SYMROOT)/boot_modules.h: ${OBJROOT} ${SYMROOT}/modules/ ${OBJROOT} $(addprefix $(OBJROOT)/, ${MODULE_OBJS})
$(SYMROOT)/boot_modules.h: $(SYMROOT) $(OBJROOT) ${SYMROOT}/modules/ ${OBJROOT} $(addprefix $(OBJROOT)/, ${MODULE_OBJS})
ifeq ($(BUILT_IN),yes)
@echo "// Autogenerated - do not modify" > $@
@echo "void start_built_in_modules(); " > $@
branches/xZen/src/Makefile
66
77
88
9
9
1010
1111
1212
DSTROOT = $(ROOT)/dst
DOCROOT = $(ROOT)/doc
SUBDIRS=util modules arch/${ARCH}
SUBDIRS=util modules arch
all:
@echo ================= make $@ BUILT_IN=yes for modules arch $(ARCH) =================
branches/xZen/src/arch/i386/libsaio/console.c
4545
4646
4747
48
4948
5049
5150
......
8887
8988
9089
91
9290
9391
9492
*/
#include "libsaio.h"
#include <vers.h>
bool gVerboseMode;
bool gErrors;
msgbuf = malloc(BOOTER_LOG_SIZE);
bzero(msgbuf, BOOTER_LOG_SIZE);
cursor = msgbuf;
msglog("%s\n", "Chameleon " I386BOOT_CHAMELEONVERSION " (svn-r" I386BOOT_CHAMELEONREVISION ")" " [" I386BOOT_BUILDDATE "]");
}
void msglog(const char * fmt, ...)
branches/xZen/src/arch/i386/libsaio/load.c
8686
8787
8888
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
89
if (length != 0) *length = size;
return 0;
}
long DecodeMachO(void *binary, entry_t *rentry, char **raddr, int *rsize)
{
struct mach_header *mH;
unsigned long ncmds, cmdBase, cmd, cmdsize, cmdstart;
// long headerBase, headerAddr, headerSize;
unsigned int vmaddr = ~0;
unsigned int vmend = 0;
unsigned long cnt;
long ret = -1;
unsigned int entry = 0;
gBinaryAddress = (unsigned long)binary;
mH = (struct mach_header *)(gBinaryAddress);
switch (archCpuType)
{
case CPU_TYPE_I386:
if (mH->magic != MH_MAGIC) {
error("Mach-O file has bad magic number\n");
return -1;
}
cmdstart = (unsigned long)gBinaryAddress + sizeof(struct mach_header);
break;
case CPU_TYPE_X86_64:
if (mH->magic != MH_MAGIC_64 && mH->magic == MH_MAGIC)
return -1;
if (mH->magic != MH_MAGIC_64) {
error("Mach-O file has bad magic number\n");
return -1;
}
cmdstart = (unsigned long)gBinaryAddress + sizeof(struct mach_header_64);
break;
default:
error("Unknown CPU type\n");
return -1;
}
cmdBase = cmdstart;
#if DEBUG
printf("magic: %x\n", (unsigned)mH->magic);
printf("cputype: %x\n", (unsigned)mH->cputype);
printf("cpusubtype: %x\n", (unsigned)mH->cpusubtype);
printf("filetype: %x\n", (unsigned)mH->filetype);
printf("ncmds: %x\n", (unsigned)mH->ncmds);
printf("sizeofcmds: %x\n", (unsigned)mH->sizeofcmds);
printf("flags: %x\n", (unsigned)mH->flags);
getchar();
#endif
ncmds = mH->ncmds;
for (cnt = 0; cnt < ncmds; cnt++) {
cmd = ((long *)cmdBase)[0];
cmdsize = ((long *)cmdBase)[1];
unsigned int load_addr;
unsigned int load_size;
switch (cmd) {
case LC_SEGMENT_64:
case LC_SEGMENT:
ret = DecodeSegment(cmdBase, &load_addr, &load_size);
if (ret == 0 && load_size != 0 && load_addr >= KERNEL_ADDR) {
vmaddr = MIN(vmaddr, load_addr);
vmend = MAX(vmend, load_addr + load_size);
}
break;
case LC_UNIXTHREAD:
ret = DecodeUnixThread(cmdBase, &entry);
break;
case LC_SYMTAB:
break;
default:
#if NOTDEF
printf("Ignoring cmd type %d.\n", (unsigned)cmd);
#endif
break;
}
if (ret != 0) return -1;
cmdBase += cmdsize;
}
*rentry = (entry_t)( (unsigned long) entry & 0x3fffffff );
*rsize = vmend - vmaddr;
*raddr = (char *)vmaddr;
cmdBase = cmdstart;
for (cnt = 0; cnt < ncmds; cnt++) {
cmd = ((long *)cmdBase)[0];
cmdsize = ((long *)cmdBase)[1];
if(cmd==LC_SYMTAB)
if (DecodeSymbolTable(cmdBase)!=0)
return -1;
cmdBase += cmdsize;
}
return ret;
}
// Private Functions
static long DecodeSegment(long cmdBase, unsigned int *load_addr, unsigned int *load_size)
{
unsigned long vmaddr, fileaddr;
long vmsize, filesize;
char *segname;
if (((long *)cmdBase)[0]==LC_SEGMENT_64)
{
struct segment_command_64 *segCmd;
segCmd = (struct segment_command_64 *)cmdBase;
vmaddr = (segCmd->vmaddr & 0x3fffffff);
vmsize = segCmd->vmsize;
fileaddr = (gBinaryAddress + segCmd->fileoff);
filesize = segCmd->filesize;
segname=segCmd->segname;
#ifdef DEBUG
printf("segname: %s, vmaddr: %x, vmsize: %x, fileoff: %x, filesize: %x, nsects: %d, flags: %x.\n",
segCmd->segname, (unsigned)vmaddr, (unsigned)vmsize, (unsigned)fileaddr, (unsigned)filesize,
(unsigned) segCmd->nsects, (unsigned)segCmd->flags);
getchar();
#endif
}
else
{
struct segment_command *segCmd;
segCmd = (struct segment_command *)cmdBase;
vmaddr = (segCmd->vmaddr & 0x3fffffff);
vmsize = segCmd->vmsize;
fileaddr = (gBinaryAddress + segCmd->fileoff);
filesize = segCmd->filesize;
segname=segCmd->segname;
#ifdef DEBUG
printf("segname: %s, vmaddr: %x, vmsize: %x, fileoff: %x, filesize: %x, nsects: %d, flags: %x.\n",
segCmd->segname, (unsigned)vmaddr, (unsigned)vmsize, (unsigned)fileaddr, (unsigned)filesize,
(unsigned) segCmd->nsects, (unsigned)segCmd->flags);
getchar();
#endif
}
if (vmsize == 0 || filesize == 0) {
*load_addr = ~0;
*load_size = 0;
return 0;
}
if (! ((vmaddr >= KERNEL_ADDR &&
(vmaddr + vmsize) <= (KERNEL_ADDR + KERNEL_LEN)) ||
(vmaddr >= HIB_ADDR &&
(vmaddr + vmsize) <= (HIB_ADDR + HIB_LEN)))) {
stop("Kernel overflows available space");
}
if (vmsize && ((strcmp(segname, "__PRELINK_INFO") == 0) || (strcmp(segname, "__PRELINK") == 0)))
gHaveKernelCache = true;
// Copy from file load area.
if (vmsize>0 && filesize>0)
bcopy((char *)fileaddr, (char *)vmaddr, vmsize>filesize?filesize:vmsize);
// Zero space at the end of the segment.
if (vmsize > filesize)
bzero((char *)(vmaddr + filesize), vmsize - filesize);
*load_addr = vmaddr;
*load_size = vmsize;
return 0;
}
static long DecodeUnixThread(long cmdBase, unsigned int *entry)
{
switch (archCpuType)
{
case CPU_TYPE_I386:
{
i386_thread_state_t *i386ThreadState;
i386ThreadState = (i386_thread_state_t *)
(cmdBase + sizeof(struct thread_command) + 8);
*entry = i386ThreadState->eip;
return 0;
}
case CPU_TYPE_X86_64:
{
x86_thread_state64_t *x86_64ThreadState;
x86_64ThreadState = (x86_thread_state64_t *)
(cmdBase + sizeof(struct thread_command) + 8);
*entry = x86_64ThreadState->rip;
return 0;
}
default:
error("Unknown CPU type\n");
return -1;
}
}
static long DecodeSymbolTable(long cmdBase)
{
struct symtab_command *symTab, *symTableSave;
long tmpAddr, symsSize, totalSize;
long gSymbolTableAddr;
long gSymbolTableSize;
symTab = (struct symtab_command *)cmdBase;
#if DEBUG
printf("symoff: %x, nsyms: %x, stroff: %x, strsize: %x\n",
symTab->symoff, symTab->nsyms, symTab->stroff, symTab->strsize);
getchar();
#endif
symsSize = symTab->stroff - symTab->symoff;
totalSize = symsSize + symTab->strsize;
gSymbolTableSize = totalSize + sizeof(struct symtab_command);
// gSymbolTableAddr = AllocateKernelMemory(gSymbolTableSize);
// Add the SymTab to the memory-map.
// AllocateMemoryRange("Kernel-__SYMTAB", gSymbolTableAddr, gSymbolTableSize, -1);
symTableSave = (struct symtab_command *)gSymbolTableAddr;
tmpAddr = gSymbolTableAddr + sizeof(struct symtab_command);
symTableSave->symoff = tmpAddr;
symTableSave->nsyms = symTab->nsyms;
symTableSave->stroff = tmpAddr + symsSize;
symTableSave->strsize = symTab->strsize;
bcopy((char *)(gBinaryAddress + symTab->symoff),
(char *)tmpAddr, totalSize);
return 0;
}
}
branches/xZen/src/arch/i386/libsaio/Makefile
1
2
3
4
5
6
7
8
9
1
102
11
3
4
5
6
7
128
139
1410
1511
1612
1713
18
1914
20
21
22
23
24
25
26
27
28
2915
3016
31
32
33
34
35
17
18
3619
3720
3821
3922
40
23
4124
25
4226
43
27
4428
45
29
4630
4731
4832
SRCROOT = $(shell pwd)/../../
OBJROOT = $(SRCROOT)/obj/i386/libsaio
SYMROOT = $(SRCROOT)/sym/i386
DSTROOT = $(SRCROOT)/dst/i386
DOCROOT = $(SRCROOT)/doc
IMGROOT = $(SRCROOT)/sym/cache
IMGSKELROOT = $(SRCROOT)/imgskel
CDBOOT = ${IMGROOT}/usr/standalone/i386/cdboot
ROOT = $(shell pwd)/../../../../
DIR = libsaio
include ${SRCROOT}/Make.rules
SRCROOT = ${ROOT}/src
OBJROOT = $(ROOT)/obj/i386/${DIR}
SYMROOT = $(ROOT)/sym/i386
DSTROOT = $(ROOT)/dst/usr/standalone/i386/
DOCROOT = $(ROOT)/doc
UTILDIR = ../util
LIBSADIR = ../libsa
BOOT2DIR = ../boot2
DEFINES = -DNOTHING
#DEFINES = -DDEBUG_CPU=1 -DDEBUG_MEM=1 -DDEBUG_SPD=1 -DDEBUG_PCI=1 -DDEBUG_SMBIOS=1
CFLAGS:= $(CFLAGS) $(RC_CFLAGS) $(MORECPP) -arch i386 \
-D__ARCHITECTURE__=\"i386\" -DSAIO_INTERNAL_USER \
-DRCZ_COMPRESSED_FILE_SUPPORT \
-fno-builtin -static $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -nostdinc -include $(SRCROOT)/autoconf.h
CPPFLAGS := $(CPPFLAGS) -nostdinc++
INC = -I. -I$(SYMROOT) -I$(LIBSADIR) -I$(BOOT2DIR) -I${SRCROOT}/i386/include
SAIO_OBJS = table.o asm.o bios.o biosfn.o \
misc.o \
xml.o \
load.o\
console.o
OBJECTS = table asm bios biosfn \
misc xml load console
LIBS = libsaio.a
LIBS := $(addprefix $(SYMROOT)/, $(LIBS))
DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
DIRS_NEEDED =
include ${ROOT}/Make.rules
all: $(DIRS_NEEDED) $(LIBS)
all: $(OBJROOT) $(SYMROOT) $(LIBS)
$(LIBS): $(addprefix $(OBJROOT)/, $(SAIO_OBJS))
$(LIBS): ${ACTUAL_OBJECTS}
@echo "\t[RM] $@"
@rm -f $@
@echo "\t[AR] $(@F)"
branches/xZen/src/arch/i386/boot0/Makefile
1
2
3
4
5
6
7
8
9
1
102
11
3
4
5
6
7
128
13
9
1410
11
1512
16
17
1813
19
14
15
2016
21
17
18
19
2220
2321
2422
SRCROOT = $(shell pwd)/../../
OBJROOT = $(SRCROOT)/obj/i386/boot0
SYMROOT = $(SRCROOT)/sym/i386
DSTROOT = $(SRCROOT)/dst/i386
DOCROOT = $(SRCROOT)/doc
IMGROOT = $(SRCROOT)/sym/cache
IMGSKELROOT = $(SRCROOT)/imgskel
CDBOOT = ${IMGROOT}/usr/standalone/i386/cdboot
ROOT = $(shell pwd)/../../../../
DIR = boot0
include ${SRCROOT}/Make.rules
SRCROOT = ${ROOT}/src
OBJROOT = $(ROOT)/obj/i386/${DIR}
SYMROOT = $(ROOT)/sym/i386
DSTROOT = $(ROOT)/dst/usr/standalone/i386/
DOCROOT = $(ROOT)/doc
DIRS_NEEDED = $(SYMROOT)
include ${ROOT}/Make.rules
DIRS_NEEDED =
OBJECTS = boot0 boot0hfs boot0md chain0
OBJECTS := $(addprefix $(SYMROOT)/, $(OBJECTS))
all: $(DIRS_NEEDED) $(OBJECTS)
BOOT0_OBJS = boot0 boot0hfs boot0md chain0
BOOT0_OBJS := $(addprefix $(SYMROOT)/, $(BOOT0_OBJS))
$(OBJECTS): $(SRCROOT)/autoconf.inc
all: $(SYMROOT) $(BOOT0_OBJS)
$(BOOT0_OBJS):
@echo "\t[NASM] $(@F)"
@$(NASM) $(@F).s -o $@
branches/xZen/src/arch/i386/boot1/Makefile
1
2
3
4
5
6
7
8
9
10
11
1
122
3
4
5
6
7
138
14
9
1510
16
17
11
1812
19
20
2113
2214
2315
......
3123
3224
3325
34
26
3527
3628
37
29
3830
3931
40
41
42
43
SRCROOT = $(shell pwd)/../../
OBJROOT = $(SRCROOT)/obj/i386/boot1
SYMROOT = $(SRCROOT)/sym/i386
DSTROOT = $(SRCROOT)/dst/i386
DOCROOT = $(SRCROOT)/doc
IMGROOT = $(SRCROOT)/sym/cache
IMGSKELROOT = $(SRCROOT)/imgskel
CDBOOT = ${IMGROOT}/usr/standalone/i386/cdboot
include ${SRCROOT}/Make.rules
ROOT = $(shell pwd)/../../../../
DIR = boot1
SRCROOT = ${ROOT}/src
OBJROOT = $(ROOT)/obj/i386/${DIR}
SYMROOT = $(ROOT)/sym/i386
DSTROOT = $(ROOT)/dst/usr/standalone/i386/
DOCROOT = $(ROOT)/doc
DIRS_NEEDED = $(SYMROOT)
include ${ROOT}/Make.rules
VERS = `vers_string -f 5.0 | tr - .`
NEW_VERS = Darwin boot1h v$(VERS)
DIRS_NEEDED =
PROGRAMS = boot1hp boot1f32
ifeq (${CONFIG_BOOT1_HFS}, y)
PROGRAMS := $(addprefix $(SYMROOT)/, $(PROGRAMS))
all: $(DIRS_NEEDED) $(PROGRAMS)
all: $(SYMROOT) $(PROGRAMS)
$(PROGRAMS): $(SRCROOT)/autoconf.inc
$(PROGRAMS):
@echo "\t[NASM] $(@F)"
@$(NASM) $(@F).s -o $@
install_i386:: all $(INSTALLDIR)
cp $(SYMROOT)/boot1h $(INSTALLDIR)/
cd $(INSTALLDIR); chmod u+w $(VERSIONED_FILES)
branches/xZen/src/arch/i386/boot2/Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
1
182
19
3
4
5
6
7
208
21
22
23
24
25
9
2610
27
11
2812
29
30
31
3213
3314
34
35
15
3616
3717
3818
......
4020
4121
4222
43
44
45
46
23
4724
4825
4926
......
6441
6542
6643
67
6844
69
45
7046
71
7247
73
74
75
76
77
7848
7949
8050
......
151121
152122
153123
154
155
156
157
158
159
160
161
162
163
164
165
166124
167
168
169
170
171
172
173
174
175
176
177
178
179
180125
181126
182127
183128
184
185
186129
187130
SRCROOT = $(shell pwd)/../../
OBJROOT = $(SRCROOT)/obj/i386/boot2
SYMROOT = $(SRCROOT)/sym/i386
DSTROOT = $(SRCROOT)/dst/i386
DOCROOT = $(SRCROOT)/doc
IMGROOT = $(SRCROOT)/sym/cache
IMGSKELROOT = $(SRCROOT)/imgskel
CDBOOT = ${IMGROOT}/usr/standalone/i386/cdboot
VPATH = $(SYMROOT)
#Makefile for i386 boot program
#define FLOPPY and SMALL using DEFINES macro as necessary
PNGCRUSH = `which pngcrush`
PNGOPTIONS = -rem cHRM -rem gAMA -rem iCCP -rem sRGB
ROOT = $(shell pwd)/../../../../
DIR = boot2
include ${SRCROOT}/Make.rules
SRCROOT = ${ROOT}/src
OBJROOT = $(ROOT)/obj/i386/${DIR}
SYMROOT = $(ROOT)/sym/i386
DSTROOT = $(ROOT)/dst/usr/standalone/i386/
DOCROOT = $(ROOT)/doc
OPTIM = -Os -Oz
CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror \
-fno-builtin -DSAIO_INTERNAL_USER -static $(OMIT_FRAME_POINTER_CFLAG) \
-mpreferred-stack-boundary=2 -fno-align-functions -fno-stack-protector \
-march=pentium4 -msse2 -mfpmath=sse -msoft-float -nostdinc -include $(SRCROOT)/autoconf.h
include ${ROOT}/Make.rules
CPPFLAGS := $(CPPFLAGS) -nostdinc++ -include $(SRCROOT)/autoconf.h
OPTIM = -Oz
DEFINES=
CONFIG = hd
SYMDIR = $(SYMROOT)
LIBSADIR = ../libsa
LIBSAIODIR = ../libsaio
THEME = $(CONFIG_EMBEDED_THEME)
THEMEDIR = ../../artwork/themes/$(THEME)
INC = -I. -I$(SYMDIR) -I$(LIBSADIR) -I$(LIBSAIODIR) -I${SRCROOT}/i386/include
LIBS= -L$(SYMDIR) -lsaio -lsa
OTHER_FILES =
# The ordering is important;
# boot2.o must be first.
OBJS = boot2.o boot.o mboot.o boot_modules.o
# button.o browser.o scrollbar.o == NOTYET bmdecompress.o graphic_utils.o prompt.o options.o lzss.o
OBJECTS = boot2 boot mboot boot_modules
UTILDIR = ../util
DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
all: $(DIRS_NEEDED) boot
ifeq (${CONFIG_EMBED_THEME}, y)
boot: $(SYMROOT)/art.h $(SYMROOT)/vers.h $(SYMROOT)/embedded.h $(addprefix $(OBJROOT)/, $(OBJS)) $(addprefix $(SYMROOT)/, $(LIBDEP))
boot: $(SYMROOT)/embedded.h $(ACTUAL_OBJECTS) $(addprefix $(SYMROOT)/, $(LIBDEP))
else
boot: $(SYMROOT)/vers.h $(SYMROOT)/embedded.h $(addprefix $(OBJROOT)/, $(OBJS)) $(addprefix $(SYMROOT)/, $(LIBDEP))
endif
@${MKDIRS} $(OBJROOT)/../boot2_modules/
@echo "\t[LD] boot.sys"
@$(CC) -Wl,-segaddr,__INIT,$(BOOT2ADDR) -Wl,-segalign,20 -Wl,-preload \
@echo "\t[MACHOCONV] boot"
@$(SYMROOT)/machOconv $(SYMROOT)/boot.sys $(SYMROOT)/boot
$(SYMROOT)/art.h:
@if [ "$(PNGCRUSH)" ]; then\
echo "optimizing art files ...\n$(PNGCRUSH) $(PNGOPTIONS) artwork/$(THEME)"; \
cd $(THEMEDIR) && find . -name '*.png' -exec $(PNGCRUSH) -q $(PNGOPTIONS) -d $(SYMROOT)/embed {} \;; \
cp theme.plist $(SYMROOT)/embed; \
else \
cp -R $(THEMEDIR) $(SYMROOT)/embed; \
fi;
@echo "#ifndef __BOOT2_ART_H" >> $(SYMROOT)/art.h
@echo "#define __BOOT2_ART_H" >> $(SYMROOT)/art.h
@cd $(SYMROOT)/embed && find . -name 'theme.plist' -exec xxd -i >> $(SYMROOT)/art.h {} \;
@cd $(SYMROOT)/embed && find . -name '*.png' -exec xxd -i >> $(SYMROOT)/art.h {} \;
@echo "typedef struct {" >> $(SYMROOT)/art.h
@echo "charname[32];" >> $(SYMROOT)/art.h
@echo "unsigned char*pngdata;" >> $(SYMROOT)/art.h
@echo "unsigned int*length;" >> $(SYMROOT)/art.h
@echo "} embeddedpng_t;" >> $(SYMROOT)/art.h
@echo "" >> $(SYMROOT)/art.h
@echo "embeddedpng_t embeddedImages[] = {" >> $(SYMROOT)/art.h
@cd $(SYMROOT)/embed && find . -name '*.png' | sort | cut -f 2 -d '/' | cut -f 1 -d '.' | \
awk '{ printf "\t{.name = \"%s\", .pngdata = __%s_png, .length = &__%s_png_len},\n", $$1, $$1, $$1 }' >> $(SYMROOT)/art.h
@echo "};" >> $(SYMROOT)/art.h
@echo "#endif /* !__BOOT2_ART_H */" >> $(SYMROOT)/art.h ;\
$(SYMROOT)/embedded.h:
@cd $(SYMROOT)/../../doc && xxd -i BootHelp.txt > $(SYMROOT)/embedded.h
.PHONY: $(SYMROOT)/vers.h
#dependencies
-include $(OBJROOT)/Makedep
branches/xZen/src/arch/i386/Make.rules
33
44
55
6
7
68
79
810
9
11
1012
1113
1214
1315
1416
15
17
1618
1719
1820
1921
2022
21
23
2224
2325
2426
2527
2628
27
29
2830
2931
32
33
34
35
36
37
3038
31
39
40
3241
TARGET_CC = /usr/bin/gcc-4.2
TARGET_CPP = /usr/bin/g++-4.2
NASM = $(shell which nasm) -p $(SRCROOT)/autoconf.inc
##### i386 Rules #####
$(OBJROOT)/%.${ARCH}o: %.c $(OBJROOT)
@echo "\t[CC:I386] $<"
@$(TARGET_CC) -arch i386 $(CFLAGS) $(DEFINES) -c $(INC) $< -o $@ \
@$(TARGET_CC) -arch ${ARCH} $(CFLAGS) $(DEFINES) -c $(INC) $< -o $@ \
-MD -dependency-file $(OBJROOT)/$*.d
@md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d
$(OBJROOT)/%.${ARCH}o: %.m $(OBJROOT)
@echo "\t[M:I386] $<"
@$(TARGET_CC) -arch i386 $(CFLAGS) $(DEFINES) -c $(INC) $< -o $@ \
@$(TARGET_CC) -arch ${ARCH} $(CFLAGS) $(DEFINES) -c $(INC) $< -o $@ \
-MD -dependency-file $(OBJROOT)/$*.d
@md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d
$(OBJROOT)/%.${ARCH}o: %.cpp $(OBJROOT)
@echo "\t[CPP:I386] $<"
@$(TARGET_CPP) -arch i386 $(CPPFLAGS) $(CFLAGS) -c "$<" $(INC) -o $@ \
@$(TARGET_CPP) -arch ${ARCH} $(CPPFLAGS) $(CFLAGS) -c "$<" $(INC) -o $@ \
-MD -dependency-file $(OBJROOT)/$*.d
@md -u $(OBJROOT)/Makedep -f -d $(OBJROOT)/$*.d
$(OBJROOT)/%.${ARCH}o: %.s
@echo "\t[AS:I386] $<"
@$(TARGET_CC) $(CPPFLAGS) -c $(INC) -o $@ $< \
@$(TARGET_CC) -arch ${ARCH} $(CPPFLAGS) -c $(INC) -o $@ $< \
-MD -dependency-file $*.d
@md -u $(OBJROOT)/Makedep -f -d $*.d
$(OBJROOT)/boot2.${ARCH}o:
@echo "\t[AS:I386] boot2.s"
@$(TARGET_CC) -Wa,-n -c $(INC) -arch i386 -o $(OBJROOT)/$(@F) boot2.s \
-MD -dependency-file $*.d
@md -u $(OBJROOT)/Makedep -f -d $*.d
ACTUAL_OBJECTS = $(addsuffix .${ARCH}o , $(addprefix $(OBJROOT)/, $(OBJECTS)))
ACTUAL_OBJECTS = $(addsuffix .${ARCH}o, $(addprefix $(OBJROOT)/, $(OBJECTS)))
MODULE_OBJECTS = $(addsuffix .${ARCH}o, $(addprefix $(OBJROOT)/, $(MODULE_OBJS)))
branches/xZen/src/arch/i386/libsa/Makefile
1
1
22
33
44
5
5
66
77
88
99
1010
1111
12
13
1412
1513
1614
......
2119
2220
2321
24
22
2523
26
27
24
2825
26
27
28
2929
3030
3131
......
3434
3535
3636
37
38
39
40
41
4237
4338
ROOT = $(shell pwd)/../../../
ROOT = $(shell pwd)/../../../../
DIR = libsa
SRCROOT = ${ROOT}/src
OBJROOT = $(ROOT)/obj/i386/${DIR}
SYMROOT = $(ROOT)/sym/util
SYMROOT = $(ROOT)/sym/i386
DSTROOT = $(ROOT)/dst/usr/standalone/i386/
DOCROOT = $(ROOT)/doc
LIBSAIODIR = ../libsaio
CPPFLAGS := $(CPPFLAGS) -nostdinc++
INC = -I. -I$(SYMROOT) -I$(LIBSAIODIR) -I${SRCROOT}/include
OBJECTS = prf printf zalloc \
LIBS := $(addprefix $(SYMROOT)/, $(LIBS))
DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
DIRS_NEEDED =
all embedtheme: $(DIRS_NEEDED) $(LIBS)
$(warning $(ACTUAL_OBJECTS))
include ${ROOT}/Make.rules
all: $(OBJROOT) $(SYMROOT) $(LIBS)
$(LIBS): ${ACTUAL_OBJECTS}
@echo "\t[RM] $@"
@rm -f $@
@echo "\t[RANLIB] $(@F)"
@ranlib $@
$(DIRS_NEEDED) $(INSTALLDIR) $(OBJROOT) $(SYMROOT):
@echo "\t[MKDIR] $@"
@$(MKDIRS) $@
# dependencies
-include $(OBJROOT)/Makedep
branches/xZen/src/arch/Makefile
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
#Makefile for i386 boot program
#
# these paths are only valid in subdirectories of this directory
#
ROOT = $(shell pwd)/../../
SRCROOT = ${ROOT}/src
OBJROOT = $(ROOT)/obj/${ARCH}
SYMROOT = $(ROOT)/sym/${ARCH}
DSTROOT = $(ROOT)/dst/usr/standalone/${ARCH}
DOCROOT = $(ROOT)/doc
include ${ROOT}/Make.rules
# The order of building is important.
SUBDIRS = ${ARCH}
all: ${OBJROOT} ${SYMROOT}
@for i in ${SUBDIRS}; \
do \
echo ================= make $@ for $$i =================; \
( ROOT=$(ROOT); \
cd $$i; ${MAKE} \
$@ \
) || exit $$?; \
done

Archive Download the corresponding diff file

Revision: 1263