Makefile

Wed, 09 Oct 2019 16:52:41 +0200

author
David Demelier <markand@malikania.fr>
date
Wed, 09 Oct 2019 16:52:41 +0200
changeset 13
62ac42bd4851
parent 12
6621c6f2b7e2
child 19
0de3886f98ad
permissions
-rw-r--r--

make: simplify makefile, advertise clang

0
73a371432d36 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
1 #
73a371432d36 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
2 # Makefile for backlight
73a371432d36 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
3 #
6
77ea2359f3e4 misc: refactor
David Demelier <markand@malikania.fr>
parents: 4
diff changeset
4 # Copyright (c) 2010-2019 David Demelier <markand@malikania.fr>
0
73a371432d36 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
5 #
73a371432d36 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
6 # Permission to use, copy, modify, and distribute this software for any
73a371432d36 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
7 # purpose with or without fee is hereby granted, provided that the above
73a371432d36 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
8 # copyright notice and this permission notice appear in all copies.
73a371432d36 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
9 #
73a371432d36 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
10 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
73a371432d36 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
11 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
73a371432d36 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
12 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
73a371432d36 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
13 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
73a371432d36 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
14 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
73a371432d36 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
15 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
73a371432d36 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
16 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
73a371432d36 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
17 #
73a371432d36 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
18
13
62ac42bd4851 make: simplify makefile, advertise clang
David Demelier <markand@malikania.fr>
parents: 12
diff changeset
19 .POSIX:
62ac42bd4851 make: simplify makefile, advertise clang
David Demelier <markand@malikania.fr>
parents: 12
diff changeset
20
62ac42bd4851 make: simplify makefile, advertise clang
David Demelier <markand@malikania.fr>
parents: 12
diff changeset
21 CC= clang
62ac42bd4851 make: simplify makefile, advertise clang
David Demelier <markand@malikania.fr>
parents: 12
diff changeset
22 CFLAGS= -Wall -Wextra -pedantic -std=c11 -DNDEBUG -D_XOPEN_SOURCE=700 ${EXTRA_CFLAGS}
6
77ea2359f3e4 misc: refactor
David Demelier <markand@malikania.fr>
parents: 4
diff changeset
23 LDFLAGS= ${EXTRA_LDFLAGS}
77ea2359f3e4 misc: refactor
David Demelier <markand@malikania.fr>
parents: 4
diff changeset
24 LDLIBS= ${EXTRA_LDLIBS}
0
73a371432d36 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
25
6
77ea2359f3e4 misc: refactor
David Demelier <markand@malikania.fr>
parents: 4
diff changeset
26 PREFIX= /usr/local
77ea2359f3e4 misc: refactor
David Demelier <markand@malikania.fr>
parents: 4
diff changeset
27 BINDIR= ${PREFIX}/bin
77ea2359f3e4 misc: refactor
David Demelier <markand@malikania.fr>
parents: 4
diff changeset
28 MANDIR= ${PREFIX}/share/man
77ea2359f3e4 misc: refactor
David Demelier <markand@malikania.fr>
parents: 4
diff changeset
29 LIBDIR= ${PREFIX}/lib
0
73a371432d36 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
30
6
77ea2359f3e4 misc: refactor
David Demelier <markand@malikania.fr>
parents: 4
diff changeset
31 PROG= backlight
77ea2359f3e4 misc: refactor
David Demelier <markand@malikania.fr>
parents: 4
diff changeset
32 SRCS= backlight.c
77ea2359f3e4 misc: refactor
David Demelier <markand@malikania.fr>
parents: 4
diff changeset
33 MAN1= backlight.1
77ea2359f3e4 misc: refactor
David Demelier <markand@malikania.fr>
parents: 4
diff changeset
34 OBJS= ${SRCS:.c=.o}
0
73a371432d36 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
35
6
77ea2359f3e4 misc: refactor
David Demelier <markand@malikania.fr>
parents: 4
diff changeset
36 all: ${PROG}
0
73a371432d36 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
37
6
77ea2359f3e4 misc: refactor
David Demelier <markand@malikania.fr>
parents: 4
diff changeset
38 ${PROG}: ${OBJS}
77ea2359f3e4 misc: refactor
David Demelier <markand@malikania.fr>
parents: 4
diff changeset
39 ${CC} -o ${PROG} ${OBJS} ${LDFLAGS} ${LDLIBS}
0
73a371432d36 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
40
73a371432d36 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
41 clean:
6
77ea2359f3e4 misc: refactor
David Demelier <markand@malikania.fr>
parents: 4
diff changeset
42 rm -f ${OBJS} ${PROG}
77ea2359f3e4 misc: refactor
David Demelier <markand@malikania.fr>
parents: 4
diff changeset
43
77ea2359f3e4 misc: refactor
David Demelier <markand@malikania.fr>
parents: 4
diff changeset
44 install: ${PROG}
8
23faf720d186 make: use POSIX only commands
David Demelier <markand@malikania.fr>
parents: 6
diff changeset
45 mkdir -p ${DESTDIR}${BINDIR}
23faf720d186 make: use POSIX only commands
David Demelier <markand@malikania.fr>
parents: 6
diff changeset
46 mkdir -p ${DESTDIR}${MANDIR}/man1
23faf720d186 make: use POSIX only commands
David Demelier <markand@malikania.fr>
parents: 6
diff changeset
47 cp ${PROG} ${DESTDIR}${BINDIR}/${PROG}
23faf720d186 make: use POSIX only commands
David Demelier <markand@malikania.fr>
parents: 6
diff changeset
48 cp ${MAN1} ${DESTDIR}${MANDIR}/man1
0
73a371432d36 misc: initial import
David Demelier <markand@malikania.fr>
parents:
diff changeset
49
8
23faf720d186 make: use POSIX only commands
David Demelier <markand@malikania.fr>
parents: 6
diff changeset
50 install-udev: install
23faf720d186 make: use POSIX only commands
David Demelier <markand@malikania.fr>
parents: 6
diff changeset
51 chmod 755 ${DESTDIR}${BINDIR}/${PROG}
23faf720d186 make: use POSIX only commands
David Demelier <markand@malikania.fr>
parents: 6
diff changeset
52 mkdir -p ${DESTDIR}${LIBDIR}/udev/rules.d
23faf720d186 make: use POSIX only commands
David Demelier <markand@malikania.fr>
parents: 6
diff changeset
53 cp 50-brightness.rules ${DESTDIR}${LIBDIR}/udev/rules.d
6
77ea2359f3e4 misc: refactor
David Demelier <markand@malikania.fr>
parents: 4
diff changeset
54
8
23faf720d186 make: use POSIX only commands
David Demelier <markand@malikania.fr>
parents: 6
diff changeset
55 install-setuid: install
23faf720d186 make: use POSIX only commands
David Demelier <markand@malikania.fr>
parents: 6
diff changeset
56 chmod 4755 ${DESTDIR}${BINDIR}/${PROG}
6
77ea2359f3e4 misc: refactor
David Demelier <markand@malikania.fr>
parents: 4
diff changeset
57
77ea2359f3e4 misc: refactor
David Demelier <markand@malikania.fr>
parents: 4
diff changeset
58 .PHONY: all clean install install-udev install-setuid

mercurial