# DVX Tools Makefile
#
# Builds native (host) utilities. These run on the development machine
# (Linux or DOS), not on the target. No cross-compilation needed.

CC      = gcc
CFLAGS  = -O2 -Wall -Wextra -I../core

BINDIR  = ../bin

.PHONY: all clean

CONFIGDIR = ../bin/config

all: $(BINDIR)/dvxres $(BINDIR)/mkicon $(BINDIR)/mktbicon $(BINDIR)/mkwgticon $(BINDIR)/bmp2raw $(CONFIGDIR)/SPLASH.RAW

$(BINDIR)/dvxres: dvxres.c ../core/dvxResource.c ../core/dvxResource.h | $(BINDIR)
	$(CC) $(CFLAGS) -o $@ dvxres.c ../core/dvxResource.c

$(BINDIR)/mkicon: mkicon.c | $(BINDIR)
	$(CC) $(CFLAGS) -o $@ mkicon.c -lm

$(BINDIR)/mktbicon: mktbicon.c | $(BINDIR)
	$(CC) $(CFLAGS) -o $@ mktbicon.c

$(BINDIR)/mkwgticon: mkwgticon.c | $(BINDIR)
	$(CC) $(CFLAGS) -o $@ mkwgticon.c

$(BINDIR)/bmp2raw: bmp2raw.c | $(BINDIR)
	$(CC) $(CFLAGS) -o $@ bmp2raw.c

$(CONFIGDIR)/SPLASH.RAW: $(BINDIR)/bmp2raw ../assets/splash.bmp | $(CONFIGDIR)
	$(BINDIR)/bmp2raw ../assets/splash.bmp $@

$(BINDIR):
	mkdir -p $(BINDIR)

$(CONFIGDIR):
	mkdir -p $(CONFIGDIR)

clean:
	rm -f $(BINDIR)/dvxres
