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
###########################################################################
#
# This makefile should build "tsv2zdb"
#
# Notes:
#	On linux You must at least set
#	    - ZINC, CE_UTILITIES_LIB and ZDB_LIB
#	      pointing to your zdb installation to the
#	      include directory and binary directory.
#	ZLIBINC and ZLIBLIB should point to a zlib with version 1.2.8.
#	Other platform may need changes to the compiler settings
#	in CC, LD and STDlibs.
#
# -------------------------------------------------------------------------
#
# Generate a binary zdb database with tsv2zdb like this:
#
#   % ./tsv2zdb -o demo.zdb demo.tsv
#
###########################################################################

all : tsv2zdb

###
# The following Makefile configuration assumes you're using GNU compiler.
# Please adjust it to your environment...
###
CC          = gcc -Wall -Wextra $(CFLAGS)
LD          = gcc -W -Wall
STDlibs	    = -lm -ldl -lrt

# ZDB installation location
ZINC    = ../../../../include
BINDIR  = ../../../../linux64
CE_UTILITIES_LIB  = $(BINDIR)/ce_utilities.a
ZDB_LIB = $(BINDIR)/zdb.a
ZLIBINC =
ZLIBLIB = -lz

includes : $(ZINC)/zos/ztypes.h \
	   $(ZINC)/zos/zos.h \
	   $(ZINC)/zos/zerror.h \
	   $(ZINC)/zos/zhash.h \
	   $(ZINC)/zos/zosmem.h \
	   $(ZINC)/zdb/zdb.h \
	   $(ZINC)/zdb/zdbmem.h \
	   $(ZINC)/zdb/zpos.h \
	   $(ZINC)/zdb/zdump.h \
	   $(ZINC)/zdb/zvalidate.h \
	   $(ZINC)/zdb/zoper.h

###
# compilation rules
###
tsv2zdb.o : tsv2zdb.c includes
	$(CC) -c -o $@ $(CFLAGS) -I. -I$(ZINC) $(ZLIBINC) tsv2zdb.c

tsv2zdb : tsv2zdb.o
	$(LD) -o $@ tsv2zdb.o $(ZDB_LIB) \
				  $(CE_UTILITIES_LIB) \
			      $(ZLIBLIB) \
			      $(STDlibs)

clean ::
	rm -f tsv2zdb.o tsv2zdb

###
# the target "demo" will read a demo.tsv and create the corresponding
# zdb database.
#
demo :: tsv2zdb demo.tsv
	./tsv2zdb -validate -d demo.dmp -spos -o demo.zdb demo.tsv
clean ::
	rm -f demo.dmp demo.zdb