merge: expanded accounting-event coverage, rewrote cycle timing
[dcpu16] / Makefile
1 #!make
2 #
3
4 ifeq "$(origin CC)" "default"
5 CC = clang
6 endif
7 ifeq ($(CC),gcc)
8 CPPFLAGS += -DWANT_VARIADIC_VOIDP_CAST
9 endif
10
11
12 PROGRAMS = as-dcpu16 vm-dcpu16
13 SOURCES = common.c dcpu16.c as-dcpu16.c vm-dcpu16.c \
14 hw_clock.c hw_keyboard.c hw_lem1802.c hw_spc2000.c
15
16 CPPFLAGS += -DDEBUG
17
18 CFLAGS = -g -Wall -Wextra -pedantic -std=c99
19
20 UNAME := $(shell uname)
21 ifeq ($(UNAME),Darwin)
22 CPPFLAGS += -DHAVE_FUNOPEN
23 # libpng from system x11, libvncserver from macports
24 CPPFLAGS += -I/usr/X11/include -I/opt/local/include
25 LDFLAGS += -L/usr/X11/lib -L/opt/local/lib
26 endif
27 ifeq ($(UNAME),Linux)
28 # linux needs _GNU_SOURCE for fopencookie
29 # linux needs _XOPEN_SOURCE=600 (provided by _GNU_SOURCE) for getopt and strdup
30 CPPFLAGS += -DHAVE_FOPENCOOKIE -D_GNU_SOURCE
31 # linux needs librt for clock_gettime
32 LDFLAGS += -lrt
33 endif
34
35 CPPFLAGS += -DHAVE_LIBVNCSERVER -DHAVE_LIBPNG
36 LDFLAGS += -lvncserver -lpng -lreadline
37
38 all: $(PROGRAMS)
39
40 depend: .depend
41
42 .depend: $(SOURCES)
43 @rm -f ./.depend
44 $(CC) $(CFLAGS) -MM $^ >> ./.depend
45
46 include .depend
47
48
49 vm-dcpu16: vm-dcpu16.o dcpu16.o common.o hw_clock.o hw_keyboard.o hw_lem1802.o hw_spc2000.o
50
51 as-dcpu16: as-dcpu16.o dcpu16.o common.o
52
53 clean:
54 @rm -rf $(PROGRAMS) *.o *.dSYM .depend
55
56 check: $(PROGRAMS)