File: Makefile

package info (click to toggle)
gaviotatb 0.4-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, sid, stretch
  • size: 1,128 kB
  • ctags: 1,865
  • sloc: ansic: 12,303; ruby: 516; makefile: 93; sh: 8
file content (106 lines) | stat: -rw-r--r-- 2,903 bytes parent folder | download
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
INCLUDE = -Isysport/ \
	-Icompression/ \
	-Icompression/liblzf/ \
	-Icompression/lzma/ \
	-Icompression/huffman/

DEFAULT_CC = /usr/bin/gcc
#DEFAULT_DEFINE = -DZ_PREFIX
#DEFAULT_ARCHFLAGS = -m64
DEFAULT_CFLAGS = -Wall -Wextra -fPIC $(INCLUDE) $(DEFAULT_DEFINE) \
	$(DEFAULT_ARCHFLAGS)
PREFIX = /usr
OPTFLAGS = -fast -msse -DNDEBUG
DEBUGFLAGS = -O0 -g -DDEBUG
PGO1FLAGS = $(OPTFLAGS) -fprofile-generate
PGO2FLAGS = $(OPTFLAGS) -fprofile-use

SRCFILES := gtb-probe.c gtb-dec.c gtb-att.c sysport/sysport.c \
	compression/wrap.c compression/huffman/hzip.c \
	compression/lzma/LzmaEnc.c compression/lzma/LzmaDec.c \
	compression/lzma/Alloc.c compression/lzma/LzFind.c \
	compression/lzma/Lzma86Enc.c compression/lzma/Lzma86Dec.c \
	compression/lzma/Bra86.c \
	compression/liblzf/lzf_c.c compression/liblzf/lzf_d.c
OBJFILES := $(patsubst %.c,%.o,$(SRCFILES))
PROFFILES := $(SRCFILES:.c=.gcno) $(SRCFILES:.c=.gcda)
LIBNAME := libgaviotatb.a
SONAME :=libgaviotatb.so
SOVERSION := 1.0.1
SOMAJORVERSION := 1


.PHONY: all clean
.DEFAULT_GOAL := all

all:
	$(MAKE) $(LIBNAME) \
		CC='$(DEFAULT_CC)' \
		ARCHFLAGS='$(DEFAULT_ARCHFLAGS)' \
		DEFINE='$(DEFAULT_DEFINE)' \
		CFLAGS='$(OPPTFLAGS) $(DEFAULT_CFLAGS)'
	$(MAKE) $(SONAME) \
		CC='$(DEFAULT_CC)' \
		ARCHFLAGS='$(DEFAULT_ARCHFLAGS)' \
		DEFINE='$(DEFAULT_DEFINE)' \
		CFLAGS='$(OPPTFLAGS) $(DEFAULT_CFLAGS)'

$(LIBNAME): $(OBJFILES)
	$(AR) rcs $@ $(OBJFILES)

$(SONAME): $(OBJFILES)
	$(CC) -shared $(OBJFILES) -Wl,-soname=$(SONAME).$(SOMAJORVERSION) -o $(SONAME).$(SOVERSION) -lz -lpthread

opt:
	$(MAKE) $(LIBNAME) \
		CC='$(DEFAULT_CC)' \
		ARCHFLAGS='$(DEFAULT_ARCHFLAGS)' \
		DEFINE='$(DEFAULT_DEFINE)' \
		CFLAGS='$(OPTFLAGS) $(DEFAULT_CFLAGS)' \
		LDFLAGS='$(LDFLAGS)'

debug:
	$(MAKE) $(LIBNAME) \
		CC='$(DEFAULT_CC)' \
		ARCHFLAGS='$(DEFAULT_ARCHFLAGS)' \
		DEFINE='$(DEFAULT_DEFINE)' \
		CFLAGS='$(DEBUGFLAGS) $(DEFAULT_CFLAGS)' \
		LDFLAGS='$(LDFLAGS)'

pgo-start:
	$(MAKE) $(LIBNAME) \
		CC='$(DEFAULT_CC)' \
		ARCHFLAGS='$(DEFAULT_ARCHFLAGS)' \
		DEFINE='$(DEFAULT_DEFINE)' \
		CFLAGS='$(PGO1FLAGS) $(DEFAULT_CFLAGS)' \
		LDFLAGS='$(LDFLAGS) -fprofile-generate'

pgo-finish:
	$(MAKE) $(LIBNAME) \
		CC='$(DEFAULT_CC)' \
		ARCHFLAGS='$(DEFAULT_ARCHFLAGS)' \
		DEFINE='$(DEFAULT_DEFINE)' \
		CFLAGS='$(PGO2FLAGS) $(DEFAULT_CFLAGS)' \
		LDFLAGS='$(LDFLAGS) -fprofile-generate'

clean:
	$(RM) -f $(OBJFILES) $(LIBNAME) $(SONAME).$(SOVERSION)

pgo-clean:
	$(RM) -f $(PROFFILES)

install:
	mkdir -p $(DESTDIR)/$(PREFIX)/lib
	install -m 755 -o root -g root $(LIBNAME) $(SONAME).$(SOVERSION) $(DESTDIR)/$(PREFIX)/lib
	(cd $(DESTDIR)/$(PREFIX)/lib; \
	ln -sf $(SONAME).$(SOVERSION) $(SONAME).$(SOMAJORVERSION); \
	ln -sf $(SONAME).$(SOVERSION) $(SONAME);)
	mkdir -p $(DESTDIR)/$(PREFIX)/include
	install -m 644 -o root -g root gtb-probe.h $(DESTDIR)/$(PREFIX)/include
	#ldconfig

.depend:
	$(CC) -MM $(DEFAULT_CFLAGS) $(SRCFILES) > $@

include .depend