blob: d85d52fc7d349b65349a219add712ce509a8d262 [file] [log] [blame]
Roland McGrathe47ab762005-11-17 03:16:00 +00001## Process this file with automake to create Makefile.in
2##
Roland McGrath5f38a2c2006-01-12 03:08:35 +00003## Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc.
Roland McGrathe47ab762005-11-17 03:16:00 +00004##
5## This program is Open Source software; you can redistribute it and/or
6## modify it under the terms of the Open Software License version 1.0 as
7## published by the Open Source Initiative.
8##
9## You should have received a copy of the Open Software License along
10## with this program; if not, you may obtain a copy of the Open Software
11## License version 1.0 from http://www.opensource.org/licenses/osl.php or
12## by writing the Open Source Initiative c/o Lawrence Rosen, Esq.,
13## 3001 King Ranch Road, Ukiah, CA 95482.
14##
15DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DOBJDIR=\"$(shell pwd)\"
16if MUDFLAP
17AM_CFLAGS = -fmudflap
18else
19AM_CFLAGS =
20endif
21AM_CFLAGS += -fpic -Wall -Wshadow -Werror -Wunused -Wextra -Wformat=2 \
22 -std=gnu99
23INCLUDES = -I$(srcdir) -I$(top_srcdir)/libebl \
24 -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw \
25 -I$(top_srcdir)/lib -I..
26PACKAGE_VERSION = @PACKAGE_VERSION@
27
28
29modules = i386 sh x86_64 ia64 alpha arm sparc ppc ppc64 s390
30libebl_pic = libebl_i386_pic.a libebl_sh_pic.a libebl_x86_64_pic.a \
31 libebl_ia64_pic.a libebl_alpha_pic.a libebl_arm_pic.a \
32 libebl_sparc_pic.a libebl_ppc_pic.a libebl_ppc64_pic.a \
33 libebl_s390_pic.a
34noinst_LIBRARIES = $(libebl_pic)
35noinst_DATA = $(libebl_pic:_pic.a=.so)
36
37
38if MUDFLAP
39libelf = ../libelf/libelf.a
40libdw = ../libdw/libdw.a
41libmudflap = -lmudflap
42else
43libelf = ../libelf/libelf.so
44libdw = ../libdw/libdw.so
45libmudflap =
46endif
47
48
49textrel_check = if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
50
51libebl_%.so: libebl_%_pic.a libebl_%.map $(libelf) $(libdw)
52 $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
53 -Wl,--version-script,$(word 2,$^) \
54 -Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw) $(libmudflap)
55 $(textrel_check)
56
57libebl_%.map: Makefile
58 echo 'ELFUTILS_$(PACKAGE_VERSION) { global: $*_init; local: *; };' > $@
59
60
Roland McGrath994b4892005-12-05 22:46:21 +000061i386_SRCS = i386_init.c i386_symbol.c i386_corenote.c \
62 i386_retval.c i386_regs.c
Roland McGrathe47ab762005-11-17 03:16:00 +000063libebl_i386_pic_a_SOURCES = $(i386_SRCS)
64am_libebl_i386_pic_a_OBJECTS = $(i386_SRCS:.c=.os)
65
66sh_SRCS = sh_init.c sh_symbol.c
67libebl_sh_pic_a_SOURCES = $(sh_SRCS)
68am_libebl_sh_pic_a_OBJECTS = $(sh_SRCS:.c=.os)
69
Roland McGrath994b4892005-12-05 22:46:21 +000070x86_64_SRCS = x86_64_init.c x86_64_symbol.c x86_64_corenote.c \
71 x86_64_retval.c x86_64_regs.c
Roland McGrathe47ab762005-11-17 03:16:00 +000072libebl_x86_64_pic_a_SOURCES = $(x86_64_SRCS)
73am_libebl_x86_64_pic_a_OBJECTS = $(x86_64_SRCS:.c=.os)
74
75ia64_SRCS = ia64_init.c ia64_symbol.c
76libebl_ia64_pic_a_SOURCES = $(ia64_SRCS)
77am_libebl_ia64_pic_a_OBJECTS = $(ia64_SRCS:.c=.os)
78
79alpha_SRCS = alpha_init.c alpha_symbol.c alpha_retval.c
80libebl_alpha_pic_a_SOURCES = $(alpha_SRCS)
81am_libebl_alpha_pic_a_OBJECTS = $(alpha_SRCS:.c=.os)
82
83arm_SRCS = arm_init.c arm_symbol.c
84libebl_arm_pic_a_SOURCES = $(arm_SRCS)
85am_libebl_arm_pic_a_OBJECTS = $(arm_SRCS:.c=.os)
86
Roland McGrath994b4892005-12-05 22:46:21 +000087sparc_SRCS = sparc_init.c sparc_symbol.c sparc_regs.c
Roland McGrathe47ab762005-11-17 03:16:00 +000088libebl_sparc_pic_a_SOURCES = $(sparc_SRCS)
89am_libebl_sparc_pic_a_OBJECTS = $(sparc_SRCS:.c=.os)
90
Roland McGrath994b4892005-12-05 22:46:21 +000091ppc_SRCS = ppc_init.c ppc_symbol.c ppc_retval.c ppc_regs.c
Roland McGrathe47ab762005-11-17 03:16:00 +000092libebl_ppc_pic_a_SOURCES = $(ppc_SRCS)
93am_libebl_ppc_pic_a_OBJECTS = $(ppc_SRCS:.c=.os)
94
Roland McGrath994b4892005-12-05 22:46:21 +000095ppc64_SRCS = ppc64_init.c ppc64_symbol.c ppc64_retval.c ppc_regs.c
Roland McGrathe47ab762005-11-17 03:16:00 +000096libebl_ppc64_pic_a_SOURCES = $(ppc64_SRCS)
97am_libebl_ppc64_pic_a_OBJECTS = $(ppc64_SRCS:.c=.os)
98
Roland McGrath321327a2006-01-13 00:51:21 +000099s390_SRCS = s390_init.c s390_symbol.c s390_regs.c s390_retval.c
Roland McGrathe47ab762005-11-17 03:16:00 +0000100libebl_s390_pic_a_SOURCES = $(s390_SRCS)
101am_libebl_s390_pic_a_OBJECTS = $(s390_SRCS:.c=.os)
102
103
104%.os: %.c %.o
105 if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
106 -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \
107 then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \
108 rm -f "$(DEPDIR)/$*.Tpo"; \
109 else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
110 fi
111
112install: install-am install-ebl-modules
113install-ebl-modules:
114 $(mkinstalldirs) $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)
115 for m in $(modules); do \
116 $(INSTALL_PROGRAM) libebl_$${m}.so $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}-$(PACKAGE_VERSION).so; \
117 ln -fs libebl_$${m}-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}.so; \
118 done
119
120uninstall: uninstall-am
121 for m in $(modules); do \
122 rm -f $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}-$(PACKAGE_VERSION).so; \
123 rm -f $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}.so; \
124 done
125 rmdir --ignore-fail-on-non-empty $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)
Roland McGrathe47ab762005-11-17 03:16:00 +0000126
127noinst_HEADERS = libebl_CPU.h common-reloc.c
128EXTRA_DIST = $(foreach m,$(modules),$($(m)_SRCS)) $(modules:=_reloc.def)
129
130CLEANFILES = *.gcno *.gcda \
Roland McGrath3dca43b2005-11-18 02:30:43 +0000131 $(foreach m,$(modules),\
132 libebl_$(m).so $(am_libebl_$(m)_pic_a_OBJECTS))