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

#
# Makefile for backlight
#
# Copyright (c) 2010-2019 David Demelier <markand@malikania.fr>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#

.POSIX:

CC=             clang
CFLAGS=         -Wall -Wextra -pedantic -std=c11 -DNDEBUG -D_XOPEN_SOURCE=700 ${EXTRA_CFLAGS}
LDFLAGS=        ${EXTRA_LDFLAGS}
LDLIBS=         ${EXTRA_LDLIBS}

PREFIX=         /usr/local
BINDIR=         ${PREFIX}/bin
MANDIR=         ${PREFIX}/share/man
LIBDIR=         ${PREFIX}/lib

PROG=           backlight
SRCS=           backlight.c
MAN1=           backlight.1
OBJS=           ${SRCS:.c=.o}

all: ${PROG}

${PROG}: ${OBJS}
	${CC} -o ${PROG} ${OBJS} ${LDFLAGS} ${LDLIBS}

clean:
	rm -f ${OBJS} ${PROG}

install: ${PROG}
	mkdir -p ${DESTDIR}${BINDIR}
	mkdir -p ${DESTDIR}${MANDIR}/man1
	cp ${PROG} ${DESTDIR}${BINDIR}/${PROG}
	cp ${MAN1} ${DESTDIR}${MANDIR}/man1

install-udev: install
	chmod 755 ${DESTDIR}${BINDIR}/${PROG}
	mkdir -p ${DESTDIR}${LIBDIR}/udev/rules.d
	cp 50-brightness.rules ${DESTDIR}${LIBDIR}/udev/rules.d

install-setuid: install
	chmod 4755 ${DESTDIR}${BINDIR}/${PROG}

.PHONY: all clean install install-udev install-setuid

mercurial