-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
executable file
·45 lines (33 loc) · 1.1 KB
/
Makefile
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
prefix ?= /usr/local
libdir ?= lib
incdir ?= include
CC ?= gcc
CFLAGS ?= -g -Wall -O2
CFLAGS += -fPIC -Wredundant-decls
LIBS=-lm
LIBNAME=librapl.so
MAJOR=1
MINOR=0
LIBCOMPLETE=$(LIBNAME).$(MAJOR).$(MINOR)
.PHONY: clean tools
all: $(LIBNAME)
$(LIBNAME): rapl.o
$(CC) $(LDFLAGS) -Wl,-soname,$(LIBNAME).$(MAJOR) -shared $< $(LIBS) -o $(LIBCOMPLETE)
ln -s $(LIBCOMPLETE) $(LIBNAME).$(MAJOR)
ln -s $(LIBCOMPLETE) $(LIBNAME)
install:
# install the real library
install -m 0755 -D $(LIBCOMPLETE) $(DESTDIR)/$(prefix)/$(libdir)/$(LIBCOMPLETE)
# versioned symlinks
ln -s $(LIBCOMPLETE) $(DESTDIR)/$(prefix)/$(libdir)/$(LIBNAME)
ln -s $(LIBCOMPLETE) $(DESTDIR)/$(prefix)/$(libdir)/$(LIBNAME).$(MAJOR)
install -m 0644 -D rapl.h $(DESTDIR)/$(prefix)/$(incdir)/rapl.h
sed "s/%prefix%/$(subst /,\/,$(prefix))/;\
s/%libdir%/$(subst /,\/,$(libdir))/; \
s/%incdir%/$(subst /,\/,$(incdir))/" librapl.pc.skel > librapl.pc
install -m 0644 -D librapl.pc $(DESTDIR)/$(prefix)/$(libdir)/pkgconfig/librapl.pc
tools:
$(MAKE) -C tools
clean:
rm -f $(LIBNAME) $(LIBNAME).$(MAJOR) $(LIBCOMPLETE) *.o
$(MAKE) -C tools clean