File: Makefile

package info (click to toggle)
libelfin 0.3-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 668 kB
  • sloc: cpp: 4,883; makefile: 189; python: 139; sh: 129; ansic: 10
file content (76 lines) | stat: -rw-r--r-- 2,455 bytes parent folder | download | duplicates (3)
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
74
75
76
# Changed when ABI backwards compatibility is broken.
# Typically uses the major version.
SONAME = 0

LIBVERSION = $(shell git describe --match 'v*' | sed -e s/^v//)

CXXFLAGS+=-g -O2 -Werror
override CXXFLAGS+=-std=c++0x -Wall -fPIC

all: libdwarf++.a libdwarf++.so.$(SONAME) libdwarf++.so libdwarf++.pc

SRCS := dwarf.cc cursor.cc die.cc value.cc abbrev.cc \
	expr.cc rangelist.cc line.cc attrs.cc \
	die_str_map.cc elf.cc to_string.cc
HDRS := dwarf++.hh data.hh internal.hh small_vector.hh ../elf/to_hex.hh
CLEAN :=

libdwarf++.a: $(SRCS:.cc=.o)
	ar rcs $@ $^
CLEAN += libdwarf++.a $(SRCS:.cc=.o)

$(SRCS:.cc=.o): $(HDRS)

to_string.cc: ../elf/enum-print.py dwarf++.hh data.hh Makefile
	@echo "// Automatically generated by make at $$(date)" > to_string.cc
	@echo "// DO NOT EDIT" >> to_string.cc
	@echo >> to_string.cc
	@echo '#include "internal.hh"' >> to_string.cc
	@echo >> to_string.cc
	@echo 'DWARFPP_BEGIN_NAMESPACE' >> to_string.cc
	@echo >> to_string.cc
	python3 ../elf/enum-print.py < dwarf++.hh >> to_string.cc
	python3 ../elf/enum-print.py -s _ -u --hex -x hi_user -x lo_user < data.hh >> to_string.cc
	@echo 'DWARFPP_END_NAMESPACE' >> to_string.cc
CLEAN += to_string.cc

libdwarf++.so.$(SONAME): $(SRCS:.cc=.o)
	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -Wl,-soname,$@ -o $@ $^
CLEAN += libdwarf++.so.*

libdwarf++.so:
	ln -s $@.$(SONAME) $@
CLEAN += libdwarf++.so

# Create pkg-config for local library and headers. This will be
# transformed in to the correct global pkg-config by install.
libdwarf++.pc: always
	@(echo "libdir=$$PWD"; \
	  echo "includedir=$$PWD"; \
	  echo ""; \
	  echo "Name: libdwarf++"; \
	  echo "Description: C++11 DWARF library"; \
	  echo "Version: $(LIBVERSION)"; \
	  echo "Requires: libelf++ = $(LIBVERSION)"; \
	  echo "Libs: -L\$${libdir} -ldwarf++"; \
	  echo "Cflags: -I\$${includedir}") > $@
CLEAN += libdwarf++.pc

.PHONY: always

PREFIX?=/usr/local

install: libdwarf++.a libdwarf++.so.$(SONAME) libdwarf++.so libdwarf++.pc
	install -d $(PREFIX)/lib/pkgconfig
	install -t $(PREFIX)/lib libdwarf++.a
	install -t $(PREFIX)/lib libdwarf++.so.$(SONAME)
	install -t $(PREFIX)/lib libdwarf++.so
	install -d $(PREFIX)/include/libelfin/dwarf
	install -t $(PREFIX)/include/libelfin/dwarf data.hh dwarf++.hh small_vector.hh
	sed 's,^libdir=.*,libdir=$(PREFIX)/lib,;s,^includedir=.*,includedir=$(PREFIX)/include,' libdwarf++.pc \
		> $(PREFIX)/lib/pkgconfig/libdwarf++.pc

clean:
	rm -f $(CLEAN)

.DELETE_ON_ERROR: