1
2COLLECT = ar cru
3RANLIB = ranlib
4LNK = ln -s
5POST = $(fltkconfig) --post
6RPMARCH = `rpmbuild --showrc | awk '/^build arch/ {print $$4}'`
7MSGCAT = msgcat
8MSGFMT = msgfmt -c --statistics
9
10docdir          = $(datadir)/doc/$(TARGET)
11SRCDIR          = $(src_dir)
12BUILDDIR        = $(build_dir)/
13
14
15MAN1 =
16MAN3 =
17DOKU =  AUTHORS \
18        ChangeLog \
19        COPYING \
20        README
21MIME_TYPES =
22
23ICONS =
24
25DEFAULT_PROFILES = printing
26default_profiles = default_profiles
27
28CONFIG_FILES = \
29	$(SRCDIR)/configure \
30	$(SRCDIR)/configure_tests.sh \
31	$(SRCDIR)/makefile.in \
32	$(SRCDIR)/$(TARGET).spec.in \
33	$(SRCDIR)/$(TARGET)_control.in
34
35ALL_FILES = \
36	$(DOKU) \
37	$(ICONS) \
38	$(MIME_TYPES) \
39	$(MAN1) $(MAN3)
40
41# build all what is needed to run the libraries, helpers
42all:
43	test -d $(default_profiles) && \
44	( cd $(default_profiles); \
45	for prof in $(DEFAULT_PROFILES); do \
46	     test -d $${prof} && \
47	         echo "$${prof} profiles will be included" || \
48	         echo "$${prof} profile directory is not found - ignoring"; \
49	done; ) || echo "$(default_profiles) directory is not found - ignoring"
50	echo ... $@ done
51
52
53# get time stamp
54MTIME   := $(shell date +%y%m%d.%H%M%S)
55
56# this is a test
57time:
58	echo $(MTIME)
59
60
61# install recursive
62install:	install-main install-icc
63	echo ... $@ done
64
65install-main:
66
67install-icc:	install_profiles
68
69
70install_profiles:
71	test -d $(default_profiles) && \
72	( cd $(default_profiles); \
73	for prof in $(DEFAULT_PROFILES); do \
74	     test -d $${prof} && \
75	         (cd $${prof}; $(MAKE) DESTDIR="$(DESTDIR)" SYSCOLORDIR=$(syscolordir) ICCDIRNAME=$(iccdirname) install) || \
76	         echo "$${prof} profile directory is not found - ignoring"; \
77	done; ) || echo "$(default_profiles) directory is not found - ignoring"
78
79
80# build a source distribution package
81dist: targz
82	test -d ../Archiv && mv -v ../Archiv/$(TARGET)-$(MTIME).tgz $(TARGET)-$(VERSION).tar.gz || mv -v $(TARGET)-$(MTIME).tgz $(TARGET)-$(VERSION).tar.gz
83	tar xzf $(TARGET)-$(VERSION).tar.gz
84	tar cjf $(TARGET)-$(VERSION).tar.bz2 $(TARGET)-$(VERSION)/
85	$(RM) -R $(TARGET)-$(VERSION)
86
87dist-gzip:	dist
88
89# build a binary rpm package
90rpm:	dist
91	$(SRCDIR)/configure --prefix=/usr --rpm-only # generate the spec file
92	mkdir -p rpmdir/BUILD \
93	rpmdir/SPECS \
94	rpmdir/SOURCES \
95	rpmdir/SRPMS
96	$(COPY) -f $(TARGET)-$(VERSION).tar.bz2 rpmdir/SOURCES
97	rpmbuild --clean -ba $(build_dir)/$(TARGET).spec --define "_topdir $$PWD/rpmdir"
98	@echo "============================================================"
99	@echo "Finished - the packages are in rpmdir/RPMS and rpmdir/SRPMS!"
100
101deb:	dist
102	$(SRCDIR)/configure --prefix=/usr --rpm-only
103	mkdir -p debian/deb/DEBIAN
104	tar xvzf $(TARGET)-$(VERSION).tar.gz
105	(cd $(TARGET)-$(VERSION); \
106	./configure --prefix=/usr; \
107	make DESTDIR=$(build_dir)/debian/deb/DEBIAN install;)
108	$(COPY) $(TARGET)-$(VERSION)/$(TARGET)_control $(build_dir)/debian/deb/DEBIAN/control
109	$(RM) -R $(TARGET)-$(VERSION)
110	dpkg -b $(build_dir)/debian/deb debian/$(TARGET)_$(VERSION)-$(RELEASE)_$(deb_arch).deb
111	$(RM) -R $(build_dir)/debian/deb
112	echo ... $@ done
113
114# remove everything previously installed
115uninstall:	uninstall-icc
116
117
118uninstall_profiles:
119	echo Uninstalling profiles ...
120	test -d $(default_profiles) && \
121	(  cd $(default_profiles); \
122	   for prof in $(DEFAULT_PROFILES); do \
123	     test -d $${prof} && \
124	         (cd $${prof}; $(MAKE)  DESTDIR="$(DESTDIR)" SYSCOLORDIR=$(syscolordir) ICCDIRNAME=$(iccdirname) uninstall) || \
125	         echo "$${prof} profile directory is not found - ignoring"; \
126	   done; \
127        ) || echo "no profile directory found"
128	echo ... done uninstalling profiles
129
130uninstall-icc:	uninstall_profiles
131
132
133
134# remove in this directory
135distclean: clean
136	-$(RM) Makefile
137	-$(RM) $(default_profiles)/printing/Makefile
138	-$(RM) $(TARGET).spec $(TARGET)-icc.spec
139
140clean:
141	echo ... $@ done
142
143
144
145
146
147# smallest package covering the current directory
148tgz:
149	-test -d Entwickeln && $(RM) -r Entwickeln
150	$(MAKE) DESTDIR=Entwickeln copy_files
151	tar cf - Entwickeln/ \
152	| gzip > $(TARGET)_$(MTIME).tgz
153	-test -d ../Archiv && mv -v $(TARGET)_*.tgz ../Archiv
154	-test -d Entwickeln && \
155	test `pwd` != `(cd Entwickeln; pwd)` && \
156	rm -R Entwickeln
157
158# build the source package including the subdirectories
159targz:
160	test -d $(TARGET)-$(VERSION) && $(RM) -R $(TARGET)-$(VERSION) || echo -e "\c"
161	$(MAKE) DESTDIR=$(build_dir)/$(TARGET)-$(VERSION) copy_files
162	cd $(default_profiles); \
163	for prof in $(DEFAULT_PROFILES); do \
164	     test -d $${prof} && \
165	         mkdir -p ../$(TARGET)-$(VERSION)/$(default_profiles)/$${prof}; \
166	         (cd $${prof}; echo bin in `pwd`; $(MAKE) DESTDIR=$(build_dir)/$(TARGET)-$(VERSION)/$(default_profiles)/$${prof} copy_files; $(RM) $(build_dir)/$(TARGET)-$(VERSION)/$(default_profiles)/$${prof}/Makefile) || \
167	         echo "$${prof} profile directory is not found - ignoring"; \
168	done;
169	tar cf - $(TARGET)-$(VERSION)/ \
170	| gzip > $(build_dir)/$(TARGET)-$(MTIME).tgz
171	test -d $(build_dir)/$(TARGET)-$(VERSION) && \
172	test `pwd` != `(cd $(build_dir)/$(TARGET)-$(VERSION); pwd)` && \
173	$(RM) -R $(build_dir)/$(TARGET)-$(VERSION)
174	test -d ../Archiv && mv -v $(TARGET)-*.tgz ../Archiv || echo "no copy"
175
176# basic file set
177copy_files:
178	mkdir $(DESTDIR)
179	cd $(SRCDIR) && \
180	  $(COPY) -R $(ALL_FILES) $(DESTDIR)
181	$(COPY) $(CONFIG_FILES) $(DESTDIR)
182	echo ... $@ done
183
184help:
185	echo "... all :        build the binaries"
186	echo "... "
187	echo "... install :    install the binaries, include files and data"
188	echo "... install-icc: install only profiles and targets"
189	echo "... uninstall"
190	echo "... clean :      remove binaries, object files and most processed data"
191	echo "... distclean :  remove all files processed from configure scripts"
192	echo "... rpm :        build RPM's"
193	echo "... dist :       build a distribution tarball and place local"
194	echo "... targz :      build a distribution tar ball"
195	echo "... tgz :        build a development tar ball"
196	echo "... copy_files : copy distribution files to a DESTDIR=xxx path"
197	echo "  VARIABLES:"
198	echo "... DESTDIR=\"/user/a/My Install Dir/\" install"
199	echo "... BUILDDIR=../build_local"
200
201
202