From 433e69e5606d7bd0992850a4802d41426e50ab89 Mon Sep 17 00:00:00 2001 From: Nicolas Sauzede Date: Fri, 4 Oct 2019 15:12:54 +0200 Subject: [PATCH] makefile: Recompile V itself also for nix, if needed * Only self rebuild if v.c and v HEAD versions differ --- Makefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Makefile b/Makefile index 9ef8ba60b7..74fa2d2a43 100644 --- a/Makefile +++ b/Makefile @@ -14,8 +14,15 @@ all: ifdef WIN32 $(CC) -std=gnu11 -w -o v0.exe vc/v_win.c ./v0.exe -o v.exe compiler + rm -f v0.exe else $(CC) -std=gnu11 -w -o v vc/v.c -lm + @(VC_V=`./v version | cut -f 3 -d " "`; \ + V_V=`git rev-parse --short HEAD`; \ + if [ $$VC_V != $$V_V ]; then \ + echo "Self rebuild ($$VC_V => $$V_V)"; \ + ./v -o v compiler; \ + fi) endif rm -rf vc/ @echo "V has been successfully built"