# Makefile for i386 boot program # define FLOPPY and SMALL using DEFINES macro as necessary DIR = boot2 include ../MakePaths.dir 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 -mno-sse2 -mfpmath=387 DEFINES= CONFIG = hd SYMDIR = $(SYMROOT) LIBSADIR = ../libsa LIBSAIODIR = ../libsaio UTILDIR = ../util INC = -I. -I.. -I$(SYMDIR) -I$(LIBSADIR) -I$(LIBSAIODIR) -I$(UTILDIR) ifneq "" "$(wildcard /bin/mkdirs)" MKDIRS = /bin/mkdirs else MKDIRS = /bin/mkdir -p endif AS = as LD = gcc # LIBS= -lc_static LIBS= -L$(SYMDIR) -lsaio -lsa LIBDEP= $(SYMDIR)/libsaio.a $(SYMDIR)/libsa.a OTHER_FILES = INSTALLDIR = $(DSTROOT)/usr/standalone/i386 VPATH = $(OBJROOT):$(SYMROOT) # The ordering is important; # sectorder.o and boot2.o must be the first two objects. OBJS = sectorder.o boot2.o loseg_utils.o boot.o graphics.o drivers.o prompt.o options.o lzss.o mboot.o # button.o browser.o scrollbar.o == NOTYET UTILDIR = ../util SFILES = sectorder.s boot2.s CFILES = boot.c graphics.c drivers.c prompt.c options.c mboot.c HFILES = boot.h appleClut8.h appleboot.h mboot.h multiboot.h OTHERFILES = Makefile ALLSRC = $(FOREIGNSRC) $(FOREIGNBIN) $(SFILES) $(CFILES) \ $(HFILES) $(OTHERFILES) DIRS_NEEDED = $(OBJROOT) $(SYMROOT) BOOT2ADDR = 20200 # 65024 == 64k - 512 bytes which is the most the old bootsectors can load #MAXBOOTSIZE = 65024 # Now that __LOSEG is used we can get quite a bit larger. In fact, probably larger than # this limit here so long as when running the stack doesn't encroach down into the BSS. MAXBOOTSIZE = 131072 all: $(DIRS_NEEDED) boot boot: machOconv $(OBJS) $(LIBDEP) $(LD) -static -Wl,-preload -Wl,-segaddr,__LOSEG,$(BOOT2ADDR) \ -nostdlib -arch i386 -Wl,-segalign,20 \ -o $(SYMROOT)/boot.sys $(filter %.o,$^) $(LIBS) -lcc_kext machOconv $(SYMROOT)/boot.sys $(SYMROOT)/boot size $(SYMROOT)/boot.sys ls -l $(SYMROOT)/boot @( size=`ls -l $(SYMROOT)/boot | awk '{ print $$5}'` ; \ if expr "$$size" ">" "$(MAXBOOTSIZE)" > /dev/null ;\ then \ echo "Booter executable larger than $(MAXBOOTSIZE) bytes" ;\ rm $(SYMROOT)/boot ;\ exit 1;\ fi) prompt.o: vers.h vers.h: echo "#define I386BOOT_VERSION \"`vers_string -f 5.0`\"" | \ tr - . > $(SYMROOT)/vers.h install_i386:: all $(INSTALLDIR) cp $(SYMROOT)/boot $(OTHER_FILES) $(INSTALLDIR) cd $(INSTALLDIR); chmod u+w boot $(OTHER_FILES) clean:: rm -f $(SYMROOT)/boot.sys $(SYMROOT)/boot $(SYMROOT)/vers.h include ../MakeInc.dir # Build sectorder.o with the -n assembler flag so it can declare sections ordered before __TEXT,__text sectorder.o: CPPFLAGS += -Wa,-n $(OBJROOT)/sectorder.o: CPPFLAGS += -Wa,-n #dependencies -include $(OBJROOT)/Makedep