Add Makefile after wiping Chris Graff's code from this repo's history

Why did I wipe someone from my history?

I never used any of Graff's code in my bc. It existed alongside my code
because he asked me to write a parser and virtual machine that would
turn a math library he wrote into a `bc' that would (possibly) be added
to toybox. I agreed and got to work.

That was early January 2018.

Over time, disagreements mounted. I was quickly becoming frustrated. I
did want to get something into toybox, but I didn't know how to write
arbitrary-precision math. However, in mid to late January, I decided,
for kicks, to try to write one from scratch. After two weeks, I had a
*very* basic, but complete, implementation. Graff still hadn't finished
his, so I made the obvious decision to use my own.

Knowing Graff's habit of getting angry easily, I kept that fact secret
until I had finished the `bc' and presented it to toybox's maintainer.

He did get mad, but eventually (no thanks to my failure to communicate
properly with toybox's maintainer), my `bc' was accepted.

Graff showed up two or three weeks later, under the name "Sasha
Toltec", writing to the toybox mailing list that the `bc' was garbage
and that I had stolen it from Graff.

Thankfully, he was found out, and disaster was averted.

To remove any basis for his claim that I stole his work, I am wiping my
repository clean of his code. I am keeping a copy of the repo as it was
before "Sasha" arrived, just in case Graff decides to claim that I did
this illegally or unethically. The original history still shows
otherwise.

If you would like the repo with the original history, please email me
at yzena DOT tech AT gmail DOT com.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..9d442c6
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,89 @@
+#
+# Copyright 2018 Gavin D. Howard
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+#
+
+BC_SRC = $(sort $(wildcard src/*.c))
+BC_OBJ = $(BC_SRC:.c=.o)
+
+GEN = gen
+
+BC_LIB = lib/lib.bc
+
+BC_LIB_C = lib/lib.c
+BC_LIB_O = lib/lib.o
+
+BC_EXEC = bc
+
+PREFIX ?= /usr/local
+
+INSTALL = ./install.sh
+
+-include config.mak
+
+CFLAGS += -Wall -Wextra -pedantic -std=c99 -funsigned-char
+CPPFLAGS += -I./include/ -D_POSIX_C_SOURCE=200809L
+
+LDLIBS += -lm
+
+HOSTCC ?= $(CC)
+
+all: $(BC_EXEC)
+
+help:
+	@echo "available targets:"
+	@echo ""
+	@echo "    all         build bc (uses config.mak if there is one)"
+	@echo "    clean       remove all build files"
+	@echo "    install     install to $(PREFIX)/bin"
+	@echo "    uninstall   uninstall from $(PREFIX)/bin"
+	@echo ""
+	@echo "useful environment variables:"
+	@echo ""
+	@echo "CC        C compiler"
+	@echo "HOSTCC    Host C compiler"
+	@echo "CFLAGS    C compiler flags"
+	@echo "CPPFLAGS  C preprocessor flags"
+	@echo "LDLIBS    Libraries to link to"
+	@echo "PREFIX    the prefix to install to"
+	@echo "          if PREFIX is \"/usr\", $(BC_EXEC) will be installed to \"/usr/bin\""
+	@echo "GEN_EMU   Emulator to run $(GEN) under (leave empty if not necessary)"
+
+$(GEN):
+	$(HOSTCC) -o $(GEN) lib/$(GEN).c
+
+$(BC_LIB_C): $(GEN)
+	$(GEN_EMU) ./$(GEN) $(BC_LIB) $(BC_LIB_C)
+
+$(BC_EXEC): $(BC_OBJ) $(BC_LIB_O)
+	$(CC) $(CFLAGS) -o $(BC_EXEC) $(BC_OBJ) $(BC_LIB_O) $(LDLIBS) $(LDFLAGS)
+
+test:
+	tests/all.sh
+
+clean:
+	$(RM) $(BC_OBJ)
+	$(RM) $(BC_EXEC)
+	$(RM) $(GEN)
+	$(RM) $(BC_LIB_C)
+	$(RM) $(BC_LIB_O)
+	$(RM) tests/parse.txt tests/print.txt tests/arctan.txt
+	$(RM) log_test.txt log_bc.txt
+
+install: $(BC_EXEC)
+	$(INSTALL) -Dm 755 $(BC_EXEC) $(DESTDIR)$(PREFIX)/bin/$(BC_EXEC)
+
+uninstall:
+	rm -rf $(DESTDIR)$(PREFIX)/bin/$(BC_EXEC)
+
+.PHONY: all help clean install uninstall test