Skip to content

Commit ad8e02e

Browse files
committed
Started draft of build system
1 parent 529faf8 commit ad8e02e

File tree

6 files changed

+3223
-0
lines changed

6 files changed

+3223
-0
lines changed

GNUmakefile

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# This makefile system follows the structuring conventions
2+
# recommended by Peter Miller in his excellent paper:
3+
#
4+
# Recursive Make Considered Harmful
5+
# http://aegis.sourceforge.net/auug97.pdf
6+
7+
## Create a separate build directory for each git branch and for each arch
8+
OBJSUFFIX := $(shell git symbolic-ref -q HEAD | \
9+
sed -e s,refs/heads/,.,)
10+
11+
OBJDIR := obj$(OBJSUFFIX)
12+
13+
TOP := $(shell echo $${PWD-`pwd`})
14+
15+
COMWARNS := -Wformat=2 -Wextra -Wmissing-noreturn \
16+
-Wwrite-strings -Wno-unused-parameter -Wmissing-format-attribute \
17+
-Wswitch-default -fno-builtin
18+
CWARNS := $(COMWARNS) -Wmissing-prototypes -Wmissing-declarations -Wshadow \
19+
-Wbad-function-cast
20+
CXXWARNS := $(COMWARNS) -Wno-non-template-friend -Woverloaded-virtual \
21+
-Wconversion -Wcast-qual -Wunreachable-code -Winline \
22+
-Weffc++ -Wswitch-enum -Wcast-align
23+
OPTFLAG := -O2
24+
INCLUDES := -I$(TOP)/src
25+
26+
27+
CFLAGS := $(OPTFLAG) $(CWARNS) -Werror -std=c99 $(INCLUDES)
28+
CXXFLAGS := $(OPTFLAG) $(CXXWARNS) -Werror -std=c++0x $(INCLUDES)
29+
30+
CC := gcc
31+
CXX := g++
32+
PERL := perl
33+
LINT := python cpplint.py
34+
35+
all:
36+
37+
.SUFFIXES:
38+
39+
include src/server/Makefrag
40+
41+
clean:
42+
rm -rf $(OBJDIR)/.deps $(OBJDIR)/*
43+
44+
CHKFILES := $(shell find $(TOP)/src -name '*.cc' -or -name '*.h' -or -name '*.c')
45+
check:
46+
$(LINT) $(CHKFILES)
47+
48+
# This magic automatically generates makefile dependencies
49+
# for header files included from C source files we compile,
50+
# and keeps those dependencies up-to-date every time we recompile.
51+
# See 'mergedep.pl' for more information.
52+
$(OBJDIR)/.deps: $(foreach dir, $(OBJDIRS), $(wildcard $(OBJDIR)/$(dir)/*.d))
53+
@mkdir -p $(@D)
54+
$(PERL) mergedep.pl $@ $^
55+
56+
-include $(OBJDIR)/.deps
57+
58+
always:
59+
@:
60+
61+
.PHONY: all always clean check

0 commit comments

Comments
 (0)