### Makefile  -*- Makefile -*-
## Build small machine abstraction library (or, rather, the examples.)

### Ivan Shmakov, 2020, 2022

## To the extent possible under law, the author(s) have dedicated
## all copyright and related and neighboring rights to this software
## to the public domain worldwide.  This software is distributed
## without any warranty.

## You should have received a copy of the CC0 Public Domain Dedication
## along with this software.  If not, see
## <http://creativecommons.org/publicdomain/zero/1.0/>.

### History:

## 0.1  2022-10-09
##      Initial revision, adapted from threespi-2020/Makefile.

### Code:

srcdir  = .
VPATH   = $(srcdir):$(srcdir)/$(MACHINE):$(srcdir)/examples

MACHINE = gnu

.PHONY: all
all: readypin uart-spi

include $(srcdir)/Makefile.$(MACHINE)

## FIXME: looks somewhat more verbose than necessary

CFLAGS_1    = -std=gnu11 -Wall -pedantic -O2 -g
CPPFLAGS_RDY    = -DREADYLED_DELAY="(2 * 4)" -DREADYLED_PAUSE="(-3 * 4)" \
                  -DREADYLED_PORT_INVERSE=0
CPPFLAGS_RYP    = -DREADYPIN_BUTTON_SHIFT="(5 + 8)"
CPPFLAGS_INC    = -I$(srcdir)/$(MACHINE) -I$(srcdir)/include
CPPFLAGS_1      = -D_GNU_SOURCE $(CPPFLAGS_INC) \
                  $(CPPFLAGS_RDY) $(CPPFLAGS_RYP)

readypin:   readypin.o
readypin.o: readypin.c machine.h include/readyled.h

uart-spi:   uart-spi.o
uart-spi.o: uart-spi.c machine.h include/readyled.h

### Makefile ends here
