1# BEGIN LICENSE BLOCK
2# Version: CMPL 1.1
3#
4# The contents of this file are subject to the Cisco-style Mozilla Public
5# License Version 1.1 (the "License"); you may not use this file except
6# in compliance with the License.  You may obtain a copy of the License
7# at www.eclipse-clp.org/license.
8# 
9# Software distributed under the License is distributed on an "AS IS"
10# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See
11# the License for the specific language governing rights and limitations
12# under the License. 
13# 
14# The Original Code is  The ECLiPSe Constraint Logic Programming System. 
15# The Initial Developer of the Original Code is  Cisco Systems, Inc. 
16# Portions created by the Initial Developer are
17# Copyright (C) 2006 Cisco Systems, Inc.  All Rights Reserved.
18# 
19# Contributor(s): ___________________________________. 
20# 
21# END LICENSE BLOCK
22#
23# Make a copy of the files from the current directory to
24# the library directories
25#
26# $Id: Makefile.in,v 1.2 2009/03/27 02:17:33 kish_shen Exp $
27#
28
29ARCH = @ARCH@
30top_srcdir = @top_srcdir@
31PREFIX = @prefix@
32MAKEFILE = Makefile.$(ARCH)
33
34PERM = a+r,u+w,go-w
35DIRPERM = 2755
36ECLIPSE = $(PREFIX)/bin/$(ARCH)/eclipse
37
38
39EXAMPLE_FILES = propia/.stamp propia/crossword.pl propia/manual_examples.pl propia/zebra.pl
40PL_ECO_FILES = propia.pl chr.pl chr2pl.pl r.pl conjunto.pl set.pl s_lists.pl
41PL_ECI_FILES = propia.pl chr.pl conjunto.pl
42INCLUDE_ONLY_FILES = chr_doc.pl
43
44
45EXAMPLE_DEST =	$(EXAMPLE_FILES:%=$(PREFIX)/doc/examples/%) 
46ECO_DEST =	$(PL_ECO_FILES:%.pl=$(PREFIX)/lib/%.eco)
47SOURCE_DEST =	$(PL_ECO_FILES:%.pl=$(PREFIX)/lib/%.pl) \
48		$(INCLUDE_ONLY_FILES:%=$(PREFIX)/lib/%)
49ECI_DEST =      $(PL_ECI_FILES:%.pl=$(PREFIX)/lib/%.eci)
50
51
52# install is configured as either install_all or install_cross
53install:	@MAKE_TARGET@
54
55install_cross:  $(SOURCE_DEST) chr_extra $(EXAMPLE_DEST)
56install_all :	install_cross $(ECO_DEST) $(ECI_DEST) 
57
58
59chr_extra:	$(PREFIX)/lib/chr/.stamp
60		cp chr_op.op $(PREFIX)/lib/chr
61		cp -pr chr/*.* $(PREFIX)/lib/chr
62		chmod -f $(PERM) $(PREFIX)/lib/chr/*
63
64
65# no success with making .eco files for grace...
66#grace:		$(PREFIX)/lib/grace/.stamp
67#		(cd grace; $(MAKE) AUX_ECLIPSE=$(PREFIX)/$(ECLIPSE) install)
68#		gunzip -c grace/grace.tar.gz|(cd $(PREFIX)/lib/grace; tar xf -)
69
70grace:		$(PREFIX)/lib/grace/.stamp
71		(cd grace && $(MAKE) AUX_ECLIPSE=$(PREFIX)/$(ECLIPSE) src)
72		gunzip -c grace/grace.src.tar.gz | \
73			(cd $(PREFIX)/lib/grace && tar xf -)
74		rm -f grace/grace.src.tar.gz
75		chmod -f $(PERM) $(PREFIX)/lib/grace/*
76
77clean:		ecoclean archclean
78
79ecoclean:
80		rm -rf $(ECO_DEST)
81
82archclean:
83
84
85# general installation rules
86
87$(PREFIX)/doc/examples/%.pl:	%.pl $(PREFIX)/doc/examples/.stamp
88	/bin/cp $< $@
89	-@/bin/chmod $(PERM) $@
90
91$(PREFIX)/lib/%.eco:	%.pl $(PREFIX)/lib/.stamp
92	$(ECLIPSE) -e 'get_flag(library_path,P),set_flag(library_path,["."|P]),lib(fcompile), set_flag(variable_names,off), fcompile("$(*F)", [outdir:"$(@D)"])'
93	-@/bin/chmod $(PERM) $@
94
95$(PREFIX)/lib/%.eci:	%.pl $(PREFIX)/lib/.stamp
96	$(ECLIPSE) -e 'get_flag(library_path,P),set_flag(library_path,["."|P]),lib(document),icompile("$(*F)","$(@D)")'
97	-@/bin/chmod $(PERM) $@
98
99$(PREFIX)/lib/%.pl:	%.pl $(PREFIX)/lib/.stamp
100	/bin/cp $< $@
101	-@/bin/chmod $(PERM) $@
102
103
104# How to make directories
105
106%/.stamp:
107	mkdir -p $(@D)
108	@/bin/chmod $(DIRPERM) $(@D)
109	@touch $@; /bin/chmod $(PERM) $@
110
111
112# Pretty-print the sources
113
114PRETTY_DIR =	$(PREFIX)/doc_internal/lib
115
116PL_FILES =	propia.pl conjunto.pl set.pl s_lists.pl
117
118HTML_DEST =	$(PL_FILES:%.pl=$(PRETTY_DIR)/%.html)
119
120pretty:		$(PRETTY_DIR)/.stamp $(HTML_DEST)
121
122$(PRETTY_DIR)/%.html:	%.pl $(PRETTY_DIR)/.stamp
123	-@$(PREFIX)/bin/$(ARCH)/eclipse -e \
124	    "lib(pretty_printer),argv(all,[_,O|F]),pretty_print(F,[outdir:O])" \
125	    -- "$(PRETTY_DIR)" $<
126
127