-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
107 lines (94 loc) · 2.83 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#
# Makefile for the Gutenprint Printer Application
#
# Copyright © 2020-2021 by Till Kamppeter
# Copyright © 2020 by Michael R Sweet
#
# Licensed under Apache License v2.0. See the file "LICENSE" for more
# information.
#
# Version and
VERSION = 1.0
prefix = $(DESTDIR)/usr
localstatedir = $(DESTDIR)/var
includedir = $(prefix)/include
bindir = $(prefix)/bin
libdir = $(prefix)/lib
mandir = $(prefix)/share/man
ppddir = $(prefix)/share/ppd
statedir = $(localstatedir)/lib/gutenprint-printer-app
spooldir = $(localstatedir)/spool/gutenprint-printer-app
serverbin = $(prefix)/lib/gutenprint-printer-app
resourcedir = $(prefix)/share/gutenprint-printer-app
cupsserverbin = `cups-config --serverbin`
unitdir := $(DESTDIR)`pkg-config --variable=systemdsystemunitdir systemd`
# Compiler/linker options...
OPTIM = -Os -g
CFLAGS += `pkg-config --cflags pappl` `cups-config --cflags` `pkg-config --cflags libppd` `pkg-config --cflags libcupsfilters` `pkg-config --cflags libpappl-retrofit` $(OPTIM)
ifdef VERSION
CFLAGS += -DSYSTEM_VERSION_STR="\"$(VERSION)\""
ifndef MAJOR
MAJOR = `echo $(VERSION) | perl -p -e 's/^(\d+).*$$/\1/'`
endif
ifndef MINOR
MINOR = `echo $(VERSION) | perl -p -e 's/^\d+\D+(\d+).*$$/\1/'`
endif
ifndef PATCH
PATCH = `echo $(VERSION) | perl -p -e 's/^\d+\D+\d+\D+(\d+).*$$/\1/'`
endif
ifndef PACKAGE
PACKAGE = `echo $(VERSION) | perl -p -e 's/^\d+\D+\d+\D+\d+\D+(\d+).*$$/\1/'`
endif
endif
ifdef MAJOR
CFLAGS += -DSYSTEM_VERSION_ARR_0=$(MAJOR)
endif
ifdef MINOR
CFLAGS += -DSYSTEM_VERSION_ARR_1=$(MINOR)
endif
ifdef PATCH
CFLAGS += -DSYSTEM_VERSION_ARR_2=$(PATCH)
endif
ifdef PACKAGE
CFLAGS += -DSYSTEM_VERSION_ARR_3=$(PACKAGE)
endif
LDFLAGS += $(OPTIM) `cups-config --ldflags`
LIBS += `pkg-config --libs pappl` `cups-config --image --libs` `pkg-config --libs libppd` `pkg-config --libs libcupsfilters` `pkg-config --libs libpappl-retrofit`
# Targets...
OBJS = gutenprint-printer-app.o
TARGETS = gutenprint-printer-app
# General build rules...
.SUFFIXES: .c .o
.c.o:
$(CC) $(CFLAGS) -c -o $@ $<
# Targets...
all: $(TARGETS)
clean:
rm -f $(TARGETS) $(OBJS)
install: $(TARGETS)
mkdir -p $(bindir)
cp $(TARGETS) $(bindir)
mkdir -p $(mandir)/man1
cp gutenprint-printer-app.1 $(mandir)/man1
mkdir -p $(ppddir)
mkdir -p $(statedir)/ppd
mkdir -p $(spooldir)
mkdir -p $(resourcedir)
cp testpage.ps $(resourcedir)
if test "x$(cupsserverbin)" != x && [ -d $(cupsserverbin) ]; then \
mkdir -p $(libdir); \
touch $(serverbin) 2> /dev/null || :; \
if rm $(serverbin) 2> /dev/null; then \
ln -s $(cupsserverbin) $(serverbin); \
fi; \
else \
mkdir -p $(serverbin)/filter; \
mkdir -p $(serverbin)/backend; \
fi
if test "x$(unitdir)" != x; then \
mkdir -p $(unitdir); \
cp gutenprint-printer-app.service $(unitdir); \
fi
gutenprint-printer-app: $(OBJS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
$(OBJS): Makefile