aboutsummaryrefslogtreecommitdiffstats
path: root/src/Makefile
blob: 8825e45b1e5bf0d6b353a34aae9f85ef9e829f4a (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Basic Makefile for compiling & installing the files.
#
# Supports standard GNU Makefile variables for specifying the paths:
# * prefix
# * bindir
# * sbindir
# * libdir
# * DESTDIR
#

SHELL       = /bin/bash

# Normally /usr/local is used. However, it does not make sense for us to use it
# here, as it just complicates things even further.
prefix      = /usr
bindir      = $(prefix)/bin
sbindir     = $(prefix)/sbin
libdir      = $(prefix)/lib

CC          = gcc
CFLAGS     += $(RPM_OPT_FLAGS) -Wall -D_GNU_SOURCE -fPIE
LDFLAGS    += $(RPM_LD_FLAGS) -pie -z relro -z now

PROGS       = consoletype genhostid rename_device usernetctl usleep

all: $(PROGS)

install: all
	install -m 0755 -d $(DESTDIR)$(bindir)
	install -m 0755 -d $(DESTDIR)$(sbindir)
	install -m 0755 -d $(DESTDIR)$(libdir)/udev
	install -m 0755 build/usleep         $(DESTDIR)$(bindir)
	install -m 0755 build/consoletype    $(DESTDIR)$(sbindir)
	install -m 0755 build/genhostid      $(DESTDIR)$(sbindir)
	install -m 0755 build/usernetctl     $(DESTDIR)$(sbindir)
	install -m 0755 build/rename_device  $(DESTDIR)$(libdir)/udev

clean:
	rm -f build/*

consoletype: build/consoletype.o
	$(CC) $(LDFLAGS) -o build/$@ $^

build/consoletype.o: consoletype.c
	$(CC) $(CFLAGS) -c -o $@ $^


genhostid: build/genhostid.o
	$(CC) $(LDFLAGS) -o build/$@ $^

build/genhostid.o: genhostid.c
	$(CC) $(CFLAGS) -c -o $@ $^


rename_device: build/rename_device.o
	$(CC) $(LDFLAGS) -o build/$@ $^ `pkg-config glib-2.0 --libs`

build/rename_device.o: rename_device.c
	$(CC) $(CFLAGS) -c -o $@ $^ `pkg-config glib-2.0 --cflags`


usernetctl: build/usernetctl.o
	$(CC) $(LDFLAGS) -o build/$@ $^

build/usernetctl.o: usernetctl.c
	$(CC) $(CFLAGS) -c -o $@ $^


usleep: build/usleep.o
	$(CC) $(LDFLAGS) -o build/$@ $^ -lpopt

build/usleep.o: usleep.c
	$(CC) $(CFLAGS) -c -o $@ $^