# SPDX-License-Identifier: GPL-2.0-or-later
#
# Schcom builds like any other program that runs *on* SchOS: against the
# sysroot's libc, never against kernel headers. The top-level Makefile passes
# CC, CFLAGS and DESTDIR in; nothing here reaches back up the tree.
#
# It is not part of the OS build. `make` at the top level never descends here --
# `make projects` does.

CC      ?= cc
CFLAGS  ?= -O2
CFLAGS  += -Wall -Wextra -std=c11
DESTDIR ?= ../../sysroot

BINS = schcom schcom-demo

all: $(BINS)

schcom: schcom.c proto.h
	$(CC) $(CFLAGS) -o $@ schcom.c $(LDFLAGS)

schcom-demo: schcom-demo.c proto.h
	$(CC) $(CFLAGS) -o $@ schcom-demo.c $(LDFLAGS)

install: $(BINS)
	mkdir -p $(DESTDIR)/bin
	cp $(BINS) $(DESTDIR)/bin/

clean:
	rm -f $(BINS)

.PHONY: all install clean
