.github/workflows: add release.yml for generating an OpenBIOS release
[openbios.git] / Makefile.target
1 #
2 #  OpenBIOS Makefile
3 # (C) 2004-2009 by the OpenBIOS team
4 #
5
6 include config.mak
7
8 ODIR := .
9 HOSTCC := gcc
10
11 HOSTCFLAGS+= -O2 -g -DFCOMPILER -DBOOTSTRAP $(CROSSCFLAGS)
12 HOSTCFLAGS+= -Wall -Wredundant-decls -Wshadow -Wpointer-arith
13 HOSTCFLAGS+= -Wstrict-prototypes -Wmissing-declarations -Wundef -Wendif-labels
14 HOSTCFLAGS+= -Wstrict-aliasing -Wwrite-strings -Wmissing-prototypes -Wnested-externs
15 HOSTCFLAGS+= -W
16 # Flags for dependency generation
17 HOSTCFLAGS+= -MMD -MP -MT $@ -MF '$(*D)/$(*F).d'
18 HOSTINCLUDES := -I$(SRCDIR)/include -I$(SRCDIR)/kernel -I$(SRCDIR)/kernel/include -iquote $(ODIR)/target/include
19
20 CC     := $(TARGET)gcc
21 AS     := $(TARGET)as
22 AR     := $(TARGET)ar
23 LD     := $(TARGET)ld
24 NM     := $(TARGET)nm
25 STRIP  := $(TARGET)strip
26 RANLIB := $(TARGET)ranlib
27
28 CFLAGS+= -Os -g -DNATIVE_BITWIDTH_EQUALS_HOST_BITWIDTH -USWAP_ENDIANNESS
29 CFLAGS+= -Wall -Wredundant-decls -Wshadow -Wpointer-arith
30 CFLAGS+= -Wstrict-prototypes -Wmissing-declarations -Wundef -Wendif-labels
31 CFLAGS+= -Wstrict-aliasing -Wwrite-strings -Wmissing-prototypes -Wnested-externs
32 CFLAGS+= -Werror
33 # Flags for dependency generation
34 CFLAGS+= -MMD -MP -MT $@ -MF '$(*D)/$(*F).d'
35 INCLUDES := -I$(SRCDIR)/include -I$(SRCDIR)/kernel/include -I$(ODIR)/target/include
36 AS_FLAGS+= -g
37
38 # FCode tokeniser
39 TOKE   := toke
40
41 quiet-command = $(if $(V),$1,$(if $(2),@echo $2 && $1, @$1))
42
43 VPATH_SUFFIXES = %.c %.h %.S %.fs
44 set-vpath = $(if $1,$(foreach PATTERN,$(VPATH_SUFFIXES),$(eval vpath $(PATTERN) $1)))
45 $(call set-vpath, $(SRCDIR))
46
47 #
48 # pre rules
49 #
50
51 all: versions dictionaries host-libraries target-libraries host-executables target-executables
52
53 versions: $(ODIR)/target/include/openbios-version.h $(ODIR)/forth/version.fs
54
55 $(ODIR)/forth/version.fs:
56         $(call quiet-command,true, "  GEN   $(TARGET_DIR)$@")
57         @DATE="$(shell echo `LC_ALL=C TZ=UTC date +'%b %e %Y %H:%M'`)" ;  \
58                 ( echo ": builddate \" $$DATE\" ; " ;     \
59                   echo ": version \" $(VERSION)\" ; " ; ) \
60                   > $(dir $@)/version.fs
61
62 $(ODIR)/target/include/openbios-version.h:
63         $(call quiet-command,true, "  GEN   $(TARGET_DIR)$@")
64         @DATE="$(shell echo `LC_ALL=C TZ=UTC date +'%b %e %Y %H:%M'`)" ; \
65           ( echo "#define OPENBIOS_BUILD_DATE \"$$DATE\"" ; \
66            echo "#define OPENBIOS_VERSION_STR \"$(VERSION)\"" ; ) \
67          > $(dir $@)/openbios-version.h
68
69 info:
70         @echo "Building OpenBIOS on $(HOSTARCH) for $(ARCH)"
71
72 clean:
73         @printf "Cleaning up for $(ARCH)..."
74         @rm -rf forth.dict.core forthstrap *.dict openbios-*
75         @rm -f $(ODIR)/target/include/openbios-version.h $(ODIR)/forth/version.fs
76         @find . -type f \( -name "*~" -o -name '*.o' -o -name '*.d' -o -name '*.a' \) -exec rm \{\} \;
77         @echo " ok"
78
79 build-verbose: info build
80
81 build: all
82
83 include rules.mak
84
85 # Include automatically generated dependency files
86 -include $(wildcard $(ODIR)/*.d $(ODIR)/host/kernel/*.d $(ODIR)/target/*/*.d $(ODIR)/target/*/*/*.d $(ODIR)/target/*/*/*/*.d)