summaryrefslogtreecommitdiff
path: root/util/extensions/legacybios/Makefile
blob: 477a3af7b0e460bee6e33d243c53e891a3928647 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# tag: Makefile for the legacy bios emulation
#
# Copyright (C) 2003 Stefan Reinauer
#
# See the file "COPYING" for further information about
# the copyright and warranty status of this work.
#

# FIXME: limitations of this makefile:
#   - needs vgabios.rom even if its not used
#   - builds x86emu even if it's not used.


ARCH     := $(shell uname -m | sed -e s/i.86/x86/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/x86_64/amd64/)
TOPDIR   := $(shell /bin/pwd)
BUILDDIR ?= $(TOPDIR)/obj-$(ARCH)
VPATH    := $(TOPDIR)/include:$(TOPDIR)/util:$(BUILDDIR)

include $(TOPDIR)/Rules.make

CFLAGS_DEBUG := -Wall -Wstrict-prototypes -Wshadow

CFLAGS       ?= -Os -fcaller-saves -fomit-frame-pointer $(CFLAGS_ARCH) $(CFLAGS_DEBUG)

export ARCH TOPDIR VPATH CFLAGS BUILDDIR

all: main $(ARCH)
	@echo -e "\nlegacy bios plugin build finished for platform $(ARCH).\n"

.PHONY: kernel $(ARCH)

types.h: types.sh
	@echo -n "Checking types..."
	@cd $(BUILDDIR) && $(TOPDIR)/util/types.sh

bin2hex: bin2hex.c
	@echo -n "Building binary converter..."
	@cd $(BUILDDIR) && $(CC) -o bin2hex $(TOPDIR)/util/bin2hex.c
	@echo -e "\t\tok"

kernel:
	@make -s -C kernel 

main:
	@echo -e "\nWelcome to LegacyBIOS..."
	@test -r $(BUILDDIR) || ( mkdir -p $(BUILDDIR); \
	  echo -e "\nCreating build directory $(BUILDDIR)" )

libx86emu.a:
	make -s -C arch/x86emu/src/x86emu

$(ARCH): types.h bin2hex kernel vgabios.rom libx86emu.a
	@make -s -C arch/$(ARCH)

vgabios.rom:
	@cp $(TOPDIR)/roms/vgabios.rom $(BUILDDIR)

clean:
	@test ! -d $(BUILDDIR) && \
		echo "Architecture $(ARCH) is already clean." || \
		( 						 \
			echo "Cleaning up architecture $(ARCH)"; \
			rm -rf $(BUILDDIR)			 \
			rm forth.dict.core			 \
		)

indent:
	find -path './{arch}' -prune -o -name '*.[ch]' \
				-exec indent -kr -i8 {} \;
	find -name '*~' -exec rm {} \;