shithub: mc

Download patch

ref: 566577d22229f3cf155f96b1c1d4be59b300a8ac
parent: 288347d86a70e880a38627c6db5f66d6c7b690f3
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Sep 23 07:28:16 EDT 2014

Add makefiles.

--- /dev/null
+++ b/Makefile
@@ -1,0 +1,13 @@
+MYRBIN=mbld
+MYRSRC= \
+	main.myr \
+	build.myr \
+	parse.myr \
+	deps.myr \
+	config.myr \
+	opts.myr \
+	util.myr \
+
+include config.mk
+include mk/myr.mk
+
--- a/config.myr
+++ b/config.myr
@@ -1,4 +1,4 @@
 pkg config = 
-const Instroot = "/home/ori/bin"
-const Sys = "Linux"
+const Instroot = "/usr/local"
+const Sys = "OSX"
 ;;
--- /dev/null
+++ b/mk/myr.mk
@@ -1,0 +1,42 @@
+ifneq ($(MYRLIB),)
+    _LIBNAME=lib$(MYRLIB).a
+endif
+
+all: $(_LIBNAME) $(MYRBIN)
+
+$(_LIBNAME): $(MYRSRC) $(ASMSRC)
+	myrbuild -l $(MYRLIB) $^
+
+$(MYRBIN): $(MYRSRC) $(ASMSRC)
+	myrbuild -b $(MYRBIN) $^
+
+OBJ=$(MYRSRC:.myr=.o) $(ASMSRC:.s=.o)
+JUNKASM=$(MYRSRC:.myr=.s)
+USE=$(MYRSRC:.myr=.use) $(MYRLIB)
+.PHONY: clean
+clean:
+	rm -f $(OBJ)
+	rm -f $(USE)
+	rm -f $(JUNKASM) $(CLEANEXTRA)
+	rm -f $(_LIBNAME) $(MYRBIN)
+
+install: install-bin install-lib
+
+install-bin: $(MYRBIN)
+	@if [ ! -z "$(MYRBIN)" ]; then \
+	    echo install $(MYRBIN) $(INST_ROOT)/bin; \
+	    mkdir -p $(INST_ROOT)/bin; \
+	    install $(MYRBIN) $(INST_ROOT)/bin; \
+	fi
+
+install-lib: $(_LIBNAME)
+	@if [ ! -z "$(_LIBNAME)" ]; then \
+		echo install -m 644 $(_LIBNAME) $(INST_ROOT)/lib/myr; \
+		echo install -m 644 $(MYRLIB) $(INST_ROOT)/lib/myr; \
+		mkdir -p $(INST_ROOT)/lib/myr; \
+		install -m 644 $(_LIBNAME) $(INST_ROOT)/lib/myr; \
+		install -m 644 $(MYRLIB) $(INST_ROOT)/lib/myr; \
+	fi
+
+config.mk:
+	./configure