rh401 - RPM编包示例 - 一份Makefile文件和与之对应hello.spec文件

Makefile:

#
# Makefile for the "hello" open source library and application
#

VERSION=1.0
CC=gcc
CFLAGS=-O2

.PHONY: libhello all

all: hello

hello: libhello.so.1 hello.o
	$(CC) $(CFLAGS) hello.o -L. -lhello -o hello

hello.o: libhello.h

libhello: libhello.so.1

libhello.so.1: libhello.o
	$(CC) -shared -Wl,-soname,libhello.so.1 libhello.o -lc -o libhello.so.1.0
	ln -sf libhello.so.1.0 libhello.so.1
	ln -sf libhello.so.1   libhello.so

libhello.o: libhello.h
	$(CC) $(CFLAGS) -fPIC -c libhello.c

clean:
	rm -f *.o *.so* hello hello*.tar.gz

tar: clean
	cd ..; tar czvf hello-$(VERSION).tar.gz --exclude .svn hello-$(VERSION)

install: all
	install libhello.so.1.0	/usr/local/lib
	ln -sf libhello.so.1.0	/usr/local/lib/libhello.so.1
	ln -sf libhello.so.1	/usr/local/lib/libhello.so
	install hello		/usr/local/bin
	install hello.1		/usr/local/share/man/man1
#	install hello.conf	/etc/ld.so.conf.d
	/sbin/ldconfig

uninstall:
	rm -f /usr/local/lib/libhello.so*
	rm -f /usr/local/bin/hello
	rm -f /usr/local/share/man/man1/hello.1
#	rm -f /etc/ld.so.conf.d/hello.conf
	/sbin/ldconfig


hello.spec

Summary: Hello motivational software
Name: hello
Version: 1.0
Release: 1
License: Freely redistributable without restriction
Group: Applications/Productivity
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

%description
hello is a soft skills enhancement application
used by well-managed organizations worldwide.

%prep
%setup -q

%build
make

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/usr/local/{bin,lib,share/man/man1}
mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d
install libhello.so.1.0 $RPM_BUILD_ROOT/usr/local/lib
install hello $RPM_BUILD_ROOT/usr/local/bin
gzip -9c hello.1 > hello.1.gz
install hello.1.gz $RPM_BUILD_ROOT/usr/local/share/man/man1
install hello.conf $RPM_BUILD_ROOT/etc/ld.so.conf.d

%clean
make clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%config(noreplace) /etc/ld.so.conf.d/hello.conf
/usr/local/bin/hello
/usr/local/lib/libhello.so.1.0
%doc /usr/local/share/man/man1/hello.1.gz
%doc README


%post
ln -sf libhello.so.1.0 /usr/local/lib/libhello.so.1
ln -sf libhello.so.1 /usr/local/lib/libhello.so
/sbin/ldconfig


%changelog
* Wed Jan 27 2010 Charles Channelman <channelman@stationX.example.com> - 1.0-1
- Initial build.


本文相关资源下载:

http://download.csdn.net/detail/t0nsha/4559332

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值