build-sys: add very basic configure.am and Makefile.am
authorKarel Zak <kzak@redhat.com>
Wed, 27 Feb 2013 09:41:54 +0000 (10:41 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 1 Mar 2013 09:32:36 +0000 (10:32 +0100)
Note that this commit removes the old Makefile.

Signed-off-by: Karel Zak <kzak@redhat.com>
.gitignore
Makefile [deleted file]
Makefile.am [new file with mode: 0644]
autogen.sh [new file with mode: 0755]
configure.ac [new file with mode: 0644]

index f08fe43..715cdae 100644 (file)
@@ -1,8 +1,33 @@
+*~
 *.o
 *.so
+*.cache
+*.log
+.deps
+.libs
 /gummiboot
 /gummiboot.1
 /gummiboot.so
 /gummibootia32.efi
 /gummibootx64.efi
 /test-disk
+
+Makefile
+aclocal.m4
+stamp-h.in
+Makefile.in
+configure
+config.h
+config.h.in
+config.guess
+config.status
+config.sub
+stamp-h
+stamp-h1
+m4/*.m4
+config.rpath
+mkinstalldirs
+compile
+depcomp
+install-sh
+missing
diff --git a/Makefile b/Makefile
deleted file mode 100644 (file)
index 95f3a98..0000000
--- a/Makefile
+++ /dev/null
@@ -1,119 +0,0 @@
-VERSION=24
-
-ifeq ($(strip $(V)),)
-       E = @echo
-       Q = @
-else
-       E = @\#
-       Q =
-endif
-export E Q
-
-ARCH=$(shell $(CC) -dumpmachine | sed "s/\(-\).*$$//")
-LIBDIR=$(shell echo $$(cd /usr/lib/$$(gcc -print-multi-os-directory); pwd))
-LIBEFIDIR=$(or $(wildcard $(LIBDIR)/gnuefi), $(LIBDIR))
-
-ifeq ($(ARCH),i686)
-       ARCH=ia32
-       MACHINE_TYPE_NAME=ia32
-endif
-
-ifeq ($(ARCH),x86_64)
-       MACHINE_TYPE_NAME=x64
-       ARCH_CFLAGS= \
-               -DEFI_FUNCTION_WRAPPER \
-               -mno-red-zone
-endif
-
-all: gummiboot$(MACHINE_TYPE_NAME).efi gummiboot
-
-# ------------------------------------------------------------------------------
-CPPFLAGS = \
-       -I. \
-       -I/usr/include/efi \
-       -I/usr/include/efi/$(ARCH)
-
-CFLAGS = \
-       -DVERSION=$(VERSION) \
-       -Wall \
-       -Wextra \
-       -nostdinc \
-       -ggdb -O0 \
-       -fpic \
-       -fshort-wchar \
-       -nostdinc \
-       -ffreestanding \
-       -fno-strict-aliasing \
-       -fno-stack-protector \
-       -Wsign-compare \
-       $(ARCH_CFLAGS)
-
-LDFLAGS = -T $(LIBEFIDIR)/elf_$(ARCH)_efi.lds \
-       -shared \
-       -Bsymbolic \
-       -nostdlib \
-       -znocombreloc \
-       -L $(LIBDIR) \
-       $(LIBEFIDIR)/crt0-efi-$(ARCH).o
-
-%.o: %.c
-       $(E) "  CC       " $@
-       $(Q) $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
-
-src/efi/gummiboot.o: src/efi/gummiboot.c Makefile
-
-src/efi/gummiboot.so: src/efi/gummiboot.o
-       $(E) "  LD       " $@
-       $(Q) $(LD) $(LDFLAGS) src/efi/gummiboot.o -o $@ -lefi -lgnuefi \
-         $(shell $(CC) -print-libgcc-file-name)
-       $(Q) nm -D -u $@ | grep ' U ' && exit 1 || :
-
-gummiboot$(MACHINE_TYPE_NAME).efi: src/efi/gummiboot.so
-       $(E) "  OBJCOPY  " $@
-       $(Q) objcopy -j .text -j .sdata -j .data -j .dynamic \
-         -j .dynsym -j .rel -j .rela -j .reloc -j .eh_frame \
-         --target=efi-app-$(ARCH) $< $@
-
-# ------------------------------------------------------------------------------
-gummiboot: src/setup/setup.c src/setup/efivars.h src/setup/efivars.c Makefile
-       $(E) "  CCLD     " $@
-       $(Q) $(CC) -O0 -g -Wall -Wextra \
-         -Wno-unused-parameter -D_GNU_SOURCE \
-         -DVERSION=$(VERSION) \
-         -DMACHINE_TYPE_NAME=\"$(MACHINE_TYPE_NAME)\" \
-         src/setup/setup.c \
-         src/setup/efivars.c \
-          `pkg-config --cflags --libs blkid` \
-         -o $@
-
-# ------------------------------------------------------------------------------
-man: gummiboot.1
-
-gummiboot.1: src/setup/gummiboot.xml
-       $(E) "  XSLT     " $@
-       $(Q) xsltproc -o @ --nonet \
-         --stringparam man.output.quietly 1 \
-         --stringparam man.th.extra1.suppress 1 \
-         --stringparam man.authors.section.enabled 0 \
-         --stringparam man.copyright.section.enabled 0 \
-         http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
-
-# ------------------------------------------------------------------------------
-clean:
-       rm -f src/efi/gummiboot.o src/efi/gummiboot.so gummiboot gummiboot$(MACHINE_TYPE_NAME).efi
-
-install: all
-       mkdir -p $(DESTDIR)/usr/bin/
-       cp gummiboot $(DESTDIR)/usr/bin
-       mkdir -p $(DESTDIR)/usr/lib/gummiboot/
-       cp gummiboot$(MACHINE_TYPE_NAME).efi $(DESTDIR)/usr/lib/gummiboot/
-       [ -e gummiboot.1 ] && mkdir -p $(DESTDIR)/usr/share/man/man1/ && cp gummiboot.1 $(DESTDIR)/usr/share/man/man1/ || :
-
-tar:
-       git archive --format=tar --prefix=gummiboot-$(VERSION)/ $(VERSION) | xz > gummiboot-$(VERSION).tar.xz
-
-test-disk: gummiboot$(MACHINE_TYPE_NAME).efi test/test-create-disk.sh
-       test/test-create-disk.sh
-
-test: test-disk
-       qemu-kvm -m 256 -L /usr/lib/qemu-bios -snapshot test-disk
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..0636cd3
--- /dev/null
@@ -0,0 +1,27 @@
+#
+#  This file is part of gummiboot
+#
+#  Copyright (C) 2013 Karel Zak <kzak@redhat.com>
+#
+#  gummiboot is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+#
+#  gummiboot is distributed in the hope that it will be useful, but
+#  WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public License
+#  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+#
+ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
+AM_MAKEFLAGS =
+
+AM_CPPFLAGS = -include config.h
+AM_CFLAGS =
+AM_LDFLAGS =
+
+
+EXTRA_DIST = autogen.sh README LICENSE
diff --git a/autogen.sh b/autogen.sh
new file mode 100755 (executable)
index 0000000..8e063ec
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+#  This file is part of gummiboot.
+#
+#  gummiboot is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+#
+#  gummiboot is distributed in the hope that it will be useful, but
+#  WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public License
+#  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+
+set -e
+
+autoreconf --force --install --symlink
+
+libdir() {
+        echo $(cd "$1/$(gcc -print-multi-os-directory)"; pwd)
+}
+
+args="\
+--sysconfdir=/etc \
+--libdir=$(libdir /usr/lib)"
+
+if [ "x$1" = "xc" ]; then
+        ./configure $args
+        make clean
+else
+        echo
+        echo "----------------------------------------------------------------"
+        echo "Initialized build system. For a common configuration please run:"
+        echo "----------------------------------------------------------------"
+        echo
+        echo "./configure $args"
+        echo
+fi
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..eb82ed3
--- /dev/null
@@ -0,0 +1,55 @@
+#
+#  This file is part of gummiboot.
+#
+#  Copyright (C) 2013 Karel Zak <kzak@redhat.com>
+#
+#  gummiboot is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+#
+#  gummiboot is distributed in the hope that it will be useful, but
+#  WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+#  Lesser General Public License for more details.
+#
+#  You should have received a copy of the GNU Lesser General Public License
+#  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+
+AC_INIT([gummiboot],
+        [24],
+        [kay@vrfy.org],
+        [gummiboot],
+        [http://freedesktop.org/wiki/Software/gummiboot])
+
+AC_CONFIG_SRCDIR([src/setup/setup.c])
+AC_CONFIG_MACRO_DIR([m4])
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_AUX_DIR([build-aux])
+AC_PREFIX_DEFAULT([/usr])
+
+AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax no-dist-gzip dist-xz subdir-objects])
+AM_SILENT_RULES([yes])
+
+AC_CANONICAL_HOST
+AC_SYS_LARGEFILE
+
+AC_PROG_CC
+AC_PROG_CC_C99
+AM_PROG_CC_C_O
+AC_PROG_GCC_TRADITIONAL
+
+AC_PROG_MKDIR_P
+AC_PATH_PROG([XSLTPROC], [xsltproc])
+
+AC_CONFIG_FILES([
+        Makefile
+])
+
+AC_OUTPUT
+AC_MSG_RESULT([
+        $PACKAGE_NAME $VERSION
+
+        prefix:                  ${prefix}
+        libdir:                  ${libdir}
+])