42413510e9e599e69714560433adf8b50941ee70
[coreboot.git] / src / cpu / x86 / smm / Makefile.inc
1 ##
2 ## This file is part of the coreboot project.
3 ##
4 ## Copyright (C) 2008-2010 coresystems GmbH
5 ##
6 ## This program is free software; you can redistribute it and/or modify
7 ## it under the terms of the GNU General Public License as published by
8 ## the Free Software Foundation; version 2 of the License.
9 ##
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 ## GNU General Public License for more details.
14 ##
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; if not, write to the Free Software
17 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
18 ##
19
20 obj-$(CONFIG_HAVE_SMI_HANDLER) += smmrelocate.o
21 obj-$(CONFIG_HAVE_SMI_HANDLER) += smm_wrap.o
22
23 smmobj-y += smmhandler.o
24 smmobj-y += smihandler.o
25 smmobj-y += smiutil.o
26
27 $(obj)/cpu/x86/smm/smm.o: $$(smmobjs)
28         $(CC) $(LDFLAGS) -nostdlib -r -o $@ $^
29
30 $(obj)/cpu/x86/smm/smm: $(obj)/cpu/x86/smm/smm.o $(src)/cpu/x86/smm/smm.ld $(obj)/ldoptions
31         $(CC) $(LDFLAGS) -nostdlib -nostartfiles -static -o $(obj)/cpu/x86/smm/smm.elf -T $(src)/cpu/x86/smm/smm.ld $(obj)/cpu/x86/smm/smm.o
32         $(NM) -n $(obj)/cpu/x86/smm/smm.elf | sort > $(obj)/cpu/x86/smm/smm.map
33         $(OBJCOPY) -O binary $(obj)/cpu/x86/smm/smm.elf $(obj)/cpu/x86/smm/smm
34
35 # change to the target path because objcopy will use the path name in its
36 # ELF symbol names.
37 $(obj)/cpu/x86/smm/smm_wrap.o: $(obj)/cpu/x86/smm/smm
38         @printf "    OBJCOPY    $(subst $(obj)/,,$(@))\n"
39         cd $(obj)/cpu/x86/smm; $(OBJCOPY) -I binary smm -O elf32-i386 -B i386 smm_wrap.o
40