v1.7 spec mostly implemented, mostly untested
[dcpu16] / Makefile
1 #!make
2 #
3
4 ifeq "$(origin CC)" "default"
5 CC = clang
6 endif
7
8 PROGRAMS = as-dcpu16 vm-dcpu16
9 SOURCES = common.c dcpu16.c as-dcpu16.c vm-dcpu16.c display.c
10
11 CPPFLAGS += -DDEBUG
12
13 CPPFLAGS += -DHAVE_LIBPNG -I/usr/X11/include/
14 CFLAGS = -g -Wall -Wextra -pedantic -std=c99
15 LDFLAGS += -lreadline
16 LDFLAGS += -L/usr/X11/lib -lpng
17
18 UNAME := $(shell uname)
19 ifeq ($(UNAME),Darwin)
20 CPPFLAGS += -DHAVE_FUNOPEN
21 endif
22 ifeq ($(UNAME),Linux)
23 # linux needs _GNU_SOURCE for fopencookie
24 # linux needs _XOPEN_SOURCE=600 (provided by _GNU_SOURCE) for getopt and strdup
25 CPPFLAGS += -DHAVE_FOPENCOOKIE -D_GNU_SOURCE
26 endif
27
28
29 all: $(PROGRAMS)
30
31 depend: .depend
32
33 .depend: $(SOURCES)
34 @rm -f ./.depend
35 $(CC) $(CFLAGS) -MM $^ >> ./.depend
36
37 include .depend
38
39
40 vm-dcpu16: vm-dcpu16.o dcpu16.o common.o display.o
41
42 as-dcpu16: as-dcpu16.o dcpu16.o common.o
43
44 clean:
45 @rm -rf $(PROGRAMS) *.o *.dSYM .depend
46
47 check: $(PROGRAMS)