Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

79 lines (59 sloc) 1.605 kb
ARCH=$(shell uname -m)
ifeq ($(BITS),)
ifeq ($(ARCH),x86_64)
BITS=64
else ifeq ($(ARCH),i686)
BITS=32
else
$(error Unsupported architecture $(ARCH))
endif
endif
CXXFLAGS=-m$(BITS) -O2 -g -Wall -pthread $(if $(DEBUG),-DDEBUG=$(DEBUG)) -DHOST_BITS=$(BITS)
ASFLAGS=-m$(BITS) -g
LDFLAGS=-m$(BITS)
ifeq ($(shell uname),Darwin)
else
LDFLAGS += -pthread
endif
SRCS=bemu.cpp bcpu.cpp bdecode.cpp bt.cpp bclock.cpp bconsole.cpp
ASMSRCS=bt_helper_$(BITS).S
OBJECTS=$(SRCS:.cpp=.o) $(ASMSRCS:.S=.o)
GEN_H=instructions.h
DEPFILES=$(SRCS:%.cpp=.%.d)
BEMU=bemu
UASM=uasm/uasm
TESTS=sancheck litmus bench1 bench2 bench3 bench4 supervisor align qsort timer trap trap2 jmptab
TESTS_BIN=$(TESTS:%=tests/%.bin)
all: $(BEMU) $(TESTS_BIN) $(DEPFILES)
$(BEMU): $(OBJECTS)
$(CXX) -o $@ $(LDFLAGS) $(filter-out .config/%,$^)
$(UASM): CXXFLAGS += -w
$(UASM):
uasm: $(UASM)
$(OBJECTS): instructions.h .config/CXX .config/CPPFLAGS .config/CXXFLAGS
x86.h: instructions.h
$(BEMU): .config/LDFLAGS
$(ASMSRCS:.S=.o): .config/ASFLAGS
instructions.h: insts.pl
perl $< -cxx > $@
clean:
rm -f $(OBJECTS) $(BEMU)
rm -f tests/*.bin tests/*.map tests/*.sym
rm -f $(UASM) uasm/uasm.o $(GEN_H)
%.bin: %.uasm $(UASM)
$(UASM) $<
run-%: tests/%.bin
./bemu $(BEMUOPTS) $<
run-os: BEMUOPTS += -o clock,tty
run-lab8: BEMUOPTS += -o clock,tty
run-timer: BEMUOPTS += -o clock
test: $(TESTS_BIN) $(UASM) $(BEMU)
./run-tests.sh
TAGS: $(SRCS) $(ASMSRCS)
etags $^
tags: TAGS
check-syntax:
$(CC) $(CCFLAGS) -Wall -Wextra -fsyntax-only $(CHK_SOURCES)
.phony: CLEAN tags check-syntax uasm
include Makefile.lib
-include $(DEPFILES)
Jump to Line
Something went wrong with that request. Please try again.