Jordan Crouse | 7249f79 | 2008-03-20 00:11:05 +0000 | [diff] [blame] | 1 | ## |
| 2 | ## This file is part of the coreinfo project. |
| 3 | ## |
| 4 | ## Copyright (C) 2008 Advanced Micro Devices, Inc. |
Uwe Hermann | 2216d1b | 2008-03-24 15:47:49 +0000 | [diff] [blame] | 5 | ## Copyright (C) 2008 Uwe Hermann <uwe@hermann-uwe.de> |
Jordan Crouse | 7249f79 | 2008-03-20 00:11:05 +0000 | [diff] [blame] | 6 | ## |
| 7 | ## This program is free software; you can redistribute it and/or modify |
| 8 | ## it under the terms of the GNU General Public License as published by |
| 9 | ## the Free Software Foundation; version 2 of the License. |
| 10 | ## |
| 11 | ## This program is distributed in the hope that it will be useful, |
| 12 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | ## GNU General Public License for more details. |
| 15 | ## |
| 16 | ## You should have received a copy of the GNU General Public License |
| 17 | ## along with this program; if not, write to the Free Software |
| 18 | ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | ## |
| 20 | |
Uwe Hermann | 2216d1b | 2008-03-24 15:47:49 +0000 | [diff] [blame] | 21 | export src := $(shell pwd) |
| 22 | export srctree := $(src) |
| 23 | export srck := $(src)/util/kconfig |
| 24 | export obj := $(src)/build |
| 25 | export objk := $(src)/build/util/kconfig |
| 26 | |
| 27 | export KERNELVERSION := 0.1.0 |
| 28 | export KCONFIG_AUTOHEADER := $(obj)/config.h |
| 29 | export KCONFIG_AUTOCONFIG := $(obj)/auto.conf |
| 30 | |
| 31 | CONFIG_SHELL := sh |
| 32 | KBUILD_DEFCONFIG := configs/defconfig |
| 33 | UNAME_RELEASE := $(shell uname -r) |
| 34 | HAVE_DOTCONFIG := $(wildcard .config) |
| 35 | MAKEFLAGS += -rR --no-print-directory |
| 36 | |
| 37 | # Make is silent per default, but 'make V=1' will show all compiler calls. |
| 38 | ifneq ($(V),1) |
| 39 | Q := @ |
| 40 | endif |
| 41 | |
| 42 | HOSTCC = gcc |
| 43 | HOSTCXX = g++ |
| 44 | HOSTCFLAGS := -I$(srck) -I$(objk) |
| 45 | HOSTCXXFLAGS := -I$(srck) -I$(objk) |
| 46 | |
Jordan Crouse | 1cb92bc | 2008-04-10 00:05:41 +0000 | [diff] [blame] | 47 | LIBPAYLOAD_DIR := ../libpayload |
Stefan Reinauer | c359124 | 2008-08-07 15:22:01 +0000 | [diff] [blame] | 48 | XCC := CC=$(CC) $(LIBPAYLOAD_DIR)/bin/lpgcc |
Jordan Crouse | 1cb92bc | 2008-04-10 00:05:41 +0000 | [diff] [blame] | 49 | AS = $(LIBPAYLOAD_DIR)/bin/lpas |
Stefan Reinauer | c359124 | 2008-08-07 15:22:01 +0000 | [diff] [blame] | 50 | STRIP ?= strip |
Jordan Crouse | 1cb92bc | 2008-04-10 00:05:41 +0000 | [diff] [blame] | 51 | |
| 52 | INCLUDES = -Ibuild |
| 53 | CFLAGS := -Wall -Werror -Os $(INCLUDES) |
Uwe Hermann | ab5b3e0 | 2008-03-31 20:30:18 +0000 | [diff] [blame] | 54 | OBJECTS = cpuinfo_module.o cpuid.S.o pci_module.o coreboot_module.o \ |
Uwe Hermann | 2fbbb29 | 2008-07-08 16:18:38 +0000 | [diff] [blame] | 55 | nvram_module.o bootlog_module.o ramdump_module.o lar_module.o \ |
Jordan Crouse | 5cb4d9d | 2008-11-11 19:53:42 +0000 | [diff] [blame] | 56 | multiboot_module.o coreinfo.o |
Uwe Hermann | ab5b3e0 | 2008-03-31 20:30:18 +0000 | [diff] [blame] | 57 | OBJS = $(patsubst %,$(obj)/%,$(OBJECTS)) |
Uwe Hermann | 2216d1b | 2008-03-24 15:47:49 +0000 | [diff] [blame] | 58 | TARGET = $(obj)/coreinfo.elf |
| 59 | |
| 60 | ifeq ($(strip $(HAVE_DOTCONFIG)),) |
| 61 | |
Uwe Hermann | c758227 | 2008-04-03 22:20:35 +0000 | [diff] [blame] | 62 | all: config |
Uwe Hermann | 2216d1b | 2008-03-24 15:47:49 +0000 | [diff] [blame] | 63 | |
| 64 | else |
| 65 | |
| 66 | include $(src)/.config |
Jordan Crouse | 7249f79 | 2008-03-20 00:11:05 +0000 | [diff] [blame] | 67 | |
Robert Millan | c1f404f | 2008-11-11 23:41:08 +0000 | [diff] [blame] | 68 | all: $(TARGET) |
Jordan Crouse | 7249f79 | 2008-03-20 00:11:05 +0000 | [diff] [blame] | 69 | |
Robert Millan | c1f404f | 2008-11-11 23:41:08 +0000 | [diff] [blame] | 70 | $(TARGET): $(src)/.config $(OBJS) prepare |
Uwe Hermann | 2216d1b | 2008-03-24 15:47:49 +0000 | [diff] [blame] | 71 | $(Q)printf " LD $(subst $(shell pwd)/,,$(@))\n" |
Stefan Reinauer | c359124 | 2008-08-07 15:22:01 +0000 | [diff] [blame] | 72 | $(Q)$(XCC) -o $@ $(OBJS) |
Uwe Hermann | 2216d1b | 2008-03-24 15:47:49 +0000 | [diff] [blame] | 73 | $(Q)printf " STRIP $(subst $(shell pwd)/,,$(@))\n" |
Stefan Reinauer | c359124 | 2008-08-07 15:22:01 +0000 | [diff] [blame] | 74 | $(Q)$(STRIP) -s $@ |
Uwe Hermann | 2216d1b | 2008-03-24 15:47:49 +0000 | [diff] [blame] | 75 | |
| 76 | $(obj)/%.S.o: $(src)/%.S |
| 77 | $(Q)printf " AS $(subst $(shell pwd)/,,$(@))\n" |
Jordan Crouse | 1cb92bc | 2008-04-10 00:05:41 +0000 | [diff] [blame] | 78 | $(Q)$(AS) -o $@ $< |
Uwe Hermann | 2216d1b | 2008-03-24 15:47:49 +0000 | [diff] [blame] | 79 | |
| 80 | $(obj)/%.o: $(src)/%.c |
| 81 | $(Q)printf " CC $(subst $(shell pwd)/,,$(@))\n" |
Stefan Reinauer | c359124 | 2008-08-07 15:22:01 +0000 | [diff] [blame] | 82 | $(Q)$(XCC) $(CFLAGS) -c -o $@ $< |
Uwe Hermann | 2216d1b | 2008-03-24 15:47:49 +0000 | [diff] [blame] | 83 | |
| 84 | endif |
| 85 | |
| 86 | prepare: |
| 87 | $(Q)mkdir -p $(obj)/util/kconfig/lxdialog |
| 88 | |
Jordan Crouse | 7249f79 | 2008-03-20 00:11:05 +0000 | [diff] [blame] | 89 | clean: |
Uwe Hermann | 134aaae | 2008-05-11 15:51:31 +0000 | [diff] [blame] | 90 | $(Q)rm -rf build/*.elf build/*.o |
Jordan Crouse | 7249f79 | 2008-03-20 00:11:05 +0000 | [diff] [blame] | 91 | |
Uwe Hermann | 2216d1b | 2008-03-24 15:47:49 +0000 | [diff] [blame] | 92 | distclean: clean |
Uwe Hermann | c758227 | 2008-04-03 22:20:35 +0000 | [diff] [blame] | 93 | $(Q)rm -rf build |
Uwe Hermann | 2216d1b | 2008-03-24 15:47:49 +0000 | [diff] [blame] | 94 | $(Q)rm -f .config .config.old ..config.tmp .kconfig.d .tmpconfig* |
Jordan Crouse | 7249f79 | 2008-03-20 00:11:05 +0000 | [diff] [blame] | 95 | |
Uwe Hermann | 2216d1b | 2008-03-24 15:47:49 +0000 | [diff] [blame] | 96 | include util/kconfig/Makefile |
Jordan Crouse | 7249f79 | 2008-03-20 00:11:05 +0000 | [diff] [blame] | 97 | |
Uwe Hermann | 2216d1b | 2008-03-24 15:47:49 +0000 | [diff] [blame] | 98 | .PHONY: $(PHONY) prepare clean distclean |
| 99 | |