all repos — xyw @ 8b40e451fc046ce1eb659c98afa6f6b79fc55dba

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
 49
CC = gcc
CFLAGS = -Wall -Wextra -g
SOURCES = xyw.c xywasm.c xywrun.c devices/console.c devices/clock.c devices/display.c
OBJS = xyw.o xywasm.o xywrun.o devices/console.o devices/clock.o devices/display.o

# Detect platform for fenster build flags
UNAME_S := $(shell uname -s 2>/dev/null)
ifeq ($(OS),Windows_NT)
	PLATFORM := windows
else ifeq ($(UNAME_S),Darwin)
	PLATFORM := macos
else
	PLATFORM := linux
endif

# Platform-specific flags for fenster (window + audio)
ifeq ($(PLATFORM),windows)
	FENSTER_LDFLAGS := -lgdi32 -lwinmm
else ifeq ($(PLATFORM),macos)
	FENSTER_LDFLAGS := -framework Cocoa -framework AudioToolbox
else
	FENSTER_LDFLAGS := -lX11 -lasound
endif

.PHONY: clean

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

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

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

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

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

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

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

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