| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
TOP ?= ../.. |
| 12 |
OUT ?= build |
| 13 |
|
| 14 |
CC ?= gcc |
| 15 |
CFLAGS ?= -O2 -g -fomit-frame-pointer |
| 16 |
|
| 17 |
CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes |
| 18 |
CFLAGS += -Wwrite-strings -Wredundant-decls -Wstrict-aliasing -Wshadow -Wextra |
| 19 |
CFLAGS += -Wno-unused-but-set-variable |
| 20 |
|
| 21 |
|
| 22 |
CBCFLAGS = -Wno-sign-compare -Wno-unused-parameter -Wno-format |
| 23 |
|
| 24 |
INCLUDES = -Iinclude -I$(OUT)/include |
| 25 |
INCLUDES += -I$(TOP)/src/device/oprom/include/ |
| 26 |
INCLUDES += -I$(TOP)/src/device/oprom/yabel |
| 27 |
INCLUDES += -include $(TOP)/src/commonlib/include/commonlib/loglevel.h |
| 28 |
INCLUDES += -include stdtypes.h -include pci-userspace.h |
| 29 |
INCLUDES += -include $(TOP)/src/include/kconfig.h |
| 30 |
|
| 31 |
CBINCLUDES = -I$(TOP)/src -include include/stdtypes.h -include $(TOP)/src/include/endian.h |
| 32 |
CBINCLUDES += -include stdio.h -include sys/io.h |
| 33 |
|
| 34 |
SOURCE = testbios.c |
| 35 |
SOURCE += pci-userspace.c |
| 36 |
SOURCE += device.c |
| 37 |
|
| 38 |
X86EMU = x86emu/sys.c x86emu/decode.c x86emu/ops.c x86emu/ops2.c |
| 39 |
X86EMU += x86emu/prim_ops.c x86emu/fpu.c x86emu/debug.c |
| 40 |
|
| 41 |
X86EMU += yabel/interrupt.c |
| 42 |
X86EMU += yabel/mem.c |
| 43 |
X86EMU += yabel/io.c |
| 44 |
X86EMU += yabel/pmm.c |
| 45 |
X86EMU += yabel/biosemu.c |
| 46 |
X86EMU += yabel/debug.c |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
X86EMU_DIR = $(TOP)/src/device/oprom |
| 52 |
X86EMU_SOURCE = $(addprefix $(X86EMU_DIR)/, $(X86EMU)) |
| 53 |
OBJECTS:=$(addprefix $(OUT)/,$(SOURCE:.c=.o)) $(addprefix $(OUT)/, $(X86EMU:.c=.o)) |
| 54 |
|
| 55 |
LIBS=-lpci |
| 56 |
|
| 57 |
all: dep testbios |
| 58 |
|
| 59 |
$(OBJECTS): includes |
| 60 |
|
| 61 |
testbios: $(OBJECTS) |
| 62 |
printf " LINK $(notdir $@)\n" |
| 63 |
$(CC) $(CFLAGS) -o $@ $^ $(LIBS) |
| 64 |
|
| 65 |
dep: $(SOURCE) $(X86EMU_SOURCE) Makefile |
| 66 |
$(CC) $(CFLAGS) $(INCLUDES) -MM $(SOURCE) > .dependencies |
| 67 |
$(CC) $(CFLAGS) $(INCLUDES) $(CBCFLAGS) $(CBINCLUDES) -MM $(X86EMU_SOURCE) >> .dependencies |
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
includes: |
| 72 |
mkdir -p $(OUT)/include/device |
| 73 |
mkdir -p $(OUT)/include/arch |
| 74 |
touch $(OUT)/include/device/device.h |
| 75 |
touch $(OUT)/include/device/pci.h |
| 76 |
touch $(OUT)/include/device/pci_ops.h |
| 77 |
touch $(OUT)/include/device/resource.h |
| 78 |
touch $(OUT)/include/arch/io.h |
| 79 |
touch $(OUT)/include/timer.h |
| 80 |
touch $(OUT)/include/types.h |
| 81 |
|
| 82 |
clean: |
| 83 |
rm -f $(OBJECTS) *~ testbios |
| 84 |
rm -rf $(OUT) |
| 85 |
|
| 86 |
distclean: clean |
| 87 |
rm -f .dependencies |
| 88 |
|
| 89 |
$(OUT)/%.o: $(X86EMU_DIR)/%.c |
| 90 |
printf " CC (x86emu) $(notdir $<)\n" |
| 91 |
mkdir -p $(dir $@) |
| 92 |
$(CC) $(CFLAGS) $(CBCFLAGS) $(INCLUDES) $(CBINCLUDES) -c -o $@ $< |
| 93 |
|
| 94 |
$(OUT)/%.o: %.c |
| 95 |
printf " CC $(notdir $<)\n" |
| 96 |
mkdir -p $(dir $@) |
| 97 |
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< |
| 98 |
|
| 99 |
.PHONY: all includes clean distclean |
| 100 |
.SILENT: |
| 101 |
|
| 102 |
-include .dependencies |