aboutsummaryrefslogtreecommitdiffstats
path: root/src/Makefile
blob: 68222ac5059a78a9df39d15a5fcf2a7797e668b9 (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
74
75
76
77
78
79
80
81
82
83
84
85
# 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 netreport 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/netreport      $(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 $@ $^


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

build/netreport.o: netreport.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 $@ $^


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