File: Makefile

package info (click to toggle)
libxmltok 1.2-4
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster
  • size: 540 kB
  • ctags: 1,359
  • sloc: ansic: 10,535; makefile: 134
file content (97 lines) | stat: -rw-r--r-- 2,344 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
CC=cc
# If you know what your system's byte order is, define XML_BYTE_ORDER:
# use -DXML_BYTE_ORDER=12 for little-endian byte order;
# use -DXML_BYTE_ORDER=21 for big-endian (network) byte order.
# -DXML_NS adds support for checking of lexical aspects of XML namespaces spec
# -DXML_MIN_SIZE makes a smaller but slower parser
# -DXML_DTD adds full support for parsing DTDs
CFLAGS=-Wall -O2
CFLAGS+=--pipe -DXML_NS -DXML_DTD
INCLUDES=-Ixmltok -Ixmlparse
# Use one of the next two lines; unixfilemap is better if it works.
FILEMAP_OBJ=xmlwf/unixfilemap.o
#FILEMAP_OBJ=xmlwf/readfilemap.o
# if you want to make the libraries and shlibs
MAKE_LIBS=true

ELF_SO_VERSION=1		# major library version
LIB_VERSION=1.2			# full library version
LIBS=xmltok/libxmltok.a xmlparse/libxmlparse.a
ELF_LIBS=xmltok/libxmltok.so.$(LIB_VERSION) \
  xmlparse/libxmlparse.so.$(LIB_VERSION)
ELF_OTHER_LIBS=-lc		# other libs to link shlib with
ELF_FLAGS=-fpic -D_REENTRANT	# flags for compiling shlibs
AR=ar
RANLIB=true

prefix		= /usr/local
bin_dir		= $(prefix)/bin

ifndef MAKE_LIBS
  OBJS=$(FILEMAP_OBJ) \
    xmlparse/xmlparse.o \
    xmltok/xmltok.o \
    xmltok/xmlrole.o \
    xmlwf/xmlwf.o \
    xmlwf/xmlfile.o \
    xmlwf/codepage.o
else
  OBJS=$(FILEMAP_OBJ) \
    xmlwf/xmlwf.o \
    xmlwf/xmlfile.o \
    xmlwf/codepage.o
  LIBS_TO_BUILD=$(ELF_LIBS) \
    $(LIBS)
endif

EXE=
XMLWF=xmlwf/xmlwf$(EXE)

# export these variables to sub-makes
export

all: $(XMLWF)

shlib-version:
	@echo $(LIB_VERSION)

$(XMLWF): $(OBJS) $(LIBS_TO_BUILD)
ifndef MAKE_LIBS
	$(CC) $(CFLAGS) $(INCLUDES) -o $@ $(OBJS)
else
	$(CC) $(CFLAGS) $(INCLUDES) -o $@ $(OBJS) -Lxmlparse -lxmlparse \
		-Lxmltok -lxmltok
endif

$(LIBS) $(ELF_LIBS):
	$(MAKE) -C$(dir $@) $(notdir $@)

clean:
	rm -f $(OBJS) $(XMLWF) gennmtab/gennmtab$(EXE)
ifdef MAKE_LIBS
	$(MAKE) -Cxmltok clean
	$(MAKE) -Cxmlparse clean
endif

xmltok/nametab.h: gennmtab/gennmtab$(EXE)
	rm -f $@
	gennmtab/gennmtab$(EXE) >$@

gennmtab/gennmtab$(EXE): gennmtab/gennmtab.c
	$(CC) $(CFLAGS) $(INCLUDES) -o $@ gennmtab/gennmtab.c

xmltok/xmltok.o: xmltok/nametab.h

.c.o:
	$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<

shared/%.o:	%.c
	$(CC) $(CFLAGS) $(INCLUDES) $(ELF_FLAGS) -c -o $@ $<

install:
	mkdir -p $(bin_dir)
	cp -a xmlwf/xmlwf$(EXE) $(bin_dir)
ifdef MAKE_LIBS
	$(MAKE) -Cxmltok install
	$(MAKE) -Cxmlparse install
endif