Stefan Reinauer | 1858844 | 2005-01-17 11:08:08 +0000 | [diff] [blame] | 1 | # |
| 2 | # NOTE: You need to add your libpci.a version to CFLAGS below if |
| 3 | # pci-userspace.c does not build. |
| 4 | # |
| 5 | # If you are building on AMD64, you have to use /usr/lib64/libpci.a instead of |
| 6 | # /usr/lib/... |
| 7 | # |
| 8 | |
Stefan Reinauer | 850e7d4 | 2015-09-28 13:12:04 -0700 | [diff] [blame] | 9 | TOP ?= ../.. |
| 10 | |
| 11 | CC ?= gcc |
| 12 | CFLAGS ?= -O2 -g -fomit-frame-pointer |
| 13 | |
Stefan Reinauer | 4aeff4f | 2010-04-16 11:45:16 +0000 | [diff] [blame] | 14 | CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes |
Stefan Reinauer | 850e7d4 | 2015-09-28 13:12:04 -0700 | [diff] [blame] | 15 | CFLAGS += -Wwrite-strings -Wredundant-decls -Wstrict-aliasing -Wshadow -Wextra |
Stefan Reinauer | 4aeff4f | 2010-04-16 11:45:16 +0000 | [diff] [blame] | 16 | |
Stefan Reinauer | 850e7d4 | 2015-09-28 13:12:04 -0700 | [diff] [blame] | 17 | # TODO check host architecture |
| 18 | CBCFLAGS = -DCONFIG_ARCH_X86=1 -Wno-sign-compare -Wno-unused-but-set-variable -Wno-unused-parameter |
Li-Ta Lo | 8152126 | 2004-07-08 17:18:27 +0000 | [diff] [blame] | 19 | |
Stefan Reinauer | 850e7d4 | 2015-09-28 13:12:04 -0700 | [diff] [blame] | 20 | INCLUDES = -Iinclude -I$(TOP)/src/device/oprom/include/ |
| 21 | CBINCLUDES = -I$(TOP)/src --include include/stdtypes.h |
| 22 | CBINCLUDES += --include $(TOP)/src/commonlib/include/commonlib/loglevel.h |
| 23 | CBINCLUDES += -include stdio.h |
Li-Ta Lo | 8152126 | 2004-07-08 17:18:27 +0000 | [diff] [blame] | 24 | |
Stefan Reinauer | 850e7d4 | 2015-09-28 13:12:04 -0700 | [diff] [blame] | 25 | SOURCE = int10.c int15.c int16.c int1a.c inte6.c testbios.c |
| 26 | SOURCE += helper_exec.c helper_mem.c pci-userspace.c |
| 27 | |
| 28 | X86EMU = sys.c decode.c ops.c ops2.c prim_ops.c fpu.c debug.c |
| 29 | X86EMU_DIR = $(TOP)/src/device/oprom/x86emu |
| 30 | X86EMU_SOURCE = $(addprefix $(X86EMU_DIR)/, $(X86EMU)) |
| 31 | OBJECTS:=$(SOURCE:.c=.o) $(X86EMU:.c=.o) |
Stefan Reinauer | 86051f9 | 2010-03-23 15:53:38 +0000 | [diff] [blame] | 32 | |
| 33 | LIBS=-lpci |
Li-Ta Lo | 8152126 | 2004-07-08 17:18:27 +0000 | [diff] [blame] | 34 | |
Stefan Reinauer | 850e7d4 | 2015-09-28 13:12:04 -0700 | [diff] [blame] | 35 | all: dep testbios |
Li-Ta Lo | 8152126 | 2004-07-08 17:18:27 +0000 | [diff] [blame] | 36 | |
Stefan Reinauer | 850e7d4 | 2015-09-28 13:12:04 -0700 | [diff] [blame] | 37 | testbios: $(OBJECTS) |
| 38 | printf " LINK $(notdir $@)\n" |
Stefan Reinauer | 86051f9 | 2010-03-23 15:53:38 +0000 | [diff] [blame] | 39 | $(CC) $(CFLAGS) -o $@ $^ $(LIBS) |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 40 | |
Stefan Reinauer | 850e7d4 | 2015-09-28 13:12:04 -0700 | [diff] [blame] | 41 | dep: $(SOURCE) $(X86EMU_SOURCE) Makefile |
| 42 | $(CC) $(CFLAGS) $(INCLUDES) -MM $(SOURCE) > .dependencies |
| 43 | $(CC) $(CFLAGS) $(INCLUDES) $(CBCFLAGS) $(CBINCLUDES) -MM $(X86EMU_SOURCE) >> .dependencies |
Li-Ta Lo | 8152126 | 2004-07-08 17:18:27 +0000 | [diff] [blame] | 44 | |
Li-Ta Lo | 8152126 | 2004-07-08 17:18:27 +0000 | [diff] [blame] | 45 | clean: |
Li-Ta Lo | 8152126 | 2004-07-08 17:18:27 +0000 | [diff] [blame] | 46 | rm -f *.o *~ testbios |
| 47 | |
Stefan Reinauer | 850e7d4 | 2015-09-28 13:12:04 -0700 | [diff] [blame] | 48 | distclean: clean |
| 49 | rm -f .dependencies |
| 50 | |
| 51 | %.o: $(X86EMU_DIR)/%.c |
| 52 | printf " CC (x86emu) $(notdir $<)\n" |
| 53 | $(CC) $(CFLAGS) $(CBCFLAGS) $(INCLUDES) $(CBINCLUDES) -c -o $@ $< |
Stefan Reinauer | 4aeff4f | 2010-04-16 11:45:16 +0000 | [diff] [blame] | 54 | |
| 55 | %.o: %.c |
Stefan Reinauer | 850e7d4 | 2015-09-28 13:12:04 -0700 | [diff] [blame] | 56 | printf " CC $(notdir $<)\n" |
Stefan Reinauer | 4aeff4f | 2010-04-16 11:45:16 +0000 | [diff] [blame] | 57 | $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $< |
Stefan Reinauer | 850e7d4 | 2015-09-28 13:12:04 -0700 | [diff] [blame] | 58 | |
| 59 | .PHONY: all clean distclean |
| 60 | .SILENT: |
| 61 | |
| 62 | -include .dependencies |