File: GNUmakefile

package info (click to toggle)
r-cran-xml 3.98-1.5-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 9,464 kB
  • ctags: 636
  • sloc: xml: 79,579; ansic: 6,518; asm: 644; sh: 16; makefile: 1
file content (200 lines) | stat: -rw-r--r-- 3,717 bytes parent folder | download | duplicates (3)
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
OMEGA_HOME=../..
ifdef ADMIN
 include Install/GNUmakefile.admin
endif


#
# This is not used when installing the R package.
# Instead, the command 
#        R INSTALL XML
# or 
#        R INSTALL XML.tar.gz
# is used.


CC=gcc
#CC=cc

# Command for invoking S.
S=Splus5
SHOME=/usr/local/src/Splus5.1

# Set this to be R or S
#LANGUAGE=S
LANGUAGE=R


# Set either of these as appropriate.
#LIBXML=/usr2/Downloads/libxml-1.8.6
#LIBXML=/home/duncan/XML/libxml2-2.0.0
#LIBXML=/home/duncan/XML/libxml-1.8.9

#LIBXML=/home/duncan/XML/libxml2-2.2.7
LIBXML=/home/rgentlem/XML/libxml2-2.2.11
LIBXML2=1
#LIBEXPAT=$(HOME)/XML/expat


ifndef LIBXML
ifndef LIBEXPAT
message: 
endif
endif
ifndef LIBEXPAT
ifndef LIBXML
message: 
endif
endif


SRC=\
    Utils \
    $(LANGUAGE)Utils \
    RSDTD \
    EventParse  \
    xpath


LIBXML_SRC= DocParse XMLEventParse XMLTree
LIBEXPAT_SRC= ExpatParse 

ifdef LIBXML
 SRC += $(LIBXML_SRC)
 LIBXML_INCLUDES=. libxml
 LIBXML_LIBS= xml
 CFLAGS+= -DLIBXML
ifdef LIBXML2
 LIBXML_DIRS=$(LIBXML)/.libs
 CFLAGS+= -DLIBXML2
 LIBXML_LIBS= xml2
endif
endif



ifdef LIBEXPAT
 SRC += $(LIBEXPAT_SRC)
 EXPATXML_INCLUDES= xmlparse xmltok
 EXPATLIB_DIRS=$(LIBEXPAT)/lib
 EXPAT_LIBS= xmlparse xmltok
 CFLAGS+= -DLIBEXPAT
endif

OBJS=$(SRC:%=%.o)

INCLUDES+= $(OMEGA_HOME)/include/Corba $(LIBXML_INCLUDES:%=$(LIBXML)/%) $(EXPATXML_INCLUDES:%=$(LIBEXPAT)/%)

LIB_DIRS=$(EXPATLIB_DIRS) $(LIBXML_DIRS:%=%)
LIBS= $(EXPAT_LIBS) $(LIBXML_LIBS)

ifeq ($(CC),gcc)
# -Wall
 CFLAGS+= -g -fpic -Wall
 LD_PIC_FLAG=-shared
 RPATH_FLAG=--rpath
else
 CFLAGS+= -g -KPIC
 LD_PIC_FLAG=-G
 RPATH_FLAG=-R
endif

ifeq ($(LANGUAGE),R)
  CFLAGS+=-DUSE_R=1 -D_R_=1
  INCLUDES+=$(R_HOME)/include
  LIBNAME=XML.so
else
#  SHOME=$(HOME)/Projects/S4
  CFLAGS+= -DUSE_S -D_S_=1 -D_S4_=1
  INCLUDES+=$(SHOME)/include
  LIBS+= z
  LIBNAME=S.so
endif



$(LIBNAME): $(OBJS)
	$(CC) $(LD_PIC_FLAG) -o $@ $^ $(LIB_DIRS:%=-L%)  $(LIB_DIRS:%=$(RPATH_FLAG)%) $(LIBS:%=-l%)  

%.o: %.c
	$(CC) $(INCLUDES:%=-I%) $(CFLAGS) -c $<


clean:
	for f in $(OBJS) ; do \
	 if [ -f $$f ] ; then \
	   rm $$f ; \
	 fi \
	done


distclean: clean
	for f in  R.so ; do \
	  if [ -f $$f ] ; then rm $$f ; fi \
	done


again: distclean
	$(MAKE)

dom: DOMParse.o
	$(CC) -o $@ $^ $(LIB_DIRS:%=-L%)  $(LIB_DIRS:%=--rpath%) $(LIBS:%=-l%) 


message:
	@echo "Error:"
	@echo "   You must specify a value for either LIBXML or LIBEXPAT, or both."



.PHONY: expat libxml
expat:
	cd expat ; tar cf - . | (cd $(LIBEXPAT) ; tar xf - )
libxml:
	cd libxml ; tar cf - . | (cd $(LIBXML) ; tar xf - )


# Make the patch to libxml/SAX.c to change the symbol
# `attribute' to something else to avoid the conflict with Splus5/S4.
libxmlpatch:
	 (PWD=`pwd`; export PWD ; cd $(LIBXML) ; patch -f < $(PWD)/PATCH.attribute)


Src/XML:
	(cd Src ; cat * > XML ; echo "" >> XML)

initS:  Src/XML
	$(S) CHAPTER
	$(S) < Src/XML 

  
ifndef C_SRC_FILES
C_SRC_FILES=\
  DocParse.c DocParse.h \
  EventParse.c EventParse.h \
  ExpatParse.c ExpatParse.h \
  RSDTD.c RSDTD.h \
  RS_XML.h \
  RUtils.c \
  Utils.c Utils.h \
  XMLEventParse.c \
  XMLTree.c \
  xpath.c
endif
  

# MAN_FILES=$(shell find man -not -type d -not -name '*~')

# DATA_FILES=$(shell find examples data -not -type d -maxdepth 1 -not -name '*~')


MANUALS=$(shell find Docs -name '*.nw')
manuals: $(MANUALS:%.nw=%.ps)

%.ps: %.nw
	$(MAKE) -C $(@D) $(@F)


schema.o: schema.c
	gcc  -I$(R_HOME)/include -DLIBXML -I/usr/local/include/libxml2 -DUSE_EXTERNAL_SUBSET=1 -DROOT_HAS_DTD_NODE=1 -DDUMP_WITH_ENCODING=1 -DUSE_XML_VERSION_H=1 -DXML_ELEMENT_ETYPE=1 -DXML_ATTRIBUTE_ATYPE=1 -DNO_XML_HASH_SCANNER_RETURN=1 -DUSE_R=1 -D_R_=1  -DHAVE_VALIDITY=1 -I. -DLIBXML2=1 -I/usr/local/include   -fPIC  -g -g  -c schema.c -o schema.o