File: Makefile

package info (click to toggle)
aspectc%2B%2B 1%3A1.1%2Bsvn20120529-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 222,560 kB
  • sloc: cpp: 3,935,531; ansic: 18,166; pascal: 14,783; sh: 2,188; makefile: 1,110; python: 340
file content (73 lines) | stat: -rw-r--r-- 1,856 bytes parent folder | download | duplicates (5)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#-------------------------------------------------
# variables 
#-------------------------------------------------

PROG     := cparser

ROOT     ?= $(shell pwd)/../..
TARGET   ?= linux-release

INCDIR   := $(ROOT)/include
LIBDIR   := $(ROOT)/lib/$(TARGET)
OBJDIR   := obj
DEPDIR   := dep

SOURCES  := $(wildcard *.cc) 
OBJECTS  := $(addprefix $(OBJDIR)/,$(SOURCES:.cc=.o))
DEPS     := $(addprefix $(DEPDIR)/,$(SOURCES:.cc=.d))

include $(ROOT)/vars.mk

CPPFLAGS := $(CPPFLAGS) -I$(INCDIR) 
#-L$(LIBDIR)

#-------------------------------------------------
# rules
#-------------------------------------------------

all: showinfo $(PROG)

showinfo:
	@echo 
	@echo "---"
	@echo "Compiling $(PROG) for TARGET=$(TARGET)"
	@echo "  Compiler = $(CXX) $(CPPFLAGS) $(CXXFLAGS)"
	@echo "  Linker   = $(CXX) $(CXXFLAGS) <objects> $(LDFLAGS)"
	@echo "---"
	@echo 

$(PROG): $(OBJECTS)
	@echo "Linking $@..."
	@export LD_LIBRARY_PATH=$(LIBDIR); \
	$(CXX) -o $@ $^ -L$(LIBDIR) $(CXXFLAGS) -Wl,-Bstatic -lPuma -Wl,-Bdynamic $(CPPFLAGS) 
#	$(CXX) -o $@ $^ -L$(LIBDIR) $(CXXFLAGS) -Wl,-Bdynamic -lPuma -Wl,-Bdynamic $(CPPFLAGS) 

clean:
	@echo "Making $(PROG) clean..."
	@rm -f $(PROG)
	@rm -rf $(DEPDIR) $(OBJDIR)

#-------------------------------------------------
# targets
#-------------------------------------------------

$(OBJDIR)/%.o : %.cc
	@echo "Compiling $(filter %.cc,$^)..."
	@mkdir -p $(OBJDIR)
	@$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -g -o $@ $(filter %.cc,$^)

$(DEPDIR)/%.d : %.cc
	@echo "Generating dependencies for $(filter %.cc,$^)..."
	@mkdir -p $(DEPDIR)
	@$(CXX) $(CPPFLAGS) $(CXXFLAGS) -MM $(filter %.cc,$^) | \
	sed -e "s/$*\.o/$(OBJDIR)\/& $(DEPDIR)\/$*.d/g" > $@

.PHONY: clean

#-------------------------------------------------
# includes
#-------------------------------------------------

ifneq ($(MAKECMDGOALS),clean)
-include $(DEPS)
endif