blob: 0e6304df76a429ea09dfdcc8a484659fbc43f843 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# (c) 2007 The Board of Trustees of the University of Illinois.
# Rules common to all makefiles
########################################
# Environment variable check
########################################
# The second-last directory in the $(BUILDDIR) path
# must have the name "build". This reduces the risk of terrible
# accidents if paths are not set up correctly.
ifeq ("$(notdir $(BUILDDIR))", "")
$(error $$BUILDDIR is not set correctly)
endif
ifneq ("$(notdir $(patsubst %/,%,$(dir $(BUILDDIR))))", "build")
$(error $$BUILDDIR is not set correctly)
endif
########################################
# Derived variables
########################################
OBJS = $(call INBUILDDIR,$(SRCDIR_OBJS))
########################################
# Rules
########################################
clean :
rm -f $(BUILDDIR)/*
if [ -d $(BUILDDIR) ]; then rmdir $(BUILDDIR); fi
ifeq ("$(LINK_MODE)","C")
$(BIN) : $(OBJS)
$(CC) $(LDFLAGS) $^ -o $@ $(LIBS)
endif
$(BUILDDIR) :
mkdir $(BUILDDIR)
$(BUILDDIR)/%.o : $(SRCDIR)/%.c
mkdir -p $(BUILDDIR)
$(CC) $(CFLAGS) -c $< -o $@
$(BUILDDIR)/%.o : $(SRCDIR)/%.cc
mkdir -p $(BUILDDIR)
$(CXX) $(CXXFLAGS) -c $< -o $@
|