|
1 # This Source Code Form is subject to the terms of the Mozilla Public |
|
2 # License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
|
4 |
|
5 # Redefine this to something that makes sense for you. |
|
6 MOZ_SRC=/usr/src/seamonkey-clean/mozilla |
|
7 MKLINKSCRIPT=$(MOZ_SRC)/config/mklinkscript.pl |
|
8 |
|
9 ifdef DEBUG |
|
10 CFLAGS=-g -Wall |
|
11 CXXFLAGS=-g -Wall |
|
12 else |
|
13 CFLAGS=-O2 |
|
14 CXXFLAGS=-O2 |
|
15 endif |
|
16 |
|
17 ifdef PROFILE |
|
18 CFLAGS += -pg -g |
|
19 CXXFLAGS += -pg -g |
|
20 endif |
|
21 |
|
22 TARGETS=\ |
|
23 libmcount.so \ |
|
24 libcygprof.so \ |
|
25 addrs2text \ |
|
26 garope \ |
|
27 grope \ |
|
28 histogram \ |
|
29 mapaddrs \ |
|
30 rseed \ |
|
31 test \ |
|
32 $(NULL) |
|
33 |
|
34 all: $(TARGETS) |
|
35 |
|
36 libmcount.so: mcount.c |
|
37 $(CC) -shared $(CFLAGS) -o $@ $< |
|
38 |
|
39 libcygprof.so: cygprof.c |
|
40 $(CC) -shared $(CFLAGS) -o $@ $< |
|
41 |
|
42 addrs2text: addrs2text.o |
|
43 |
|
44 garope: garope.cpp elf_symbol_table.o elf_utils.o |
|
45 grope: grope.cpp elf_symbol_table.o elf_utils.o |
|
46 histogram: histogram.cpp elf_symbol_table.o elf_utils.o |
|
47 mapaddrs: mapaddrs.cpp elf_symbol_table.o elf_utils.o |
|
48 rseed: rseed.c |
|
49 elf_symbol_table.o: elf_symbol_table.cpp elf_symbol_table.h elf_utils.h interval_map.h |
|
50 elf_utils.o: elf_utils.cpp elf_utils.h |
|
51 |
|
52 # Build these with -pg so we get profiling info |
|
53 TEST_CFLAGS=-ffunction-sections -finstrument-functions -O2 |
|
54 |
|
55 test: test.o mult.o test.ldscript |
|
56 $(CXX) -Wl,-T,test.ldscript -O2 -o $@ $^ |
|
57 |
|
58 test.ldscript: test.order $(MKLINKSCRIPT) |
|
59 perl $(MKLINKSCRIPT) -o $@ $< |
|
60 |
|
61 # This should really be generated by one of the fine tools, above. If |
|
62 # it hasn't been, create an empty ordering file. |
|
63 test.order: |
|
64 touch $@ |
|
65 |
|
66 mult.o: mult.c |
|
67 $(CC) $(TEST_CFLAGS) -c -o $@ $< |
|
68 |
|
69 test.o: test.cpp |
|
70 $(CXX) $(TEST_CFLAGS) -c -o $@ $< |
|
71 |
|
72 clean: |
|
73 rm -f $(TARGETS) test.ldscript *.o *~ core |
|
74 |