Refactor the build rules

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@532 f158a5a8-5612-0410-a976-696ce0be7e32
This commit is contained in:
Blue Swirl
2009-08-02 16:59:05 +00:00
parent 8a7a0012ea
commit 17d787ee2e
15 changed files with 232 additions and 920 deletions

71
Makefile.target Normal file
View File

@@ -0,0 +1,71 @@
#
# OpenBIOS Makefile
# (C) 2004-2009 by the OpenBIOS team
#
include config.mak
ODIR := .
SRCDIR := ..
HOSTCC := gcc
HOSTCFLAGS+= -O2 -g -DFCOMPILER -DBOOTSTRAP $(CROSSCFLAGS)
HOSTCFLAGS+= -Wall -Wredundant-decls -Wshadow -Wpointer-arith
HOSTCFLAGS+= -Wstrict-prototypes -Wmissing-declarations -Wundef -Wendif-labels
HOSTCFLAGS+= -Wstrict-aliasing -Wwrite-strings -Wmissing-prototypes
HOSTCFLAGS+= -W
HOSTINCLUDES := -I$(SRCDIR)/include -I$(SRCDIR)/kernel -I$(SRCDIR)/kernel/include -I$(ODIR)/target/include
CC := $(TARGET)gcc
AS := $(TARGET)as
AR := $(TARGET)ar
LD := $(TARGET)ld
NM := $(TARGET)nm
STRIP := $(TARGET)strip
RANLIB := $(TARGET)ranlib
CFLAGS+= -Os -g -DNATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH -USWAP_ENDIANNESS
CFLAGS+= -Wall -Wredundant-decls -Wshadow -Wpointer-arith
CFLAGS+= -Wstrict-prototypes -Wmissing-declarations -Wundef -Wendif-labels
CFLAGS+= -Wstrict-aliasing -Wwrite-strings -Wmissing-prototypes
CFLAGS+= -Werror
INCLUDES := -I$(SRCDIR)/include -I$(SRCDIR)/kernel/include -I$(ODIR)/target/include
AS_FLAGS+= -g
#
# pre rules
#
all: versions dictionaries host-libraries target-libraries host-executables target-executables
VERSION := "1.0"
versions: $(ODIR)/target/include/openbios-version.h $(ODIR)/forth/version.fs
$(ODIR)/forth/version.fs:
@DATE="$(shell echo `LC_ALL=C TZ=UTC date +'%b %e %Y %H:%M'`)" ; \
( echo ": builddate \" $$DATE\" ; " ; \
echo ": version \" $(VERSION)\" ; " ; ) \
> $(dir $@)/version.fs
$(ODIR)/target/include/openbios-version.h:
@DATE="$(shell echo `LC_ALL=C TZ=UTC date +'%b %e %Y %H:%M'`)" ; \
( echo "#define OPENBIOS_BUILD_DATE \"$$DATE\"" ; \
echo "#define OPENBIOS_VERSION_STR \"$(VERSION)\"" ; \
echo "#define OPENBIOS_RELEASE \"$(VERSION)\"" ; ) \
> $(dir $@)/openbios-version.h
info:
@echo "Building OpenBIOS on $(HOSTARCH) for $(ARCH)"
clean:
@printf "Cleaning up for $(ARCH)..."
@rm -rf forth.dict.core forthstrap *.dict openbios-*
@find . -type f -name "*~" -o -name '*.o' -o -name '*.a' -exec rm \{\} \;
@echo " ok"
build-verbose: info build
build: all
include rules.mak