summaryrefslogtreecommitdiff
path: root/Makefile
blob: 9b601f31eb5cc161a3fdd0090ac97f909852b2d2 (plain)
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
#
# Copyright (C) 2015 David Härdeman <david@hardeman.nu>
#

#
# Generic settings
#
CC              = gcc
GENERIC_CFLAGS	= -g -Wall -Werror -D_FILE_OFFSET_BITS=64 \
		  -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -flto
EXTRA_CFLAGS	=
GENERIC_LDFLAGS	=
EXTRA_LDFLAGS	=
RCM_PACKAGES	= libudev libsystemd
RCM_CFLAGS	= ${GENERIC_CFLAGS} ${EXTRA_CFLAGS} $(shell pkg-config --cflags ${RCM_PACKAGES})
RCM_LDFLAGS	= ${GENERIC_LDFLAGS} ${EXTRA_LDFLAGS} $(shell pkg-config --libs ${RCM_PACKAGES})
INSTALL         = install -c
INSTALL_PROGRAM = ${INSTALL}
INSTALL_DATA    = ${INSTALL} -m 644
RCM_COMPILE	= $(CC) $(RCM_CFLAGS)
RCM_LINK	= $(CC) $(RCM_CFLAGS) $(RCM_LDFLAGS)
RCM_SERVER_OBJ	= rcm-server.o rcm-server-keymap.o
RCM_SERVER_HDR	= rcm-server.h rcm-server-keymap.h utils.h

DESTDIR        ?=
prefix         	= /usr
usrbindir       = ${prefix}/bin
mandir          = ${prefix}/share/man

.SUFFIXES:

#
# Targets
#

all: rcm-server
.DEFAULT: all

%.o: %.c $(RCM_SERVER_HDR)
	$(RCM_COMPILE) -o $@ -c $<

rcm-server: $(RCM_SERVER_OBJ)
	$(RCM_LINK) -o $@ $^

install: all
	$(INSTALL_PROGRAM) -D rcm-server $(DESTDIR)$(usrbindir)/rcm-server

uninstall:
	- rm -f $(DESTDIR)$(usrbindir)/rcm-server

clean:
	- rm -f *.o rcm-server

.PHONY: install uninstall clean all