[Assorted-commits] SF.net SVN: assorted:[1327] ydb/trunk/src
Brought to you by:
yangzhang
From: <yan...@us...> - 2009-03-24 00:10:25
|
Revision: 1327 http://assorted.svn.sourceforge.net/assorted/?rev=1327&view=rev Author: yangzhang Date: 2009-03-24 00:10:13 +0000 (Tue, 24 Mar 2009) Log Message: ----------- - Makefile updates: - using bash as shell - using TARGET_ARCH appropriately - using mkdeps.py for automatic dependency generation Modified Paths: -------------- ydb/trunk/src/Makefile Added Paths: ----------- ydb/trunk/src/mkdeps.py Modified: ydb/trunk/src/Makefile =================================================================== --- ydb/trunk/src/Makefile 2009-03-23 04:50:10 UTC (rev 1326) +++ ydb/trunk/src/Makefile 2009-03-24 00:10:13 UTC (rev 1327) @@ -2,14 +2,16 @@ # Tool configurations # +SHELL := bash WTF := wtf -# CXX := $(WTF) ag++ -k --Xcompiler # $(CXX) ORIGCXX := $(CXX) CCACHE := ccache export CCACHE_PREFIX := distcc CXX := $(WTF) $(CCACHE) $(CXX) -pipe -# CC := $(CXX) # for linking +TARGET_ARCH := $(shell [[ "$$(uname -m)" == x86_64 ]] && echo -m64 || echo -m32 ) \ + -march=$(shell gcc-config march) + WARNINGS = \ -Wall \ -Werror \ @@ -70,13 +72,8 @@ PPROF := -lprofiler endif -ARCH := $(shell gcc-config march) -CXXFLAGS0 = $(OPT) -pthread $(GPROF) \ - $(WARNINGS) \ - -std=gnu++0x \ - -m64 \ - -march=$(ARCH) \ - $(ORIGCXXFLAGS) +CXXFLAGS0 = $(OPT) -MD -pthread $(GPROF) $(WARNINGS) -std=gnu++0x \ + $(ORIGCXXFLAGS) ifneq ($(PCH),) CXXFLAGS = $(CXXFLAGS0) -include pch.h @@ -171,11 +168,8 @@ # Project-specific rules # -stxn.o: main.hh $(PBHDRS) -main.o: util.hh msg.h $(PBHDRS) -util.o: msg.h $(PBHDRS) -ydb.o: main.hh stxn.hh tpcc.hh util.hh $(PBHDRS) -tpcc.o: main.hh util.hh $(PBHDRS) +include $(shell ./mkdeps.py > deps.mk; echo deps.mk) + ydb: $(OBJS) tpcc/%.o: WARNINGS = \ @@ -201,4 +195,5 @@ serperf: ydb.pb.o ser: ydb.pb.o -ser.o: msg.h + +-include *.d Added: ydb/trunk/src/mkdeps.py =================================================================== --- ydb/trunk/src/mkdeps.py (rev 0) +++ ydb/trunk/src/mkdeps.py 2009-03-24 00:10:13 UTC (rev 1327) @@ -0,0 +1,50 @@ +#!/usr/bin/env python + +from __future__ import with_statement +from subprocess import * +from re import * +from path import path + +pwd = path('.') + +def memoized(f): + cache = {} + return lambda *args: cache[args] if args in cache else cache.setdefault(args, f(*args)) + +def settify(f): return lambda *args: set(f(*args)) + +@memoized +@settify +def hdrs(i): + with file(i) as f: + for line in f: + if search(r'# *include +"', line): + yield i.dirname() / sub(r'.*"(.*)".*', r'\1', line.strip()) + +@memoized +def src(i): + if i.endswith('.hh'): + clamp = path(i[:-3] + '.lzz.clamp') + lzz = path(i[:-2] + '.lzz') + if clamp.isfile(): return clamp + if lzz.isfile(): return lzz + return i + +@memoized +@settify +def deps(i): + for hdr in hdrs(i): yield hdr + for hdr in hdrs(i): + if src(hdr).isfile(): + for dep in deps(src(hdr)): + yield dep + +for i in pwd.glob('*.lzz') + pwd.glob('*.lzz.clamp'): + print sub(r'\.lzz(\.clamp)?', '.o', i), ':', ' '.join(deps(i)) + +for i in pwd.glob('*.d'): + with file(i) as f: + for line in f: + for word in line.split(): + if '.clamp' in word: + print sub(r'(\.clamp/(.+)_lambda_.+\.clamp_h)', r'\1: \2.lzz.clamp', word) Property changes on: ydb/trunk/src/mkdeps.py ___________________________________________________________________ Added: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |