3 # NOTE: Does some voodoo to allow differing architecture builds to co-exist
4 # - The built objects and dependency files are suffixed with the arch name
5 # - The final binary is Acess2.<ARCH>.bin
7 -include ../Makefile.cfg
9 -include arch/$(ARCHDIR)/Makefile
11 -include Makefile.BuildNum.$(ARCH)
17 CPPFLAGS += -I./include -I./arch/$(ARCHDIR)/include -D_MODULE_NAME_=\"Kernel\"
18 CPPFLAGS += -DARCH=$(ARCH) -DARCHDIR=$(ARCHDIR) -DKERNEL_VERSION=$(KERNEL_VERSION) -DBUILD_NUM=$(BUILD_NUM)
19 CFLAGS += -Wall -Werror -fno-stack-protector -fno-builtin -Wstrict-prototypes -g
20 CFLAGS += -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -Wuninitialized
21 ASFLAGS += -D ARCH=\"$(ARCH)\" -D ARCHDIR=\"$(ARCHDIR)\"
22 LDFLAGS += -T arch/$(ARCHDIR)/link.ld -g
24 ifeq ($(DEBUG_BUILD),yes)
29 OBJ := $(addprefix arch/$(ARCHDIR)/,$(A_OBJ))
30 OBJ += heap.o drvutil.o logging.o debug.o lib.o adt.o time.o
31 OBJ += messages.o modules.o syscalls.o system.o threads.o
32 OBJ += $(addprefix vfs/fs/, $(addsuffix .o,$(FILESYSTEMS)))
33 OBJ += drv/kb.o drv/vterm.o drv/proc.o drv/fifo.o drv/iocache.o drv/dma.o drv/pci.o drv/vga.o
34 OBJ += binary.o bin/elf.o bin/pe.o
35 OBJ += vfs/main.o vfs/open.o vfs/acls.o vfs/dir.o vfs/io.o vfs/mount.o vfs/memfile.o vfs/nodecache.o vfs/handle.o
36 OBJ += vfs/fs/root.o vfs/fs/devfs.o
37 OBJ += $(addprefix drv/, $(addsuffix .o,$(DRIVERS)))
38 OBJ := $(addsuffix .$(ARCH), $(OBJ))
39 MODS += $(addprefix ../Modules/, $(addsuffix .xo.$(ARCH),$(MODULES)))
40 BIN = ../Acess2.$(ARCH).bin
41 GZBIN = ../Acess2.$(ARCH).gz
43 DEPFILES = $(filter %.o.$(ARCH),$(OBJ))
44 DEPFILES := $(DEPFILES:%.o.$(ARCH)=%.d.$(ARCH))
46 SRCFILES = $(OBJ:%.o.$(ARCH)=%.c)
47 SRCFILES := $(SRCFILES:%.ao.$(ARCH)=%.asm)
49 .PHONY: all clean install apidoc
54 @$(RM) $(BIN) ../Acess2.$(ARCH).gz $(BIN).dsm ../Map.$(ARCH).txt LineCounts.$(ARCH).txt $(OBJ) $(DEPFILES)
57 gzip -c $(BIN) > ../Acess2.$(ARCH).gz
58 $(xCP) ../Acess2.$(ARCH).gz $(DISTROOT)
63 $(BIN): $(OBJ) $(MODS) arch/$(ARCHDIR)/link.ld Makefile
64 @echo --- LD -o $(BIN)
65 @$(LD) $(LDFLAGS) -o $(BIN) $(OBJ) $(MODS) -Map ../Map.$(ARCH).txt
66 $(DISASM) -S $(BIN) > $(BIN).dsm
67 @wc -l $(SRCFILES) include/*.h > LineCounts.$(ARCH).txt
68 @echo BUILD_NUM = $$(( $(BUILD_NUM) + 1 )) > Makefile.BuildNum.$(ARCH)
72 %.ao.$(ARCH): %.asm Makefile
74 @$(AS) $(ASFLAGS) $< -o $@
76 %.o.$(ARCH): %.c Makefile
77 # if exists %*/Makefile
81 @$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
82 @$(MAKEDEP) $(CPPFLAGS) -MT $@ -o $*.d.$(ARCH) $<
88 include/syscalls.h: syscalls.lst Makefile
91 Makefile: ../Makefile.cfg arch/$(ARCHDIR)/Makefile
93 drv/proc.o.%: Makefile.BuildNum