diff options
author | Olav Vitters <olav@vitters.nl> | 2020-07-26 21:46:44 +0200 |
---|---|---|
committer | Olav Vitters <olav@vitters.nl> | 2020-07-26 21:46:44 +0200 |
commit | 244c9a00ae9a0dc62156aeb8781c2b22da0ad96e (patch) | |
tree | c0d76ed490862837a8a37bb61ed8e653e5cc2558 /src/Makefile | |
parent | d0d18c6de12efeba25eb41d7cf207037027e4964 (diff) | |
parent | 6ca701a23c74b245f35750149a22f7d21805a8e0 (diff) | |
download | initscripts-244c9a00ae9a0dc62156aeb8781c2b22da0ad96e.tar initscripts-244c9a00ae9a0dc62156aeb8781c2b22da0ad96e.tar.gz initscripts-244c9a00ae9a0dc62156aeb8781c2b22da0ad96e.tar.bz2 initscripts-244c9a00ae9a0dc62156aeb8781c2b22da0ad96e.tar.xz initscripts-244c9a00ae9a0dc62156aeb8781c2b22da0ad96e.zip |
Merge tag '10.04' into distro/mga
10.04 release
Diffstat (limited to 'src/Makefile')
-rw-r--r-- | src/Makefile | 115 |
1 files changed, 67 insertions, 48 deletions
diff --git a/src/Makefile b/src/Makefile index d4df499b..8825e45b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,54 +1,73 @@ -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 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 $(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 $@ $^ + + +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 $@ $^ |