Fix x86 build
[openbios.git] / Makefile.target
blobbab5998f9e85d1ca43f3b10170f99f320c8ea226
2 #  OpenBIOS Makefile
3 # (C) 2004-2009 by the OpenBIOS team
6 include config.mak
8 ODIR := .
9 SRCDIR := ..
10 HOSTCC := gcc
12 HOSTCFLAGS+= -O2 -g -DFCOMPILER -DBOOTSTRAP $(CROSSCFLAGS)
13 HOSTCFLAGS+= -Wall -Wredundant-decls -Wshadow -Wpointer-arith
14 HOSTCFLAGS+= -Wstrict-prototypes -Wmissing-declarations -Wundef -Wendif-labels
15 HOSTCFLAGS+= -Wstrict-aliasing -Wwrite-strings -Wmissing-prototypes
16 HOSTCFLAGS+= -W
17 HOSTINCLUDES := -I$(SRCDIR)/include -I$(SRCDIR)/kernel -I$(SRCDIR)/kernel/include -I$(ODIR)/target/include
19 CC     := $(TARGET)gcc
20 AS     := $(TARGET)as
21 AR     := $(TARGET)ar
22 LD     := $(TARGET)ld
23 NM     := $(TARGET)nm
24 STRIP  := $(TARGET)strip
25 RANLIB := $(TARGET)ranlib
27 CFLAGS+= -Os -g -DNATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH -USWAP_ENDIANNESS
28 CFLAGS+= -Wall -Wredundant-decls -Wshadow -Wpointer-arith
29 CFLAGS+= -Wstrict-prototypes -Wmissing-declarations -Wundef -Wendif-labels
30 CFLAGS+= -Wstrict-aliasing -Wwrite-strings -Wmissing-prototypes
31 CFLAGS+= -Werror
32 INCLUDES := -I$(SRCDIR)/include -I$(SRCDIR)/kernel/include -I$(ODIR)/target/include
33 AS_FLAGS+= -g
35 quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1))
38 # pre rules
41 all: versions dictionaries host-libraries target-libraries host-executables target-executables
43 versions: $(ODIR)/target/include/openbios-version.h $(ODIR)/forth/version.fs
45 $(ODIR)/forth/version.fs:
46         $(call quiet-command,true, "  GEN   $(TARGET_DIR)$@")
47         @DATE="$(shell echo `LC_ALL=C TZ=UTC date +'%b %e %Y %H:%M'`)" ;  \
48                 ( echo ": builddate \" $$DATE\" ; " ;     \
49                   echo ": version \" $(VERSION)\" ; " ; ) \
50                   > $(dir $@)/version.fs
52 $(ODIR)/target/include/openbios-version.h:
53         $(call quiet-command,true, "  GEN   $(TARGET_DIR)$@")
54         @DATE="$(shell echo `LC_ALL=C TZ=UTC date +'%b %e %Y %H:%M'`)" ; \
55           ( echo "#define OPENBIOS_BUILD_DATE \"$$DATE\"" ; \
56            echo "#define OPENBIOS_VERSION_STR \"$(VERSION)\"" ; ) \
57          > $(dir $@)/openbios-version.h
59 info:
60         @echo "Building OpenBIOS on $(HOSTARCH) for $(ARCH)"
62 clean:
63         @printf "Cleaning up for $(ARCH)..."
64         @rm -rf forth.dict.core forthstrap *.dict openbios-*
65         @rm -f $(ODIR)/target/include/openbios-version.h $(ODIR)/forth/version.fs
66         @find . -type f \( -name "*~" -o -name '*.o' -o -name '*.a' \) -exec rm \{\} \;
67         @echo " ok"
69 build-verbose: info build
71 build: all
73 include rules.mak