From b2898fb7d67369f7b6809563bae41c60ffb46a10 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Tue, 13 Sep 2022 20:52:13 +0100 Subject: (Emacs)+object based compilation for Makefile auto insert Faster overall, incremental compilation. --- Emacs/.config/emacs/config.org | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'Emacs/.config/emacs/config.org') diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org index 1bb518d..018d7b9 100644 --- a/Emacs/.config/emacs/config.org +++ b/Emacs/.config/emacs/config.org @@ -922,23 +922,27 @@ as well. "" "CC=g++ CFLAGS=-Wall -ggdb -FILES=main.cpp +OBJECTS=main.o OUT=main +ARGS= -$(OUT): $(FILES) - $(CC) $(CFLAGS) $^ -o $@ +%.o: %.cpp + $(CC) $(CFLAGS) -c $^ -o $@ + +$(OUT): $(OBJECTS) + $(CC) $(CFLAGS) $^ -o $@ .PHONY: clean: - rm -rfv $(OUT) + rm -rfv $(OUT) $(OBJECTS) .PHONY: run run: $(OUT) - ./$^ + ./$^ $(ARGS) .PHONY: memcheck memcheck: $(OUT) - valgrind --tool=memcheck ./$^" + sh /etc/profile.d/debuginfod.sh && valgrind --leak-check=full -s --tool=memcheck ./$^ $(ARGS)" _))) #+end_src *** Yasnippet default -- cgit v1.2.3-13-gbd6f