Hi, I was making an emulator to use BIOS functions in long / protected mode. After all of my attempts fail (code was unstable and really very very messy) I decided to use libx86emu or x86emu.
The sad part is I can't find any download links for it. All links I've found from the Google are broken.
Then I found libx86emu from opensuse repo and https://github.com/wfeldt/libx86emu, but it compiles as a shared library. My OS doesn't support dynamically linked libraries, and I don't know how to patch makefile to build it as a static library, simply an .a archive. Then I found x86emu from archive.org, part of Exclaim project, by Adam Smith. But it looks really old and some part of code is missing.
Where can I found the x86emu / x86emu or how can I patch libx86emu Makefile to build as a static library?
Makefile:
Code: Select all
ARCH := $(shell uname -m)
ifneq ($(filter i386 i486 i586 i686, $(ARCH)),)
ARCH := i386
endif
GIT2LOG := $(shell if [ -x ./git2log ] ; then echo ./git2log --update ; else echo true ; fi)
GITDEPS := $(shell [ -d .git ] && echo .git/HEAD .git/refs/heads .git/refs/tags)
VERSION := $(shell $(GIT2LOG) --version VERSION ; cat VERSION)
BRANCH := $(shell [ -d .git ] && git branch | perl -ne 'print $$_ if s/^\*\s*//')
PREFIX := libx86emu-$(VERSION)
MAJOR_VERSION := $(shell $(GIT2LOG) --version VERSION ; cut -d . -f 1 VERSION)
CC = gcc
CFLAGS = -g -O2 -fPIC -fomit-frame-pointer -Wall
ifneq ($(filter x86_64, $(ARCH)),)
LIBDIR = /usr/lib64
else
LIBDIR = /usr/lib
endif
LIBX86 = libx86emu
CFILES = $(wildcard *.c)
OBJS = $(CFILES:.c=.o)
LIB_NAME = $(LIBX86).so.$(VERSION)
LIB_SONAME = $(LIBX86).so.$(MAJOR_VERSION)
.PHONY: all shared install test clean
%.o: %.c
$(CC) -c $(CFLAGS) $<
all: changelog shared
changelog: $(GITDEPS)
$(GIT2LOG) --changelog changelog
shared: $(LIB_NAME)
install: shared
install -D $(LIB_NAME) $(DESTDIR)$(LIBDIR)/$(LIB_NAME)
ln -snf $(LIB_NAME) $(DESTDIR)$(LIBDIR)/$(LIB_SONAME)
ln -snf $(LIB_SONAME) $(DESTDIR)$(LIBDIR)/$(LIBX86).so
install -m 644 -D include/x86emu.h $(DESTDIR)/usr/include/x86emu.h
$(LIB_NAME): .depend $(OBJS)
$(CC) -shared -Wl,-soname,$(LIB_SONAME) $(OBJS) -o $(LIB_NAME)
test:
make -C test
archive: changelog
@if [ ! -d .git ] ; then echo no git repo ; false ; fi
mkdir -p package
git archive --prefix=$(PREFIX)/ $(BRANCH) > package/$(PREFIX).tar
tar -r -f package/$(PREFIX).tar --mode=0664 --owner=root --group=root --mtime="`git show -s --format=%ci`" --transform='s:^:$(PREFIX)/:' VERSION changelog
xz -f package/$(PREFIX).tar
clean:
make -C test clean
rm -f *.o *~ include/*~ *.so.* .depend
rm -rf package
ifneq "$(MAKECMDGOALS)" "clean"
.depend: $(CFILES)
@$(CC) -MG -MM $(CFLAGS) $(CFILES) >$@
-include .depend
endif