[439] | 1 | ############################################################################# |
---|
| 2 | # HAL Makefile for Tsar-MIPS32 # |
---|
| 3 | ############################################################################# |
---|
| 4 | |
---|
| 5 | -include ../../params-soft.mk |
---|
| 6 | ifeq ($(ARCH_NAME),) |
---|
| 7 | $(error Please define in ARCH_NAME parameter in params-soft.mk!) |
---|
| 8 | endif |
---|
| 9 | |
---|
| 10 | LIBGCC = -L$(shell $(CC) -print-libgcc-file-name | sed 's/libgcc.a//') #todo ? |
---|
| 11 | |
---|
| 12 | # Rules that don't build target files |
---|
| 13 | # always out-of-date, need to be regenerated everytime they are called |
---|
| 14 | .PHONY: compile \ |
---|
| 15 | dirs \ |
---|
| 16 | clean \ |
---|
| 17 | |
---|
| 18 | DRIVERS_OBJS = $(HAL_ARCH)/build/drivers/soclib_tty.o \ |
---|
[570] | 19 | $(HAL_ARCH)/build/drivers/soclib_mty.o \ |
---|
[439] | 20 | $(HAL_ARCH)/build/drivers/soclib_bdv.o \ |
---|
| 21 | $(HAL_ARCH)/build/drivers/soclib_hba.o \ |
---|
| 22 | $(HAL_ARCH)/build/drivers/soclib_pic.o \ |
---|
| 23 | $(HAL_ARCH)/build/drivers/soclib_nic.o \ |
---|
| 24 | $(HAL_ARCH)/build/drivers/soclib_dma.o \ |
---|
[570] | 25 | $(HAL_ARCH)/build/drivers/soclib_mmc.o \ |
---|
[439] | 26 | $(HAL_ARCH)/build/drivers/soclib_iob.o |
---|
| 27 | |
---|
| 28 | CORE_OBJS = $(HAL_ARCH)/build/core/hal_special.o \ |
---|
[440] | 29 | $(HAL_ARCH)/build/core/hal_context.o \ |
---|
| 30 | $(HAL_ARCH)/build/core/hal_atomic.o \ |
---|
| 31 | $(HAL_ARCH)/build/core/hal_remote.o \ |
---|
| 32 | $(HAL_ARCH)/build/core/hal_uspace.o \ |
---|
| 33 | $(HAL_ARCH)/build/core/hal_irqmask.o \ |
---|
| 34 | $(HAL_ARCH)/build/core/hal_gpt.o \ |
---|
| 35 | $(HAL_ARCH)/build/core/hal_ppm.o \ |
---|
| 36 | $(HAL_ARCH)/build/core/hal_vmm.o \ |
---|
| 37 | $(HAL_ARCH)/build/core/hal_exception.o \ |
---|
| 38 | $(HAL_ARCH)/build/core/hal_interrupt.o \ |
---|
| 39 | $(HAL_ARCH)/build/core/hal_syscall.o \ |
---|
| 40 | $(HAL_ARCH)/build/core/hal_drivers.o \ |
---|
| 41 | $(HAL_ARCH)/build/core/hal_kentry.o \ |
---|
| 42 | $(HAL_ARCH)/build/core/hal_switch.o \ |
---|
| 43 | $(HAL_ARCH)/build/core/hal_user.o |
---|
[439] | 44 | |
---|
[570] | 45 | HAL_INCLUDE = -I$(KERNEL) \ |
---|
| 46 | -I$(HAL_ARCH)/drivers \ |
---|
| 47 | -I$(HAL)/generic \ |
---|
| 48 | -I$(HAL_ARCH)/core \ |
---|
| 49 | -I../../tools/arch_info \ |
---|
| 50 | -I$(KERNEL)/kern \ |
---|
| 51 | -I$(KERNEL)/mm \ |
---|
| 52 | -I$(KERNEL)/fs \ |
---|
| 53 | -I$(KERNEL)/syscalls \ |
---|
| 54 | -I$(SHARED_INCLUDE) \ |
---|
| 55 | -I$(KERNEL)/devices \ |
---|
| 56 | -I$(KERNEL)/libk \ |
---|
[543] | 57 | -I../../ # for hard_config.h (needed by soclib_sdc_driver for SYS_CLK) |
---|
[439] | 58 | |
---|
[440] | 59 | ############################## |
---|
[439] | 60 | # Rule to generate .o for HAL. |
---|
| 61 | compile: dirs $(CORE_OBJS) $(DRIVERS_OBJS) |
---|
| 62 | |
---|
[440] | 63 | ######################################## |
---|
[439] | 64 | # Rule to create the build directories. |
---|
| 65 | dirs: |
---|
| 66 | @mkdir -p $(HAL_ARCH)/build |
---|
| 67 | @mkdir -p $(HAL_ARCH)/build/drivers |
---|
| 68 | @mkdir -p $(HAL_ARCH)/build/core |
---|
| 69 | |
---|
| 70 | |
---|
| 71 | ############################## |
---|
| 72 | # rules to compile the drivers |
---|
[440] | 73 | $(HAL_ARCH)/build/drivers/%.o: $(HAL_ARCH)/drivers/%.c \ |
---|
| 74 | $(HAL_ARCH)/drivers/%.h \ |
---|
| 75 | $(KERNEL)/kernel_config.h \ |
---|
[457] | 76 | $(HAL_ARCH)/core/hal_kernel_types.h |
---|
[439] | 77 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
[570] | 78 | $(DU) -D $@ > $@.txt |
---|
[439] | 79 | |
---|
| 80 | ###################################### |
---|
| 81 | # Rules to generate kernel/hal objects |
---|
[440] | 82 | $(HAL_ARCH)/build/core/%.o: $(HAL_ARCH)/core/%.c \ |
---|
| 83 | $(HAL)/generic/%.h \ |
---|
| 84 | $(KERNEL)/kernel_config.h \ |
---|
[457] | 85 | $(HAL_ARCH)/core/hal_kernel_types.h |
---|
[439] | 86 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 87 | |
---|
| 88 | $(HAL_ARCH)/build/core/hal_kentry.o: $(HAL_ARCH)/core/hal_kentry.S \ |
---|
[440] | 89 | $(HAL_ARCH)/core/hal_kentry.h \ |
---|
| 90 | $(KERNEL)/kernel_config.h \ |
---|
[457] | 91 | $(HAL_ARCH)/core/hal_kernel_types.h |
---|
[439] | 92 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 93 | |
---|
| 94 | $(HAL_ARCH)/build/core/hal_switch.o: $(HAL_ARCH)/core/hal_switch.S \ |
---|
[440] | 95 | $(HAL)/generic/hal_switch.h |
---|
[439] | 96 | $(CC) $(HAL_INCLUDE) $(CFLAGS) -c -o $@ $< |
---|
| 97 | $(DU) -D $@ > $@.txt |
---|
| 98 | |
---|
| 99 | clean: |
---|
| 100 | rm -rf $(HAL_ARCH)/build/* |
---|