-# All files in platform/example/functions/_PDCLIB (for development only)
-PATCHFILES1 := $(shell ls platform/example/functions/_PDCLIB/*.c)
-# All files in platform/example/functions/stdlib (for development only)
-PATCHFILES2 := $(shell ls platform/example/functions/stdlib/*.c)
+WARNINGS := -Wall -Wextra -pedantic -Wno-unused-parameter -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -Wno-long-long -Wuninitialized -Wstrict-prototypes
+PLATFORM_FLAGS=-mlittle-endian -mthumb -mcpu=$(CPU) -ffreestanding
+CFLAGS := -Os -g -std=c99 -I./$(BUILD)/internals -I./testing $(WARNINGS) $(USERFLAGS) $(PLATFORM_FLAGS)
+
+.PHONY: all clean srcdist bindist test tests testdrivers regtests regtestdrivers todos fixmes find links unlink help
+
+PDCLIBNAME=libpdclib
+PDCLIB=$(PDCLIBNAME)-$(CPU).a
+
+all:
+ +for i in $(CPUS); do make CPU=$$i links; make CPU=$$i $(PDCLIBNAME)-$$i.a; done
+
+install: install-hdr
+ @echo '######' install
+ +for i in $(CPUS); do make CPU=$$i prefix=$(prefix) install-lib-$$i; done
+
+install-hdr:
+ @echo '######' install-hdr
+ +make CPU=$(FIRSTCPU) prefix=$(prefix) install-hdr-$(FIRSTCPU)
+
+clean:
+ +for i in $(CPUS); do make CPU=$$i clean-$$i; rm -rf build-$$i; done
+
+check: all testdrivers regtestdrivers
+ @echo
+ @echo "========================"
+ @echo "Executing library tests:"
+ @echo "========================"
+ @echo
+ @$(MAKE) tests | grep -v "^ TST" | grep -v "^Failed"
+ @echo
+ @echo "==========================="
+ @echo "Executing regression tests:"
+ @echo "==========================="
+ @echo
+ @$(MAKE) regtests | grep -v "^ RTST" | grep -v "^Failed"
+
+$(PDCLIB): $(BUILD) $(OBJFILES)
+ @echo " AR $@"
+ @ar rc $@ $(OBJFILES)
+ @echo