-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
83 lines (71 loc) · 2.05 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
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
SRCDIR=./source
SRC= \
$(SRCDIR)/convolve.c \
$(SRCDIR)/decimate.c \
$(SRCDIR)/math_utils.c \
$(SRCDIR)/mse.c \
$(SRCDIR)/psnr.c \
$(SRCDIR)/ssim.c \
$(SRCDIR)/ms_ssim.c
OBJ = $(SRC:.c=.o)
PNAME=iqa
CC = gcc
ARC = ar rcs
LN = @ln -fsv
RM = @rm -fv
RMDIR = @rm -frv
PLIB = lib$(PNAME)
VERSION_MAJOR = 1
VERSION_MINOR = 1
VERSION_RELEASE = 3
INCLUDES = -I./include
PREFIX = /usr/local
INCPREFIX = $(PREFIX)/include
LIBPREFIX = $(PREFIX)/lib
DOCPREFIX = $(PREFIX)/share/doc/$(PLIB)$(VERSION_MAJOR)
INSTALL = install
OUTDIR=./build
ifeq ($(DEBUG),1)
RELDIR=debug
CFLAGS=-g -Wall
else
RELDIR=release
CFLAGS+=-O3 -Wall
endif
ifneq ($(shell uname -m), i386)
CFLAGS += -fPIC
endif
OUT = $(OUTDIR)/$(RELDIR)/$(PLIB)
.c.o:
$(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@
$(OUT).a: $(OBJ)
mkdir -p $(OUTDIR)/$(RELDIR)
$(ARC) $(OUT).a $(OBJ)
$(CC) -shared -Wl,-soname,$(PLIB).so.$(VERSION_MAJOR) -o $(OUT).so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE) $(OBJ) $(LDFLAGS)
mv $(OBJ) $(OUTDIR)/$(RELDIR)
clean:
$(RMDIR) $(OUTDIR)
cd test; $(MAKE) clean;
.PHONY : test install
test:
cd test; $(MAKE);
install:
$(INSTALL) -d $(LIBPREFIX)
$(INSTALL) -m 0644 $(OUT).a $(LIBPREFIX)/$(PLIB).a
$(INSTALL) -m 0644 $(OUT).so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE) $(LIBPREFIX)/$(PLIB).so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE)
$(LN) $(PLIB).so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE) $(LIBPREFIX)/$(PLIB).so.$(VERSION_MAJOR)
$(LN) $(PLIB).so.$(VERSION_MAJOR) $(LIBPREFIX)/$(PLIB).so
$(INSTALL) -d $(INCPREFIX)
$(INSTALL) -m 0644 include/iqa*.h $(INCPREFIX)
$(INSTALL) -d $(LIBPREFIX)/pkgconfig
$(INSTALL) -m 0644 $(PNAME).pc $(LIBPREFIX)/pkgconfig
$(INSTALL) -d $(DOCPREFIX)
$(INSTALL) -m 0644 CHANGELOG.txt LICENSE README.md $(DOCPREFIX)
uninstall:
$(RM) $(LIBPREFIX)/$(PLIB).a
$(RM) $(LIBPREFIX)/$(PLIB).so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_RELEASE)
$(RM) $(LIBPREFIX)/$(PLIB).so.$(VERSION_MAJOR)
$(RM) $(LIBPREFIX)/$(PLIB).so
$(RM) $(LIBPREFIX)/pkgconfig/$(PNAME).pc
$(RM) $(INCPREFIX)/$(PNAME).h
$(RMDIR) $(DOCPREFIX)