aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: a49e8204e159bfd09d99c3bb6349a7e0907fb36d (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
38
39
40
41
# common
CC 	:= gcc
CFLAGS	:= -Wpedantic -s -O2 -Wall -I. -I./Nuked-OPL3
LDFLAGS	:= 

# only for the vm player
SDL2_CONFIG 	:= sdl2-config
OPL3_PATH	:= `realpath ./Nuked-OPL3`
LIBS		:= `$(SDL2_CONFIG) --libs` -L$(OPL3_PATH) -Wl,-rpath,$(OPL3_PATH) -lopl3

all: tr8as tr8vm

tr8vm: tr8vm.c vm.o vm.h
	make -C Nuked-OPL3
	$(CC) -std=c99 $(CFLAGS) `$(SDL2_CONFIG) --cflags` $< vm.o `$(SDL2_CONFIG) --libs` $(LIBS) -o $@

tr8as: tr8as.c stb_image.o
	$(CC) -std=c99 $(CFLAGS) -DDO_MAIN $< stb_image.o -o $@ -lm

vm.o: vm.c vm.h
	$(CC) -c -std=c89 $(CFLAGS) $< -o $@

stb_image.o: stb_image.c stb_image.h
	$(CC) -c -std=c99 $(CFLAGS) $< -o $@

example: example.tr8 tr8vm
	./tr8vm example.tr8

game:
	make -C game run

example.tr8: example.asm assets/icon.png tr8as
	./tr8as example.asm example.tr8

clean:
	make -C game clean
	make -C Nuked-OPL3
	rm -f tr8as tr8vm example.tr8 *.o

.PHONY: clean all example game