summary refs log tree commit diff
path: root/Makefile
diff options
context:
space:
mode:
authorQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-03-28 12:53:53 -0400
committerQuentin Carbonneaux <quentin.carbonneaux@yale.edu>2016-03-29 10:10:22 -0400
commitb75cb8388fb9b5f2393443d008bb46c522c5ec9b (patch)
tree25268fe5f71d826ee1f8f0e3a2a82aa68f9bf750 /Makefile
parent1b4943eb1f2a10837f56070bfe604179d0dc10e0 (diff)
downloadroux-b75cb8388fb9b5f2393443d008bb46c522c5ec9b.tar.gz
new layout, put LICENSE in root
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile45
1 files changed, 39 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 9aefa3e..7c2bec8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,41 @@
-all clean check:
-	@make -C src $@
-	@make -C minic $@
+BIN = qbe
 
-sync-papers:
-	unison -auto papers ssh://qcar@h/data/d/ssa-doc
+V = @
+OBJDIR = obj
 
-.PHONY: all clean check sync-papers
+SRC = main.c util.c parse.c mem.c ssa.c copy.c live.c isel.c spill.c rega.c emit.c
+OBJ = $(SRC:%.c=$(OBJDIR)/%.o)
+
+CFLAGS += -Wall -Wextra -std=c99 -g -pedantic
+
+$(OBJDIR)/$(BIN): $(OBJ) $(OBJDIR)/timestamp
+	@echo "ld $@"
+	$(V)$(CC) $(LDFLAGS) $(OBJ) -o $@
+
+$(OBJDIR)/%.o: %.c $(OBJDIR)/timestamp
+	@echo "cc $<"
+	$(V)$(CC) $(CFLAGS) -c $< -o $@
+
+$(OBJDIR)/timestamp:
+	@mkdir -p $(OBJDIR)
+	@touch $@
+
+$(OBJ): all.h
+obj/main.o: config.h
+
+config.h:
+	@case `uname` in                                \
+	*Darwin*) echo "#define Defaultasm Gasmacho" ;; \
+	*Linux*)  echo "#define Defaultasm Gaself" ;;   \
+	esac > $@
+
+clean:
+	rm -fr $(OBJDIR)
+
+clean-gen: clean
+	rm -f config.h
+
+check: $(OBJDIR)/$(BIN)
+	tools/unit.sh all
+
+.PHONY: clean clean-gen check syndoc