summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 2cb459e1ea6d627499d28646fb3b54083f948fcf (plain)
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#
# Makefile
#
# Copyright (C) 1998, 1999, 2000, 2001, 2002  Red Hat, Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

include Makefile.inc
VERSION := $(shell awk '/Version:/ { print $$2 }' anaconda.spec)
RELEASE := $(shell awk '/Release:/ { print $$2 }' anaconda.spec)
CVSROOT ?= ${CVSROOT:-$(shell cat CVS/Root 2>/dev/null)}

SUBDIRS = isys wlite stubs loader2 po \
	    textw utils scripts bootdisk installclasses \
	    iw pixmaps command-stubs ui docs
# fonts aren't on s390/s390x
ifeq (,$(filter s390 s390x, $(ARCH)))
SUBDIRS += fonts
endif

ifneq (,$(filter ppc ppc64 i386 x86_64,$(ARCH)))
# we only do the liveinst bits on i386/x86_64 for now
SUBDIRS += liveinst
endif
ifneq (,$(filter i386 x86_64,$(ARCH)))
# gptsync only on x86 for mactels right now
SUBDIRS += gptsync
endif

PYCHECKERPATH=isys:textw:iw:installclasses:/usr/lib/booty:/usr/share/system-config-date
PYCHECKEROPTS=-F pycheckrc-for-anaconda

CATALOGS = po/anaconda.pot

PYFILES = $(wildcard *.py)

all:  subdirs mini-wm xutils.so $(CATALOGS) lang-table lang-names

lang-names: lang-table subdirs
	PYTHONPATH="." $(PYTHON) scripts/getlangnames.py > lang-names

mini-wm: mini-wm.c
	gcc -o mini-wm mini-wm.c `pkg-config gtk+-x11-2.0 --cflags --libs` $(CFLAGS) $(LDFLAGS)

xutils.so: xutils.c
	gcc -ggdb -Wall -o xutils.o -fno-strict-aliasing -fPIC -I/usr/X11R6/include -I$(PYTHONINCLUDE) -I $(PYTHONINCLUDE) -c xutils.c $(CFLAGS) `pkg-config --cflags gdk-2.0`
	gcc -o xutils.so -shared xutils.o -ggdb -L/usr/X11R6/$(LIBDIR) -lX11 `pkg-config --libs gdk-2.0` $(LDFLAGS)

depend:
	rm -f *.o *.so *.pyc
	for d in $(SUBDIRS); do make -C $$d depend; done

clean:
	rm -f *.o *.so *.pyc lang-names mini-wm ChangeLog
	for d in $(SUBDIRS); do make -C $$d clean; done

subdirs:
	for d in $(SUBDIRS); do make -C $$d; [ $$? = 0 ] || exit 1; done

# this rule is a hack
install-python:
	cp -var $(PYFILES) $(DESTDIR)/$(PYTHONLIBDIR)
	./py-compile --basedir $(DESTDIR)/$(PYTHONLIBDIR) $(PYFILES)
	install -m 755 anaconda $(DESTDIR)/usr/bin/anaconda
	for d in installclasses isys iw textw; do make DESTDIR=`cd $(DESTDIR); pwd` -C $$d install; [ $$? = 0 ] || exit 1; done

install: 
	@if [ "$(DESTDIR)" = "" ]; then \
		echo " "; \
		echo "ERROR: A destdir is required"; \
		exit 1; \
	fi

	mkdir -p $(DESTDIR)/usr/bin
	mkdir -p $(DESTDIR)/usr/sbin
	mkdir -p $(DESTDIR)/etc/rc.d/init.d
	mkdir -p $(DESTDIR)/$(PYTHONLIBDIR)
	mkdir -p $(DESTDIR)/$(RUNTIMEDIR)
	mkdir -p $(DESTDIR)/$(ANACONDADATADIR)

	install -m 755 anaconda $(DESTDIR)/usr/sbin/anaconda
	install -m 755 mini-wm $(DESTDIR)/usr/bin/mini-wm

	cp -var $(PYFILES) $(DESTDIR)/$(PYTHONLIBDIR)
	cp -a lang-table $(DESTDIR)/$(PYTHONLIBDIR)
	cp -a lang-names $(DESTDIR)/$(PYTHONLIBDIR)
	./py-compile --basedir $(DESTDIR)/$(PYTHONLIBDIR) $(PYFILES)
	cp -a *.so $(DESTDIR)/$(PYTHONLIBDIR)
	strip $(DESTDIR)/$(PYTHONLIBDIR)/*.so
	for d in $(SUBDIRS); do make DESTDIR=`cd $(DESTDIR); pwd` -C $$d install; [ $$? = 0 ] || exit 1; done

tag:
	@git tag -a -m "Tag as anaconda-$(VERSION)-$(RELEASE)" -f anaconda-$(VERSION)-$(RELEASE)
	@echo "Tagged as anaconda-$(VERSION)-$(RELEASE)"

ChangeLog:
	(GIT_DIR=.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)

archive: tag
	@rm -f ChangeLog docs/kickstart-docs.txt docs/command-line.txt
	@make ChangeLog
	@make -C docs kickstart-docs.txt command-line.txt
	@git-archive --format=tar --prefix=anaconda-$(VERSION)/ HEAD > anaconda-$(VERSION).tar
	@mkdir -p anaconda-$(VERSION)/docs/
	@cp docs/kickstart-docs.txt docs/command-line.txt anaconda-$(VERSION)/docs/
	@cp ChangeLog anaconda-$(VERSION)/
	@tar --append -f anaconda-$(VERSION).tar anaconda-$(VERSION)
	@bzip2 -f anaconda-$(VERSION).tar
	@rm -rf anaconda-$(VERSION)

src: archive
	@rpmbuild -ts --nodeps anaconda-$(VERSION).tar.bz2 || exit 1
	@rm -f anaconda-$(VERSION).tar.bz2

pycheck:
	PYTHONPATH=$(PYCHECKERPATH) pychecker $(PYCHECKEROPTS) *.py textw/*.py iw/*.py installclasses/*.py | grep -v "__init__() not called" 

pycheck-file:
	PYTHONPATH=.:$(PYCHECKERPATH) pychecker $(PYCHECKEROPTS) $(CHECK) | grep -v "__init__() not called" 

api:
	doxygen docs/api.cfg

rpmlog:
	@git-log --pretty="format:- %s (%ae)" anaconda-$(VERSION)-$(RELEASE).. |sed -e 's/@.*)/)/'
	@echo

bumpver:
	@NEWSUBVER=$$((`echo $(VERSION) |cut -d . -f 4` + 1)) ; \
	NEWVERSION=`echo $(VERSION).$$NEWSUBVER |cut -d . -f 1-3,5` ; \
	DATELINE="* `date "+%a %b %d %Y"` `git-config user.name` <`git-config user.email`> - $$NEWVERSION-1"  ; \
	cl=`grep -n %changelog anaconda.spec |cut -d : -f 1` ; \
	tail --lines=+$$(($$cl + 1)) anaconda.spec > speclog ; \
	(head -n $$cl anaconda.spec ; echo "$$DATELINE" ; make --quiet rpmlog 2>/dev/null ; echo ""; cat speclog) > anaconda.spec.new ; \
	mv anaconda.spec.new anaconda.spec ; rm -f speclog ; \
	sed -i "s/Version: $(VERSION)/Version: $$NEWVERSION/" anaconda.spec