aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/.gitignore11
-rw-r--r--src/Makefile127
-rw-r--r--src/build/.gitkeep0
3 files changed, 80 insertions, 58 deletions
diff --git a/src/.gitignore b/src/.gitignore
index 01d63587..a007feab 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -1,10 +1 @@
-usernetctl
-netreport
-testd
-usleep
-ipcalc
-getkey
-ppp-watch
-consoletype
-genhostid
-rename_device
+build/*
diff --git a/src/Makefile b/src/Makefile
index d4df499b..68222ac5 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,54 +1,85 @@
-CFLAGS+=$(RPM_OPT_FLAGS) -Wall -D_GNU_SOURCE -fPIE
-LDFLAGS+=$(RPM_LD_FLAGS) -pie -z relro -z now
+# Basic Makefile for compiling & installing the files.
+#
+# Supports standard GNU Makefile variables for specifying the paths:
+# * prefix
+# * bindir
+# * sbindir
+# * libdir
+# * DESTDIR
+#
-PROGS=usernetctl netreport usleep \
- consoletype genhostid rename_device
-CONSOLE_INIT_OBJS=console_init.o shvar.o
-USLEEP_OBJS=usleep.o
+SHELL = /bin/bash
-mandir=/usr/share/man
+# 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
-all: $(PROGS)
+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 $(PROGS) *.o *~
-
-install:
- mkdir -p $(ROOT)/usr/bin $(ROOT)/usr/sbin $(ROOT)$(mandir)/man{1,8} $(ROOT)/etc $(ROOT)/usr/lib/udev
- install -m 755 usleep $(ROOT)/usr/bin/usleep
- install -m 4755 usernetctl $(ROOT)/usr/sbin/usernetctl
- install -m 2755 netreport $(ROOT)/usr/sbin/netreport
- install -m 755 genhostid $(ROOT)/usr/sbin/genhostid
- install -m 755 consoletype $(ROOT)/usr/sbin/consoletype
- install -m 755 sushell $(ROOT)/usr/sbin/sushell
- install -m 755 rename_device $(ROOT)/usr/lib/udev/rename_device
- install -m 644 genhostid.1 $(ROOT)$(mandir)/man1
- install -m 644 netreport.1 $(ROOT)$(mandir)/man1
- install -m 644 usleep.1 $(ROOT)$(mandir)/man1
- install -m 644 usernetctl.8 $(ROOT)$(mandir)/man8
- install -m 644 consoletype.1 $(ROOT)$(mandir)/man1
- install -m 644 ifup.8 $(ROOT)$(mandir)/man8
- install -m 644 sushell.8 $(ROOT)$(mandir)/man8
- ln -s ifup.8 $(ROOT)$(mandir)/man8/ifdown.8
-
-usleep: $(USLEEP_OBJS)
- $(CC) $(LDFLAGS) -o $@ $(USLEEP_OBJS) -lpopt
-
-usernetctl.o: usernetctl.c
- $(CC) $(CFLAGS) -c usernetctl.c -o usernetctl.o
-
-usernetctl: usernetctl.c usernetctl.o
- $(CC) $(LDFLAGS) -o $@ $@.o
-
-netreport.o: netreport.c
- $(CC) $(CFLAGS) -c netreport.c -o netreport.o
-
-netreport: netreport.o
- $(CC) $(LDFLAGS) -o $@ $@.o
-
-shvar.o: shvar.c
- $(CC) $(CFLAGS) `pkg-config glib-2.0 --cflags` -c shvar.c -o shvar.o
-
-rename_device: rename_device.c
- $(CC) $(CFLAGS) `pkg-config glib-2.0 --cflags` -o $@ $< $(LDFLAGS) `pkg-config glib-2.0 --libs`
+ 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`
diff --git a/src/build/.gitkeep b/src/build/.gitkeep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/build/.gitkeep