DIR = boot1pxe include ../MakePaths.dir OPTIM = -Os -Oz # Define COMPILING_BOOT1PXE even when preprocessing assembler CPPFLAGS = -DCOMPILING_BOOT1PXE -DBOOT1 CFLAGS = $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror \ -DSAIO_INTERNAL_USER -DBOOT1 \ $(STANDALONE_CFLAGS) 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 # We can be up to 32k so including all of libsa is fine, unlike boot1u # However, libsaio is more than we want #LIBS= -L$(SYMDIR) -lsaio -lsa LIBS= -L$(SYMDIR) -lsa #LIBS= -L$(SYMDIR) OTHER_FILES = INSTALLDIR = $(DSTROOT)/usr/standalone/i386 VPATH = $(OBJROOT):$(SYMROOT) # Add libsaio to our source path vpath %.s ../libsaio vpath % $(SYMROOT) vpath %.c ../libsaio vpath % $(SYMROOT) vpath %.h ../libsaio vpath % $(SYMROOT) # The ordering is important; # boot1pxe.o must be first. OBJS = boot1pxe.o boot.o table.o console.o biosfn.o bios.o stack_protector.o pxe.o SFILES = boot1pxe.s asm.s bios.s # table.c from libsaio CFILES = boot.c table.c console.c biosfn.c pxe.c HFILES = OTHERFILES = Makefile DIRS_NEEDED = $(OBJROOT) $(SYMROOT) BOOT1PXE_ADDR = 7C00 #MAXBOOTSIZE = 65024 MAXBOOTSIZE = 32768 # Actually a touch less NASM = $(SYMROOT)/nasm all: $(DIRS_NEEDED) boot1pxe boot1pxe: machOconv $(OBJS) $(LIBDEP) $(LD) -static -Wl,-preload -Wl,-segaddr,__TEXT,$(BOOT1PXE_ADDR) \ -Wl,-e,boot1pxe \ -Wl,-dead_strip \ -Wl,-no_pie \ -nostdlib -arch i386 -Wl,-segalign,20 \ -o $(SYMROOT)/boot1pxe.sys $(filter %.o,$^) $(LIBS) -lcc_kext dsymutil -f $(SYMROOT)/boot1pxe.sys machOconv $(SYMROOT)/boot1pxe.sys $(SYMROOT)/boot1pxe || rm -f $(SYMROOT)/boot1pxe && test -f $(SYMROOT)/boot1pxe size $(SYMROOT)/boot1pxe.sys ls -l $(SYMROOT)/boot1pxe @( size=`ls -l $(SYMROOT)/boot1pxe | awk '{ print $$5}'` ; \ if expr "$$size" -gt "$(MAXBOOTSIZE)" > /dev/null ;\ then \ echo "Booter executable ($$size) larger than $(MAXBOOTSIZE) bytes" ;\ rm $(SYMROOT)/boot1pxe ;\ exit 1;\ fi) install_i386:: all $(INSTALLDIR) cp $(SYMROOT)/boot1pxe $(INSTALLDIR) cd $(INSTALLDIR); chmod u+w boot1pxe clean:: rm -f $(SYMROOT)/boot1pxe $(SYMROOT)/boot1pxe.sys $(SYMROOT)/boot1pxe.sys.dwarf include ../MakeInc.dir #dependencies -include $(OBJROOT)/Makedep