-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
77 lines (59 loc) · 1.81 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
#
# Makefile for the Braille Printer Application
#
# Copyright © 2024 Arun Patwa
#
# Licensed under Apache License v2.0. See the file "LICENSE" for more
# information.
#
# POSIX makefile
.POSIX:
# Build silently
.SILENT:
# Version and directories...
VERSION = 1
prefix = $(DESTDIR)/usr/local
includedir = $(prefix)/include
bindir = $(prefix)/bin
libdir = $(prefix)/lib
mandir = $(prefix)/share/man
unitdir = `pkg-config --variable=systemdsystemunitdir systemd`
# Compiler/linker options...
CSFLAGS = -s "$${CODESIGN_IDENTITY:=-}" --timestamp -o runtime
CFLAGS = $(CPPFLAGS) $(OPTIM)
CPPFLAGS = '-DVERSION="$(VERSION)"' `pkg-config --cflags cups` `pkg-config --cflags libcupsfilters` `pkg-config --cflags pappl` `pkg-config --cflags liblouisutdml` `pkg-config --cflags libmagic` $(OPTIONS)
LDFLAGS = $(OPTIM) `pkg-config --libs liblouisutdml` `pkg-config --libs libmagic`
LIBS = `pkg-config --libs pappl` `pkg-config --libs libcupsfilters` `pkg-config --libs cups` -llouisutdml -lm -lmagic
OPTIM = -Os -g
# Targets...
OBJS = \
generic-brf.o \
brf-printer-app.o
TARGETS = \
brf-printer-app
# General build rules...
.SUFFIXES: .c .o
.c.o: $<
echo "Compiling $<..."
$(CC) $(CFLAGS) -c -o $@ $<
# Targets...
all: $(TARGETS)
clean:
echo "Cleaning all output..."
rm -f $(TARGETS) $(OBJS)
install: $(TARGETS)
echo "Installing program to $(bindir)..."
mkdir -p $(bindir)
cp brf-printer-app $(bindir)
echo "Installing documentation to $(mandir)..."
mkdir -p $(mandir)/man1
cp brf-printer-app.1 $(mandir)/man1
if pkg-config --exists systemd; then \
echo "Installing systemd service to $(unitdir)..."; \
mkdir -p $(unitdir); \
cp brf-printer-app.service $(unitdir); \
fi
brf-printer-app: $(OBJS)
echo "Linking $@..."
$(CC) $(LDFLAGS) -o $@ brf-printer-app.o generic-brf.o $(LIBS)
$(OBJS): Makefile