Makefile

Thu, 26 Mar 2020 11:25:28 +0100

author
David Demelier <markand@malikania.fr>
date
Thu, 26 Mar 2020 11:25:28 +0100
changeset 22
1778aac34198
parent 19
0de3886f98ad
child 23
6081cc143d37
permissions
-rw-r--r--

make: simplify

#
# Makefile for backlight
#
# Copyright (c) 2010-2020 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=             gcc
CFLAGS=         -O3 -DNDEBUG

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}

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