2 include ../MakePaths.dir
5 # these paths are only valid in subdirectories of this directory
7 OBJROOT=../../obj/i386/boot1u
13 CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror \
14 -fno-builtin -DSAIO_INTERNAL_USER -static \
15 -fomit-frame-pointer -mpreferred-stack-boundary=2 \
21 LIBSAIODIR = ../libsaio
23 INC = -I. -I.. -I$(SYMDIR) -I$(LIBSADIR) -I$(LIBSAIODIR) -I$(UTILDIR)
24 ifneq "" "$(wildcard /bin/mkdirs)"
27 MKDIRS = /bin/mkdir -p
31 LIBS= -L$(SYMDIR) -lsaio -lsa
36 INSTALLDIR = $(DSTROOT)/usr/standalone/i386
37 VPATH = $(OBJROOT):$(SYMROOT)
39 # The ordering is important;
40 # boot1u.o must be first.
41 #OBJS = $(OBJROOT)/boot1u.o $(OBJROOT)/asm.o $(OBJROOT)/bios.o $(OBJROOT)/boot.o $(OBJROOT)/string.o $(OBJROOT)/malloc.o $(OBJROOT)/disk.o $(OBJROOT)/put.o
42 OBJS = boot1u.o asm.o bios.o boot.o string.o malloc.o disk.o put.o
44 # OBJS += $(OBJROOT)/../libsaio/ufs.o \
45 # $(OBJROOT)/../libsaio/cache.o \
46 # $(OBJROOT)/../libsaio/ufs_byteorder.o \
47 # $(OBJROOT)/../libsaio/table.o \
48 # $(OBJROOT)/../libsaio/misc.o
50 # OBJS += $(OBJROOT)/../libsa/prf.o $(OBJROOT)/../libsa/printf.o
52 # We get the following object files out of libsaio:
53 # ufs.o cache.o ufs_byteorder.o table.o
54 # and these from libsa:
56 # If they increase in size, or if other accidental dependencies
57 # are created with other .o files in libsaio.a, then boot1u can get too large.
58 # Use care in changing the library.
61 SFILES = boot1u.s bios.s asm.s
62 CFILES = boot.c disk.c string.c put.c malloc.c
65 ALLSRC = $(FOREIGNSRC) $(FOREIGNBIN) $(SFILES) $(CFILES) \
66 $(HFILES) $(OTHERFILES)
67 DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
70 NASM = $(SYMROOT)/nasm
72 all: $(DIRS_NEEDED) boot1u0 boot1u
74 boot1u0: boot1u0.s Makefile $(NASM)
75 $(NASM) boot1u0.s -o $(SYMROOT)/$@
77 boot1u: $(SYMROOT)/machOconv $(OBJS) boot1u0
78 $(LD) -static -preload -segaddr __TEXT $(BOOT1UADDR) -segalign 20 \
79 -o $(SYMROOT)/boot1u.sys $(OBJS) $(LIBS) -lcc_kext
80 size $(SYMROOT)/boot1u.sys
81 $(SYMROOT)/machOconv $(SYMROOT)/boot1u.sys $(SYMROOT)/boot1u.post
82 ls -l $(SYMROOT)/boot1u.post
83 @( size=`ls -l $(SYMROOT)/boot1u.post | awk '{ print $$5}'` ; \
84 if expr "$$size" ">" "$(MAXBOOTSIZE)" > /dev/null ;\
86 echo "Booter executable larger than $(MAXBOOTSIZE) bytes" ;\
89 cat $(SYMROOT)/boot1u0 $(SYMROOT)/boot1u.post | dd obs=8k conv=osync of=$(SYMROOT)/boot1u
90 rm $(SYMROOT)/boot1u.post
93 install_i386:: all $(INSTALLDIR)
94 cp $(SYMROOT)/boot1u $(OTHER_FILES) $(INSTALLDIR)
95 cd $(INSTALLDIR); chmod u+w boot1u $(OTHER_FILES)
98 rm -f $(SYMROOT)/boot1u.sys $(SYMROOT)/boot1u
100 include ../MakeInc.dir
103 -include $(OBJROOT)/Makedep