-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
82 lines (69 loc) · 2.01 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
# GCC makefile for Ipol.im library image input-output
# Pascal Getreuer
# May 4, 2012
LIBIPOLN=libipoliio.so
LIBIPOLV=0
LIBIPOLD=20220720
##
# The following three statements determine the build configuration.
# For handling different image formats, the program can be linked with
# the libjpeg, libpng, and libtiff libraries. For each library, set
# the flags needed for linking. To disable use of a library, comment
# its statement. You can disable all three (BMP is always supported).
LDLIBJPEG=-ljpeg
LDLIBPNG=-lpng
LDLIBTIFF=-ltiff
##
# Standard make settings
SHELL=/bin/sh
CFLAGS=-O3 -ansi -pedantic -Wall -Wextra -Isrc
LDFLAGS=
LDLIBS=-lm $(LDLIBJPEG) $(LDLIBPNG) $(LDLIBTIFF)
ifneq ($(shell uname -m), i386)
CFLAGS += -fPIC
endif
##
# These statements add compiler flags to define USE_LIBJPEG, etc.,
# depending on which libraries have been specified above.
ifneq ($(LDLIBJPEG),)
CJPEG=-DUSE_LIBJPEG
endif
ifneq ($(LDLIBPNG),)
CPNG=-DUSE_LIBPNG
endif
ifneq ($(LDLIBTIFF),)
CTIFF=-DUSE_LIBTIFF
endif
ALLCFLAGS=$(CFLAGS) $(CJPEG) $(CPNG) $(CTIFF)
LIBIPOL_SOURCES=basic.c imageio.c
ARCHIVENAME=$(LIBIPOLN)_$(shell date -u +%Y%m%d)
SOURCES=src/basic.c src/basic.h src/imageio.c src/imageio.h LICENSE Makefile
# LIBIPOL_OBJECTS=$(LIBIPOL_SOURCES:.c=.o)
LIBIPOL_OBJECTS=src/basic.o src/imageio.o
.SUFFIXES: .c .o
.PHONY: all clean rebuild dist dist-zip
all: $(LIBIPOLN).$(LIBIPOLV)
$(LIBIPOLN).$(LIBIPOLV): $(LIBIPOL_OBJECTS)
$(CC) -shared -Wl,-soname,$@ $(LDFLAGS) -o $@ $^ $(LDLIBS) -s
chmod -v 644 $@
mv $@ $@.$(LIBIPOLD)
ln -s $@.$(LIBIPOLD) $@
ln -s $@ $(LIBIPOLN)
.c.o:
$(CC) -c $(ALLCFLAGS) $< -o $@
clean:
-$(RM) $(LIBIPOL_OBJECTS) $(LIBIPOLN)*
rebuild: clean all
dist: $(SOURCES)
-rm -rf $(ARCHIVENAME)
mkdir $(ARCHIVENAME)
ln $(SOURCES) $(ARCHIVENAME)
tar vchzf $(ARCHIVENAME).tgz $(ARCHIVENAME)
-rm -rf $(ARCHIVENAME)
dist-zip: $(SOURCES)
-rm -rf $(ARCHIVENAME)
mkdir $(ARCHIVENAME)
ln $(SOURCES) $(ARCHIVENAME)
-rm -f $(ARCHIVENAME).zip
zip -r9 $(ARCHIVENAME).zip $(ARCHIVENAME)/*
-rm -rf $(ARCHIVENAME)