-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
33 lines (25 loc) · 788 Bytes
/
Makefile
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
CC=gcc
PREFIX=/usr/local
BINDIR=$(PREFIX)/bin
LIBDIR=$(PREFIX)/lib
SPEC=fakehostname.spec
SRCS=$(shell spectool -lf -S $(SPEC) | awk '{ print $$2 }' )
all: libfakehostname.so.1
libfakehostname.so.1: fakehostname.c
$(CC) -fPIC -shared -Wl,-soname,$@ -ldl -o $@ $<
example: all
$(PWD)/fakehostname THIS-IS-A-TEST
clean:
-rm libfakehostname.so.1 HostnameApp.class
sources:
/bin/true
install: all
install -m 0755 fakehostname $(BINDIR)
install -m 0755 libfakehostname.so.1 $(LIBDIR)
rpm: $(SRCS) $(SPEC)
-mkdir -p $(HOME)/rpmbuild/SPECS $(HOME)/rpmbuild/SOURCES
cp $(SRCS) $(HOME)/rpmbuild/SOURCES
cp $(SPEC) $(HOME)/rpmbuild/SPECS
rpmbuild -bs $(HOME)/rpmbuild/SPECS/$(SPEC)
rpmbuild -bb $(HOME)/rpmbuild/SPECS/$(SPEC)
@echo resulting package is in $(HOME)/rpmbuild/RPMS