Kernel/x86 - Added USE_ACPICA makefile variable to easily enable/disable
[tpg/acess2.git] / KernelLand / Kernel / Makefile
index 7562079..d39e5a3 100644 (file)
@@ -29,6 +29,7 @@ CFLAGS        += -Wall -fno-stack-protector -Wstrict-prototypes -std=gnu99 -g
 CFLAGS         += -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -Wuninitialized
 CFLAGS          += -O3
 LDFLAGS                += -T arch/$(ARCHDIR)/link.ld -g
+LIBGCC_PATH     := $(shell $(CC) -print-libgcc-file-name)
 
 ifeq ($(PLATFORM),default)
        OBJDIR := obj-$(ARCH)/
@@ -56,7 +57,7 @@ OBJ += heap.o logging.o debug.o lib.o libc.o adt.o time.o
 OBJ += drvutil_video.o drvutil_disk.o
 OBJ += messages.o modules.o syscalls.o system.o
 OBJ += threads.o mutex.o semaphore.o workqueue.o events.o rwlock.o
-OBJ += drv/zero-one.o drv/proc.o drv/fifo.o drv/iocache.o drv/pci.o
+OBJ += drv/zero-one.o drv/proc.o drv/fifo.o drv/iocache.o drv/pci.o drv/vpci.o
 OBJ += drv/vterm.o drv/vterm_font.o drv/vterm_vt100.o drv/vterm_output.o drv/vterm_input.o drv/vterm_termbuf.o
 OBJ += binary.o bin/elf.o bin/pe.o
 OBJ += vfs/main.o vfs/open.o vfs/acls.o vfs/dir.o vfs/io.o vfs/mount.o
@@ -84,6 +85,10 @@ clean:
        @$(RM) $(BIN) ../Acess2.$(ARCH).gz $(BIN).dsm ../Map.$(ARCH).txt LineCounts.$(ARCH).txt
        @$(RM) -r $(OBJDIR) $(OBJ) $(DEPFILES) $(BUILDINFO_SRC)
 
+# Lower to avoid taking default target from 'all'
+-include $(addprefix ../../Externals/,$(addsuffix /Makefile.kinc, $(EXTERNS)))
+
+
 # Creates a stripped and compressed copy of the kernel
 # and installs it to the target
 install: $(BIN) 
@@ -96,18 +101,16 @@ apidoc:
 # Output binary
 # - Links kernel
 # - Disassembles it
-# - Gets a line count
 # - Increments the build count
 # - Does whatever architecture defined rules
-$(BIN): $(OBJ) $(MODS) arch/$(ARCHDIR)/link.ld Makefile ../../BuildConf/$(ARCH)/Makefile.cfg ../../BuildConf/$(ARCH)/$(PLATFORM).mk
+$(BIN): $(EXTERN_OBJS) $(OBJ) $(MODS) arch/$(ARCHDIR)/link.ld Makefile ../../BuildConf/$(ARCH)/Makefile.cfg ../../BuildConf/$(ARCH)/$(PLATFORM).mk
        @echo --- LD -o $(BIN)
-       @$(LD) $(LDFLAGS) -o $(BIN) $(OBJ) $(MODS) --defsym __buildnum=$$(( $(BUILD_NUM) + 1 )) -Map ../Map.$(ARCH).txt
+       @$(LD) $(LDFLAGS) -o $(BIN) $(OBJ) $(MODS) $(EXTERN_OBJS) $(LIBGCC_PATH) --defsym __buildnum=$$(( $(BUILD_NUM) + 1 )) -Map ../Map.$(ARCH).txt
        @$(DISASM) -S $(BIN) > $(BIN).dsm
-       @wc -l $(SRCFILES) include/*.h > LineCounts.$(ARCH).txt
        @echo BUILD_NUM = $$(( $(BUILD_NUM) + 1 )) > Makefile.BuildNum.$(ARCH)
        $(POSTBUILD)
        @cp $(BIN) $(BIN)_
-       @$(STRIP) $(BIN)_
+       @$(STRIP) $(BIN)_ || true
        @gzip -c $(BIN)_ > $(GZBIN)
        @$(RM) $(BIN)_
 
@@ -135,14 +138,18 @@ $(OBJDIR)%.o$(OBJSUFFIX): %.c Makefile
 include/syscalls.h include/syscalls.inc.asm:   syscalls.lst Makefile GenSyscalls.pl
        perl GenSyscalls.pl
 
-# Rules based on the makefile
-Makefile:      ../../Makefile.cfg arch/$(ARCHDIR)/Makefile
+# Differences for the makefile
+Makefile:      ../../Makefile.cfg ../../BuildConf/$(ARCH)/Makefile.cfg ../../BuildConf/$(ARCH)/$(PLATFORM).mk arch/$(ARCHDIR)/Makefile
 
 # Build-time information (git hash and build number)
 $(BUILDINFO_SRC): $(filter-out $(BUILDINFO_OBJ), $(OBJ)) $(MODS) arch/$(ARCHDIR)/link.ld Makefile
+       $(eval _GITHASH=$(shell git log -n 1 | head -n 1 | awk '{print $$2}'))
+       $(eval _GITCHANGED=$(shell git status --porcelain | grep -c '^ M '))
        @echo "#include <acess.h>" > $@
-       @echo "const char gsGitHash[] = \""`git log -n 1 | head -n 1 | awk '{print $$2}'`"\";" >> $@
+       @echo "const char gsGitHash[] = \"$(_GITHASH)\";" >> $@
        @echo "const int giBuildNumber = $(BUILD_NUM);" >> $@
+       @echo "const char gsBuildInfo[] = \"Acess2 v$(KERNEL_VERSION) $(ARCH)-$(PLATFORM)\\\\r\\\\n\"" >> $@
+       @echo "                           \"Build $(shell hostname --fqdn):$(BUILD_NUM) Git $(_GITHASH) - $(_GITCHANGED) modified\";" >> $@
 # Compile rule for buildinfo (needs a special one because it's not a general source file)
 $(BUILDINFO_OBJ): $(BUILDINFO_SRC)
        @echo --- CC -o $@
@@ -151,4 +158,3 @@ $(BUILDINFO_OBJ): $(BUILDINFO_SRC)
 # Dependency Files
 -include $(DEPFILES)
 
-%.h:

UCC git Repository :: git.ucc.asn.au