From 63eeae2e150fc4dca0d178c2644db3d5c4a16328 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 16 Sep 2021 18:26:49 +0200 Subject: Improve makefile, style, and gitignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- Makefile | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index da0a418..6b411d7 100644 --- a/Makefile +++ b/Makefile @@ -2,17 +2,27 @@ # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. This file is offered as-is, # without any warranty. +.POSIX: +CXX = c++ -.PHONY: all -all: bin/malloc bin/new bin/alloca +BIN = malloc new alloca +OBJ = $(BIN:=.o) -bin/%: src/%.cc - @mkdir -p bin - $(CXX) -O0 -o $@ $^ +all: $(BIN) +$(OBJ): + +.cc.o: + $(CXX) -c -o $@ $< -O0 + +.o: + $(CXX) -o $@ $< -.PHONY: clean clean: - -rm -r bin + -rm -f -- *.o $(BIN) + +.SUFFIXES: +.SUFFIXES: .o .cc +.PHONY: all clean -- cgit v1.2.3-70-g09d2