summaryrefslogtreecommitdiff
path: root/Makefile
blob: 27426ebf4c721b3f431c8df1e864ee6b33b0fa1a (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
OBJECTS = x86-common.o
CFLAGS = -O2 -Wall -DDEBUG -g

ifeq ($(BACKEND), x86emu)
	OBJECTS += thunk.o x86emu/decode.o x86emu/debug.o x86emu/fpu.o \
	x86emu/ops.o x86emu/ops2.o x86emu/prim_ops.o x86emu/sys.o
else
	OBJECTS += lrmi.o
endif

ifeq ($(LIBRARY), shared)
	CFLAGS += -fPIC
endif

default:
	$(MAKE) LIBRARY=static static
	$(MAKE) objclean
	$(MAKE) LIBRARY=shared shared

static: $(OBJECTS)
	$(AR) cru libx86.a $(OBJECTS)

shared: $(OBJECTS)
	$(CC) $(CFLAGS) -o libx86.so.1 -shared -Wl,-soname,libx86.so.1 $(OBJECTS)

objclean:
	$(MAKE) -C x86emu clean
	rm -f *.o *~

clean: objclean
	rm -f *.so.1 *.a

install: libx86.so.1
	install -D libx86.so.1 $(DESTDIR)/usr/lib/libx86.so.1
	install -D libx86.a $(DESTDIR)/usr/lib/libx86.a
	ln -sf /usr/lib/libx86.so.1 $(DESTDIR)/usr/lib/libx86.so
	install -D lrmi.h $(DESTDIR)/usr/include/libx86.h