Page 1 of 1

the annoying make problem (split from: C++ conversion)

Posted: 18 Sep 2012, 20:51
by Jenalya
Not entirely on-topic, but while trying around to compile the cxx branch, it was really annoying to have to do
mkdir -p obj/{common,login,char,map,ladmin,tool} after each make clean, so what do you think about this (created with help of Pjotr Orial):

Code: Select all

From 1341e53a28a9859fbce2883ea26b56e46b5aeadc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jessica=20T=C3=B6lke?= <jtoelke@mail.upb.de>
Date: Tue, 18 Sep 2012 22:44:27 +0200
Subject: [PATCH] Create needed directories via makefile.

---
 GNUmakefile |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/GNUmakefile b/GNUmakefile
index a8914f8..13bef01 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -1,7 +1,8 @@
 #! /usr/bin/make -f
 SHELL=/bin/bash
 BUILD_DIR = obj
-default: login-server char-server map-server ladmin eathena-monitor
+default: dir
+	$(MAKE) login-server char-server map-server ladmin eathena-monitor
 .DELETE_ON_ERROR:
 include make.defs
 
@@ -42,6 +43,8 @@ clean:
 	rm -rf ${PROGS} ${BUILD_DIR}/
 common: ${BUILD_DIR}/common/core.o ${BUILD_DIR}/common/db.o ${BUILD_DIR}/common/grfio.o ${BUILD_DIR}/common/lock.o ${BUILD_DIR}/common/md5calc.o ${BUILD_DIR}/common/mt_rand.o ${BUILD_DIR}/common/nullpo.o ${BUILD_DIR}/common/socket.o ${BUILD_DIR}/common/timer.o ${BUILD_DIR}/common/utils.o
 
+dir:
+	mkdir -p obj/{common,login,char,map,ladmin,tool}
 # Top level programs
 login-server: ${BUILD_DIR}/login/login
 	cp -f $< $@
-- 
1.7.9.5

Re: the annoying make problem (split from: C++ conversion)

Posted: 18 Sep 2012, 21:31
by o11c
What about just adding the "make dir" target, which would have to be called manually? That avoids the recursive call (recursive make == bad).

I do have a working replacement build system that fixes this among other problems, but I want to polish it a bit more and I need to rewrite the related "configure" a few times.

Re: the annoying make problem (split from: C++ conversion)

Posted: 19 Sep 2012, 11:23
by Jenalya
o11c wrote:What about just adding the "make dir" target, which would have to be called manually? That avoids the recursive call (recursive make == bad).
Though that'd be better than nothing, it's still cumbersome. And for people who are new to the project still a possible source of confusing compiling problems.
What problem could be caused by the recursive call in this case?

Re: the annoying make problem (split from: C++ conversion)

Posted: 01 Oct 2012, 17:51
by o11c
I managed to bypass the dreaded normalization stage of make 3.81, and have pushed a fix on the 'test' and 'cxx' branches (which are currently identical).

I haven't tested with make 3.82 yet, but I'm pretty sure it won't break anything. I will test before pushing to master, of course.