Tizen 2.1 base
[platform/upstream/fsync.git] / Makefile
1 # Makefile for the fsync package
2 # Copyright 2008 Parliament Hill Computers Ltd, all rights reserved.
3 # Author: ADDW December 2008
4 # SCCS: @(#)Makefile    1.1 11/14/11 22:37:38
5
6 # The distribution version # comes from the SCCS id of the spec file.
7 # To do a test build run something like:
8 #       make VERSION=test dist
9 # If the spec file is out on delta, go:
10 #       make VERSION=1.1 dist
11
12 PACKAGE=fsync
13 PROGS=fsync
14 SOURCES=fsync.c
15 BUILDPROGS=
16 SUBDIRS=docs
17 CONFIGS=configure.in config.h.in
18 DOCS=README Contributors License Hacks
19
20 SPECFILE=$(PACKAGE).spec
21 VERSION := $(shell sed -ne '/^%define \+version \+/s///p' $(SPECFILE) )
22 DESTDIR=/usr/local
23 BINDIR=$(DESTDIR)/bin/
24 DOCDIR=$(DESTDIR)/share/doc/$(PACKAGE)-$(VERSION)
25 MAKEFILE=Makefile
26 BUILDFILES=$(SPECFILE) $(MAKEFILE)
27
28 # Default target is to make the programs - not install
29 progs:  $(PROGS)
30
31 # Create directories then copy in script and documentation:
32 install:        $(PROGS)
33         install -d $(BINDIR) $(DOCDIR)
34         install -p $(PROGS) $(BINDIR)
35         install -p -m 644 $(DOCS) $(DOCDIR)
36         for d in $(SUBDIRS); do make -C $$d install ; done
37
38 # Create a tar file for distribution
39 dist:   $(PACKAGE)-$(VERSION).tar.gz
40
41 # The tar file for distribution:
42 $(PACKAGE)-$(VERSION).tar.gz: $(DOCS) $(BUILDPROGS) $(BUILDFILES) $(SOURCES) $(CONFIGS)
43         mkdir -p .BuildDist/$(PACKAGE)-$(VERSION)
44         cp -al $^ .BuildDist/$(PACKAGE)-$(VERSION)
45         for d in $(SUBDIRS); do make -C $$d VERSION=$(VERSION) copy-dist ; done
46         cd .BuildDist && tar czf ../$@ $(PACKAGE)-$(VERSION)
47         rm -rf .BuildDist/$(PACKAGE)-$(VERSION)
48
49 cleandist:
50         rm -f $(PACKAGE)-$(VERSION).tar.gz
51
52 clean:  cleandist
53         for d in $(SUBDIRS); do make -C $$d VERSION=$(VERSION) clean ; done
54
55 fsync:  fsync.c config.h
56
57 # end