# Note: makefile needs GNU make (/usr/local/bin/make) to work as is # location of bootfile BOOTDIR=/tftpboot # location of cross development tools TOOL_ROOT=/home/cs9242/l4/$(ARCH) TOOLBIN=$(TOOL_ROOT)/bin # the tools themselves CC=$(TOOLBIN)/mips-sgi-irix6-gcc AS=$(TOOLBIN)/mips-sgi-irix6-gcc LD=$(TOOLBIN)/mungilink DIT=$(TOOLBIN)/dit # location of l4 L4_ROOT=/home/cs9242/l4 L4_INCLUDE=$(L4_ROOT)/include L4_LIB=$(L4_ROOT)/lib L4_KERNEL=$(L4_ROOT)/kernel/kernel-serial L4_KERNEL_NOCACHING=$(L4_ROOT)/kernel/kernel-no_caching-serial L4_KERNEL_LOCAL=kernel-serial # compiler build flags LIB_DIRS=-L$(L4_LIB) CFLAGS= -mips3 -G 0 -nostdinc -I$(L4_INCLUDE) -mabi=64 -mno-abicalls LDFLAGS= -mips3 $(LIB_DIRS) # things needed to link CRT=$(L4_LIB)/crtS.o LIBS=-ll4 -lc # rules to build files .SUFFIXES: .c .S .o .S.o: $(AS) $(ASFLAGS) -c -o $*.o $*.S .c.o: $(CC) $(CFLAGS) -c $*.c IMAGE=kernel.img PROG=example1 OBJS=main.o all: $(L4_KERNEL_LOCAL) boot_image target caching: cp $(L4_KERNEL) $(L4_KERNEL_LOCAL) noncaching: cp $(L4_KERNEL_NOCACHING) $(L4_KERNEL_LOCAL) # Default is caching: get_initial_kernel: caching $(L4_KERNEL_LOCAL): $(L4_KERNEL_NOCACHING) $(L4_KERNEL) cp $(L4_KERNEL) $(L4_KERNEL_LOCAL) target: $(OBJS) $(LD) $(LDFLAGS) -Ttext `$(DIT) -l $(IMAGE)` -o $(PROG) $(CRT) $(OBJS) $(LIBS) chmod u+w $(IMAGE) $(DIT) -a $(PROG) $(IMAGE) rm -f $(BOOTDIR)/$(IMAGE) cp $(IMAGE) $(BOOTDIR) chmod a+r $(BOOTDIR)/$(IMAGE) boot_image: cp $(L4_KERNEL_LOCAL) $(IMAGE) clean: rm -f *.o $(PROG) $(IMAGE) $(L4_KERNEL_LOCAL) realclean: clean rm -f *~ *.bak depend: