85bb45472bed329782a06154b711bf65177c7528
[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 ramstage-$(CONFIG_HAVE_SMI_HANDLER) += smmrelocate.S
21 ifeq ($(CONFIG_HAVE_SMI_HANDLER),y)
22 ramstage-srcs += $(obj)/cpu/x86/smm/smm_wrap
23 endif
24
25 smm-y += smmhandler.S
26 smm-y += smihandler.c
27 smm-y += smiutil.c
28
29 $(obj)/cpu/x86/smm/smm.o: $$(smm-objs)
30         $(CC) $(LDFLAGS) -nostdlib -r -o $@ $^
31
32 $(obj)/cpu/x86/smm/smm_wrap: $(obj)/cpu/x86/smm/smm.o $(src)/cpu/x86/smm/smm.ld $(obj)/ldoptions
33         $(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
34         $(NM) -n $(obj)/cpu/x86/smm/smm.elf | sort > $(obj)/cpu/x86/smm/smm.map
35         $(OBJCOPY) -O binary $(obj)/cpu/x86/smm/smm.elf $(obj)/cpu/x86/smm/smm
36
37 # change to the target path because objcopy will use the path name in its
38 # ELF symbol names.
39 $(obj)/cpu/x86/smm/smm_wrap.ramstage.o: $(obj)/cpu/x86/smm/smm_wrap
40         @printf "    OBJCOPY    $(subst $(obj)/,,$(@))\n"
41         cd $(obj)/cpu/x86/smm; $(OBJCOPY) -I binary smm -O elf32-i386 -B i386 smm_wrap.ramstage.o
42