-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
41 lines (36 loc) · 1002 Bytes
/
Copy pathMakefile
File metadata and controls
41 lines (36 loc) · 1002 Bytes
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
# Variables
export VER=0.2.0
export SONAME=libapp.so
export ANAME=libapp.a
PREFIX ?= /usr/local
INCDIR=$(PREFIX)/include
INCAPPDIR=$(PREFIX)/include/libapp
LIBDIR=$(PREFIX)/lib
PKGCONFIGDIR=$(LIBDIR)/pkgconfig
INSTALL_S = install -s
export LN_SF = ln -sf
SUBDIRS = libapp test
# Main target
all: libapp.pc
@$(foreach i,$(SUBDIRS), make -C $i || exit 1; )
libapp.pc: libapp.pc.in
sed \
-e 's:@PREFIX@:$(PREFIX):g' \
-e 's:@LIBDIR@:$(LIBDIR):g' \
-e 's:@INCLUDEDIR@:$(INCDIR):g' \
-e 's:@PACKAGE_NAME@:libapp:g' \
-e 's:@PACKAGE_VERSION@:$(VER):g' \
$< > $@
clean:
rm -f *.pc
@$(foreach i,$(SUBDIRS), make -C $i clean ;)
install: all libapp.pc
install -d '$(LIBDIR)'
$(INSTALL_S) -t '$(LIBDIR)' libapp/$(ANAME)
$(INSTALL_S) -t '$(LIBDIR)' libapp/$(SONAME).$(VER)
$(LN_SF) $(SONAME).$(VER) '$(LIBDIR)'/$(SONAME)
install -d '$(INCAPPDIR)'
install -m 644 -t '$(INCAPPDIR)' libapp/*.h
install -d '$(PKGCONFIGDIR)'
install -t '$(PKGCONFIGDIR)' libapp.pc
.PHONY: clean install all