Fix usage of INSTALLROOT, PREFIX, and LIBDIR.

Honor PREFIX and LIBDIR correctly when passed in during the build.
Add more machine type defines.

Add machine type defines for i386, arm/thumb, ia64, ebc, and x86_64.
Add %.S and %.E rules to make debugging easier.
Add "modelist" test app.

This lists video modes the GOP driver is showing us.
Add the "route80h.efi" test program.

This is a test program for PciIo.  It routes ioport 80h on ICH10 to PCI.
This is also useful on a very limited set of hardware to enable use of
a port 80h debug card.
Fix GNUC definitions that depend on __STDC_VERSION__ and move to C11.

__STDC_VERSION__ never actually gets defined unless there's a --std=...
line.  So we were accidentally defining lots of c99 types ourself.
Since it's 2012, use --std=c11 where appropriate, and if it's defined
and we're using gcc, actually include gcc's stdint definitions.

Signed-off-by: Peter Jones <pjones@redhat.com>
Add efi_va_* macros.

These macros will allow implementation of EFIAPI functions such as
InstallMultiple to use the correct varargs implementations without
hitting rhbz#871889 .

They will automatically choose the correct implementation for your
platform - only x86_64 gcc will do anything strange at all.

So from here on out the rules are thus:

1) if you have an EFIAPI function that needs va_list, use efi_va_list,
   efi_va_copy, etc.
2) if you have a variadic function that calls an EFIAPI function that
   uses va_list, va_start, va_copy, or va_end, use efi_ versions of
   those, and make your variadic function EFIAPI.

Signed-off-by: Peter Jones <pjones@redhat.com>
Also fix stdint-gcc.h inclusion on ia32 and ia64.

Signed-off-by: Peter Jones <pjones@redhat.com>
Apparently some toolchains don't give us ElfW(), and we don't need it.

Since reloc_ia32.c and reloc_x86_64.c never get built in a way where we
need to tell them which word-size they're for, we don't really need the
wordsize macros.

This helps to do builds on VxWorks and FreeBSD.

Signed-off-by: Peter Jones <pjones@redhat.com>
Don't randomly re-define a bunch of standard things.

We don't need our own type declarations (twice!) in our elf relocators.
So try to do things a bit more standard, and also try to pull in the
typers from the ansi-C locations.

Signed-off-by: Peter Jones <pjones@redhat.com>
Revert "Don't randomly re-define a bunch of standard things."

Bill Paul kindly figured out what this stuff does:

> I think I just answered my own question when testing out your patch.
> The
> underlying problem again is using the host-based ELF code with the
> target-
> based type definitions.
>
> The elf.h file includes other files. Both on Linux and FreeBSD,
> /usr/include/elf.h will end up including stdint.h. If you build
> *without*
> using -stc=c99 or -std=c11, then efibind.h defines its own versions of
> the
> various types (uint64_t, int64_t, etc..). And when you do that, you
> get a
> conflict:
>
> /usr/bin/gcc -I./../gnuefi -I./../gnuefi/../inc
> -I./../gnuefi/../inc/x86_64 -
> I./../gnuefi/../inc/protocol   -O2 -fpic -Wall -fshort-wchar
> -fno-strict-
> aliasing -fno-merge-constants -mno-red-zone -DCONFIG_x86_64 -c
> reloc_x86_64.c
> -o reloc_x86_64.o
> In file included from ./../gnuefi/../inc/efi.h:35,
>                  from reloc_x86_64.c:43:
> ./../gnuefi/../inc/x86_64/efibind.h:58: error: conflicting types for
> 'uint64_t'
> /usr/include/stdint.h:56: note: previous declaration of 'uint64_t' was
> here
> ./../gnuefi/../inc/x86_64/efibind.h:59: error: conflicting types for
> 'int64_t'
> /usr/include/stdint.h:41: note: previous declaration of 'int64_t' was
> here
> ./../gnuefi/../inc/x86_64/efibind.h:65: error: conflicting types for
> 'int8_t'
> /usr/include/stdint.h:37: note: previous declaration of 'int8_t' was
> here
> make[1]: *** [reloc_x86_64.o] Error 1
>
> I get the same conflict on FreeBSD too.
>
> So the reason those #defines are present in reloc_x86_64.c and
> reloc_ia32.c is
> to work around this: they hide the typedefs from stdint.h so that the
> ones in
> elfbind.h won't conflict with them.
>
> If you build with -stc=c99, then elfbind.h falls through to the
> #include
> <stdint.h> case, and then there's no conflict.

This reverts commit a9866f5bcd9642eaea65ee0e73fe6e46f2bd6f9e.