source: buchla-emu/Makefile@ 635c507

Last change on this file since 635c507 was 4edbd1c, checked in by Thomas Lopatic <thomas@…>, 7 years ago

Ignore build files. Valgrind target.

  • Property mode set to 100644
File size: 1.4 KB
Line 
1FLAGS := -std=c99 -O2 -gdwarf-4
2
3FLAGS_CPU := $(FLAGS) -I cpu -I build
4
5FLAGS_EMU := $(FLAGS) \
6 -fno-strict-aliasing -fno-inline -fno-omit-frame-pointer \
7 -Wall -Wextra \
8 -Wpedantic -Wconversion -Wsign-conversion -Wshadow \
9 -Wstrict-prototypes -Wmissing-declarations -Wredundant-decls \
10 -I cpu -I emu -I build
11
12FLAGS_LNK := $(FLAGS) -Wall -Wextra
13
14HEADERS := $(wildcard cpu/*.h) $(wildcard emu/*.h)
15
16all: buchla
17
18build:
19 mkdir build
20
21build/gen: | build
22 gcc $(FLAGS) -o build/gen cpu/m68kmake.c
23
24GEN_C := m68kopac.c m68kopdm.c m68kopnz.c m68kops.c
25GEN_H := m68kops.h
26
27GEN_CP := $(GEN_C:%=build/%)
28GEN_HP := $(GEN_H:%=build/%)
29
30GEN_O := $(GEN_C:.c=.o)
31GEN_OP := $(GEN_O:%=build/%)
32
33$(GEN_CP) $(GEN_HP): \
34 build/gen | build
35 cd cpu; ../build/gen ../build
36
37build/%.o: build/%.c $(HEADERS)
38 gcc $(FLAGS_CPU) -c -o $@ $<
39
40CPU_C := m68kcpu.c m68kdasm.c
41CPU_O := $(CPU_C:.c=.o)
42CPU_OP := $(CPU_O:%=build/%)
43
44build/%.o: cpu/%.c $(HEADERS) $(GEN_HP) | build
45 gcc $(FLAGS_CPU) -c -o $@ $<
46
47EMU_C := main.c
48EMU_O := $(EMU_C:.c=.o)
49EMU_OP := $(EMU_O:%=build/%)
50
51build/%.o: emu/%.c $(HEADERS) | build
52 gcc $(FLAGS_EMU) -c -o $@ $<
53
54buchla: $(CPU_OP) $(GEN_OP) $(EMU_OP)
55 gcc $(FLAGS_LNK) -o buchla $(CPU_OP) $(GEN_OP) $(EMU_OP)
56
57val: buchla
58 valgrind --leak-resolution=high --track-fds=yes --leak-check=full \
59 --show-reachable=yes ./buchla
60
61clean:
62 rm -rf build
63 rm -f buchla
Note: See TracBrowser for help on using the repository browser.