all repos — xyw @ 0871170c5656a4e8890a8779e8bb6b17b09896c2

A minimal virtual machine and assembler for terminals.

Makefile

 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
 42
 43
 44
 45
 46
 47
 48
CC = gcc
CFLAGS = -Wall -Wextra -g

SOURCES = xyw.c xywasm.c xywrun.c devices/system.c devices/terminal.c devices/clock.c devices/file.c devices/beeper.c
OBJS = xyw.o xywasm.o xywrun.o devices/system.o devices/terminal.o devices/clock.o devices/file.o devices/beeper.o

# Platform-specific linker flags for miniaudio
UNAME_S := $(shell uname -s 2>/dev/null || echo Windows)
ifeq ($(UNAME_S),Darwin)
	LDFLAGS += -framework CoreAudio -framework AudioToolbox
else ifeq ($(UNAME_S),Linux)
	LDFLAGS += -lpthread -lm -ldl
else
	# Windows (via MinGW/MSYS)
	LDFLAGS += -lole32
endif

.PHONY: clean

xyw: $(OBJS)
	$(CC) $(CFLAGS) $(OBJS) -o xyw $(LDFLAGS)

xyw.o: xyw.c xyw.h
	$(CC) $(CFLAGS) -c xyw.c -o xyw.o

xywrun.o: xywrun.c xyw.h
	$(CC) $(CFLAGS) -c xywrun.c -o xywrun.o

xywasm.o: xywasm.c xyw.h
	$(CC) $(CFLAGS) -c xywasm.c -o xywasm.o

devices/system.o: devices/system.c xyw.h
	$(CC) $(CFLAGS) -c devices/system.c -o devices/system.o

devices/terminal.o: devices/terminal.c xyw.h
	$(CC) $(CFLAGS) -c devices/terminal.c -o devices/terminal.o

devices/clock.o: devices/clock.c xyw.h
	$(CC) $(CFLAGS) -c devices/clock.c -o devices/clock.o

devices/file.o: devices/file.c xyw.h
	$(CC) $(CFLAGS) -c devices/file.c -o devices/file.o

devices/beeper.o: devices/beeper.c devices/miniaudio.h xyw.h
	$(CC) $(CFLAGS) -c devices/beeper.c -o devices/beeper.o

clean:
	rm -f xyw xyw.exe $(OBJS)