aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Kaspar [Dee'Kej] <dkaspar@redhat.com>2018-05-25 20:59:34 +0200
committerDee'Kej <deekej@linuxmail.org>2018-05-30 12:32:22 +0200
commit87db0f22359504a9d8bef2beb889de60830610be (patch)
treeef59d4895610e3ab9f64b6d7664caee25a619f34
parenta145ddda284570e57413e37f025c3657205e17d8 (diff)
downloadinitscripts-87db0f22359504a9d8bef2beb889de60830610be.tar
initscripts-87db0f22359504a9d8bef2beb889de60830610be.tar.gz
initscripts-87db0f22359504a9d8bef2beb889de60830610be.tar.bz2
initscripts-87db0f22359504a9d8bef2beb889de60830610be.tar.xz
initscripts-87db0f22359504a9d8bef2beb889de60830610be.zip
src/Makefile simplified & updated to new repository layout
The rules have been unified, build results are now in build/ subfolder, and it uses GNU naming for the system paths...
-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