revert Make.defaults to upstream version and move my changes to a patch
[debian/elilo] / Makefile
1 #
2 #  Copyright (C) 2001-2003 Hewlett-Packard Co.
3 #       Contributed by Stephane Eranian <eranian@hpl.hp.com>
4 #       Contributed by Fenghua Yu<fenghua.yu@intel.com>
5 #       Contributed by Chandramouli Narayanan<mouli@linux.intel.com>
6 #
7 # This file is part of ELILO, the LINUX EFI boot loader.
8 #
9 #  ELILO is free software; you can redistribute it and/or modify
10 #  it under the terms of the GNU General Public License as published by
11 #  the Free Software Foundation; either version 2, or (at your option)
12 #  any later version.
13 #
14 #  ELILO is distributed in the hope that it will be useful,
15 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
16 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 #  GNU General Public License for more details.
18 #
19 #  You should have received a copy of the GNU General Public License
20 #  along with ELILO; see the file COPYING.  If not, write to the Free
21 #  Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #  02111-1307, USA.
23 #
24 # Please check out the elilo.txt for complete documentation on how
25 # to use this program.
26 #
27
28 SRCDIR = .
29
30 VPATH = $(SRCDIR)
31
32 include $(SRCDIR)/Make.defaults
33 TOPDIR = $(SRCDIR)
34
35
36 CRTOBJS       = $(EFICRT0)/crt0-efi-$(ARCH).o
37 LDSCRIPT      = $(EFICRT0)/elf_$(ARCH)_efi.lds
38
39 LDFLAGS      += -T $(LDSCRIPT) -shared -Bsymbolic -L$(EFILIB) -L$(GNUEFILIB) $(CRTOBJS)
40 LOADLIBES     = -lefi -lgnuefi $(shell $(CC) $(ARCH3264) -print-libgcc-file-name)
41 FORMAT        = efi-app-$(ARCH)
42
43 FILESYSTEM    =
44
45 ifeq ($(CONFIG_localfs),y)
46 FILESYSTEMS += glue_localfs.o
47 endif
48
49 ifeq ($(CONFIG_ext2fs),y)
50 FILESYSTEMS += glue_ext2fs.o
51 endif
52
53 ifeq ($(CONFIG_netfs),y)
54 FILESYSTEMS += glue_netfs.o
55 endif
56
57 SUBDIRS = fs choosers devschemes tools
58
59 ifeq ($(ARCH),ia64)
60 SUBDIRS += ia64
61 endif
62
63 ifeq ($(ARCH),ia32)
64 SUBDIRS += ia32
65 endif
66
67 ifeq ($(ARCH),x86_64)
68 SUBDIRS += x86_64
69 endif
70
71 FILES = elilo.o getopt.o strops.o loader.o \
72         fileops.o util.o vars.o alloc.o chooser.o  \
73         config.o initrd.o alternate.o bootparams.o \
74         gunzip.o console.o fs/fs.o \
75         choosers/choosers.o \
76         devschemes/devschemes.o \
77         $(ARCH)/sysdeps.o \
78         $(FILESYSTEMS)
79
80 TARGETS = elilo.efi
81
82 all: check_gcc $(SUBDIRS) $(TARGETS)
83
84 elilo.efi: elilo.so
85
86 elilo.so: $(FILES)
87
88 elilo.o : elilo.c
89
90 fileops.o : Make.defaults
91 chooser.o : Make.defaults
92
93 $(SUBDIRS): dummy
94         mkdir -p $@
95         $(MAKE) -C $@ -f $(SRCDIR)/../$@/Makefile SRCDIR=$(SRCDIR)/../$@ ARCH=$(ARCH)
96
97 dummy:
98
99 clean:
100         @set -e ; for d in $(SUBDIRS) ; do $(MAKE) -C $$d $@ ; done
101         rm -f $(TARGETS) *~ *.so $(FILES)
102
103 .PRECIOUS: elilo.so
104
105 #
106 # on both platforms you must use gcc 3.0 or higher 
107 #
108 check_gcc:
109 ifeq ($(GCC_VERSION),2)
110         @echo "you need to use a version of gcc >= 3.0, you are using `$(CC) --version`"
111         @exit 1
112 endif
113
114 include $(SRCDIR)/Make.rules