From 679a3b17fa169a7838ba321616ad703ba8a8aa6d Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Thu, 22 Jul 2021 16:24:04 +0100 Subject: [PATCH 1/2] Install to /usr/local by default when using Makefiles Software should install to /usr/local by default, as /usr is for the operating system managed libraries. Closes #52. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e5222f9..d0e4614 100644 --- a/Makefile +++ b/Makefile @@ -40,8 +40,8 @@ else $(error "Platform '$(SYSTEM)' not supported") endif -GLEW_PREFIX ?= /usr -GLEW_DEST ?= /usr +GLEW_PREFIX ?= /usr/local +GLEW_DEST ?= /usr/local BINDIR ?= $(GLEW_DEST)/bin LIBDIR ?= $(GLEW_DEST)/lib INCDIR ?= $(GLEW_DEST)/include/GL From 767e0316450911f1158bd4f7fd8dcd066bae5c55 Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Thu, 22 Jul 2021 16:31:11 +0100 Subject: [PATCH 2/2] Fix build race in Makefile The current rule for the binaries is: glew.bin: glew.lib bin bin/$(GLEWINFO.BIN) bin/$(VISUALINFO.BIN) In parallel builds, all of those targets happen at the same time. This means that 'bin' can happen *after* 'bin/$(GLEWINFO.BIN)', which is a problem as the 'bin' target's responsibility is to create the directory that the other target writes into. Solve this by not having a separate 'create directory' target which is fundamentally racy, and simply mkdir in each target which writes into it. --- Makefile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index d0e4614..04af44c 100644 --- a/Makefile +++ b/Makefile @@ -171,21 +171,20 @@ VISUALINFO.BIN.OBJ := $(VISUALINFO.BIN.OBJ:.c=.o) # Don't build glewinfo or visualinfo for NaCL, yet. ifneq ($(filter nacl%,$(SYSTEM)),) -glew.bin: glew.lib bin +glew.bin: glew.lib else -glew.bin: glew.lib bin bin/$(GLEWINFO.BIN) bin/$(VISUALINFO.BIN) +glew.bin: glew.lib bin/$(GLEWINFO.BIN) bin/$(VISUALINFO.BIN) endif -bin: - mkdir bin - bin/$(GLEWINFO.BIN): $(GLEWINFO.BIN.OBJ) $(LIB.SHARED.DIR)/$(LIB.SHARED) + @mkdir -p $(dir $@) $(CC) $(CFLAGS) -o $@ $(GLEWINFO.BIN.OBJ) $(BIN.LIBS) ifneq ($(STRIP),) $(STRIP) -x $@ endif bin/$(VISUALINFO.BIN): $(VISUALINFO.BIN.OBJ) $(LIB.SHARED.DIR)/$(LIB.SHARED) + @mkdir -p $(dir $@) $(CC) $(CFLAGS) -o $@ $(VISUALINFO.BIN.OBJ) $(BIN.LIBS) ifneq ($(STRIP),) $(STRIP) -x $@