File: Makefile.dist

package info (click to toggle)
scmxx 0.9.0-2.2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 1,964 kB
  • ctags: 1,111
  • sloc: ansic: 11,892; sh: 2,784; xml: 2,690; makefile: 253
file content (116 lines) | stat: -rw-r--r-- 2,924 bytes parent folder | download | duplicates (5)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
PROJECT=scmxx
VERSION=$(shell ./configure --version | grep ^$(PROJECT) | cut -f 3 -d " ")
OLDDIR=$(shell basename `readlink -f .`)
NEWDIR=$(PROJECT)-$(VERSION)

.PHONY: all
all: tar_gz tar_bz2 rpm exe

.PHONY: prepare
prepare: Makefile.cvs
	@if [ $(OLDDIR) != $(NEWDIR) ]; then \
	  if [ ! -d ../$(NEWDIR) ]; then \
	    echo "Renaming: $(OLDDIR) => $(NEWDIR)"; \
	    mv ../$(OLDDIR) ../$(NEWDIR); \
	  else \
	    echo "ERROR: ../$(NEWDIR)  already exists"; \
	    false; \
	  fi \
	fi
	@$(MAKE) -f Makefile.cvs Makefile
	@$(MAKE) -C docs/ all
	@$(MAKE) -f Makefile.cvs clean


#
# Pure source archives
#

.PHONY: tar_gz
tar_gz: ../$(NEWDIR).tar.gz

../$(NEWDIR).tar.gz: prepare
	@echo "Building ../$(NEWDIR).tar.gz..."
	@tar --directory .. --create --gzip --file $@ $(NEWDIR)

.PHONY: tar_bz2
tar_bz2: ../$(NEWDIR).tar.bz2

../$(NEWDIR).tar.bz2: prepare
	@echo "Building ../$(NEWDIR).tar.bz2..."
	@tar --directory .. --create --bzip2 --file $@ $(NEWDIR)


#
# RPM package creation
# It can handle old (<4.1) and new (>=4.1) versions of rpm.
#

ARCH=$(shell uname -m)
RPM=$(shell which rpmbuild || which rpm)
RPM_ROOT=$(shell echo $(shell $(RPM) --showrc | grep -E "_topdir[[:space:]]+") | cut -f 3 -d " ")

.PHONY: rpm
rpm: ../$(NEWDIR).tar.bz2
# using RPM as user really SUCKS :-(
# The RPM programmers never learned about good command line options, obviously.
	@test $(RPM) || echo "You need rpmbuild or rpm to build the .rpm files." 
# actually build the package files
	$(RPM) -ta --clean --target $(ARCH) $<
	@if [ "$(RPM_ROOT)" ]; then \
	  mv $(RPM_ROOT)/RPMS/$(ARCH)/$(NEWDIR)-*.$(ARCH).rpm ..; \
	  mv $(RPM_ROOT)/SRPMS/$(NEWDIR)-*.src.rpm ..; \
	else \
	  echo "You have to manually move the packages from your rpm build root."; \
	fi

#
# Debian package creation.
# You need a debian/ subdir, e.g. the one from Debian.
#

.PHONY: deb
deb: debian/rules
	-dpkg-buildpackage -rfakeroot -b -uc -us


#
# Windows installer creation using Inno Setup
# Define $INNODIR if the Inno Setup installation dir is not in your path.
# This variable MUST have a trailing (back)slash.
#

SYSTEM_TYPE=$(shell ./config.guess | cut -f 3 -d "-")
ISSFILE=winsetup-$(SYSTEM_TYPE).iss
CONFIGURE=./configure
ifeq '$(SYSTEM_TYPE)' 'cygwin'
#compiling with CygWin
EXELIBS=cygwin1.dll cygiconv-2.dll cygintl-3.dll
else
#compiling with MingW32 or cross-compiling
ISSFILE=winsetup-mingw.iss
EXELIBS=libiconv-2.dll libintl-3.dll
ifeq '$(SYSTEM_TYPE)' 'linux'
#this is for Debians mingw32 package
GCC_EXEC_PREFIX=i586-mingw32msvc-
CONFIGURE=cross-configure
endif
endif

%.dll:
	test "$(shell which $@)" && cp $(shell which $@) .

$(PROJECT).exe:
	$(MAKE) -f Makefile.cvs
	$(CONFIGURE)
	$(MAKE) clean
	$(MAKE)

UNIX2DOS=unix2dos
ISCC=$(INNODIR)iscc
.PHONY: exe
exe: $(ISSFILE) $(PROJECT).exe $(EXELIBS)
	$(UNIX2DOS) docs/README_WIN32.txt
#Does stripping work with cygwin libs?
	$(GCC_EXEC_PREFIX)strip *.exe $(EXELIBS)
	$(ISCC) /O.. $(ISSFILE)