From a0582692a2630f42b8e64d6baaab001a793fcf3c Mon Sep 17 00:00:00 2001 From: Steven Noonan Date: Sat, 10 Oct 2009 04:09:33 -0700 Subject: Makefiles: unifying makefile.unix and makefile_tiles.unix, and cleaning up Lots of major build changes here: - No longer have multiple makefiles for Linux, Mac, MinGW, etc. - To build a USE_TILE build, simply do 'make TILES=y'. - Makefiles now use a much prettier output while building. To see verbose messages, add 'V=1' to the command-line for 'make'. - Lots of weird dependency bugs corrected in the Makefiles. - makefile.unix now works for Mac OS X builds too (both tiles and ASCII builds). - Added GCC precompiled header support to makefile.unix. In my tests, it doesn't add much of a speedup, if any, but it's at least convenient to have it implemented. To use it, add 'PCH=y' to your 'make' command line. - Added fastdep support, and enabled by default on machines with fastdep installed. This allows for the Makefile to be sensitive to changed header files (recompiling those source files that are affected by the changes). If fastdep isn't installed, you can still use the the old (and much slower) GCC built-in dependency generator, but it's not enabled by default. Signed-off-by: Steven Noonan --- crawl-ref/source/util/Makefile | 26 ++++++++++++++++++++++++++ crawl-ref/source/util/lua/src/Makefile | 22 +++++++++++++++++----- crawl-ref/source/util/sqlite/Makefile | 17 +++++++++++++---- 3 files changed, 56 insertions(+), 9 deletions(-) create mode 100644 crawl-ref/source/util/Makefile (limited to 'crawl-ref/source/util') diff --git a/crawl-ref/source/util/Makefile b/crawl-ref/source/util/Makefile new file mode 100644 index 0000000000..2e61683b21 --- /dev/null +++ b/crawl-ref/source/util/Makefile @@ -0,0 +1,26 @@ +YACC := bison -y +LEX := flex + +ifneq ($(findstring $(MAKEFLAGS),s),s) +ifndef V + QUIET_YACC = @echo ' ' YACC $@; + QUIET_LEX = @echo ' ' LEX $@; + export V +endif +endif + +all: levcomp.tab.cc levcomp.lex.cc + +clean: + rm -f levcomp.tab.cc levcomp.tab.h + rm -f levcomp.lex.cc + rm -f *.o + +%.tab.cc: %.tab.c + @mv $< $@ + +%.lex.cc: %.lpp + $(QUIET_LEX)$(LEX) -o$@ $< + +%.tab.c: %.ypp + $(QUIET_YACC)$(YACC) -d -b $* $< diff --git a/crawl-ref/source/util/lua/src/Makefile b/crawl-ref/source/util/lua/src/Makefile index d5f5222207..d6cd279837 100644 --- a/crawl-ref/source/util/lua/src/Makefile +++ b/crawl-ref/source/util/lua/src/Makefile @@ -9,6 +9,15 @@ # Your platform. See PLATS for possible values. PLAT= none +ifneq ($(findstring $(MAKEFLAGS),s),s) +ifndef V + QUIET_CC = @echo ' ' CC $@; + QUIET_AR = @echo ' ' AR $@; + QUIET_LINK = @echo ' ' LINK $@; + export V +endif +endif + CC= gcc CFLAGS= -O2 -Wall $(MYCFLAGS) AR= ar rcu @@ -46,19 +55,22 @@ default: $(PLAT) all: $(ALL_T) +%.o: %.c + $(QUIET_CC)$(CC) -c $(CFLAGS) -o $@ $< + o: $(ALL_O) a: $(ALL_A) $(LUA_A): $(CORE_O) $(LIB_O) - $(AR) $@ $? - $(RANLIB) $@ + $(QUIET_AR)$(AR) $@ $? + @$(RANLIB) $@ $(LUA_T): $(LUA_O) $(LUA_A) - $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) + $(QUIET_LINK)$(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) $(LUAC_T): $(LUAC_O) $(LUA_A) - $(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) + $(QUIET_LINK)$(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) clean: $(RM) $(ALL_T) $(ALL_O) @@ -116,7 +128,7 @@ mingw: $(MAKE) "LUAC_T=luac.exe" luac.exe crawl_unix: - $(MAKE) "LUA_A=liblua.a" \ + @$(MAKE) "LUA_A=liblua.a" \ "MYCFLAGS=" "MYLIBS=" "MYLDFLAGS=" liblua.a crawl_mingw: crawl_unix diff --git a/crawl-ref/source/util/sqlite/Makefile b/crawl-ref/source/util/sqlite/Makefile index 01a73c4392..6f9686fbd8 100644 --- a/crawl-ref/source/util/sqlite/Makefile +++ b/crawl-ref/source/util/sqlite/Makefile @@ -1,5 +1,13 @@ # -*- Makefile -*- for stripped down SQLite 3 static lib. +ifneq ($(findstring $(MAKEFLAGS),s),s) +ifndef V + QUIET_CC = @echo ' ' CC $@; + QUIET_AR = @echo ' ' AR $@; + export V +endif +endif + LIBSQL = libsqlite3.a AR = ar rcu CC = gcc @@ -22,7 +30,8 @@ CFLAGS = -DSQLITE_OMIT_AUTHORIZATION \ -DSQLITE_OMIT_SCHEMA_VERSION_PRAGMAS \ -DSQLITE_OMIT_TCL_VARIABLE \ -DSQLITE_OMIT_LOAD_EXTENSION \ - -DTHREADSAFE=0 + -DTHREADSAFE=0 \ + -w all: $(LIBSQL) @@ -31,8 +40,8 @@ clean: $(RM_F) *.a $(LIBSQL): sqlite3.o - $(AR) $@ $^ - $(RANLIB) $@ + $(QUIET_AR)$(AR) $@ $^ + @$(RANLIB) $@ %.o: %.c - $(CC) $(CFLAGS) -o $@ -c $< + $(QUIET_CC)$(CC) $(CFLAGS) -o $@ -c $< -- cgit v1.2.3-54-g00ecf