aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 6a453ed7b0c50216dffe34eb0f934d6f1db2be53 (plain)
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
# $Id: Makefile,v 1.1.1.1 1999/02/02 23:29:39 shmit Exp $

PREFIX=/home/shmit
#PREFIX=/usr/local/ticra
BINDIR=$(PREFIX)/bin
LIBEXECDIR=$(PREFIX)/libexec/ticra
DATADIR=$(PREFIX)/libdata/ticra

CC=gcc
INSTALL=install

BINMODE=755
DATAMODE=644

# This is needed for FreeBSD machines.
OSLIBS=-lutil

# SysV Machines.
#OSLIBS=-lnsl -lsocket

PATHFLAGS=-DBINDIR=\"$(BINDIR)\" -DLIBEXECDIR=\"$(LIBEXECDIR)\"		\
	  -DDATADIR=\"$(DATADIR)\"
COPTS=-Wall -g -O3 -pipe -DDEBUG

CFLAGS=$(COPTS) $(PATHFLAGS)
LIBS=$(OSLIBS)

# Source files.
SOURCES=dumper.c run-dump.c taper.c label.c conf.c strutil.c err.c compat.c \
	smrsh.c lock.c

# Programs to build.
CLIENT_BIN=smrsh
CLIENT_LIBEXEC=run-dump run-estimate
SERVER_BIN=dumper restore label getconf
SERVER_LIBEXEC=taper report

# Examples files to install.
EXAMPLES=client.conf server.conf disklist hostlist dumptypes

.c.o:
	$(CC) $(CFLAGS) -c $<
.sh:
	cp -p $< $@
	chmod 755 $@

all:	server client tags

server:	$(SERVER_BIN) $(SERVER_LIBEXEC)

client:	$(CLIENT_BIN) $(CLIENT_LIBEXEC)

tags:	$(SOURCES)
	ctags $(SOURCES)

install: install-server install-client install-examples

install-server: server
	mkdir -p $(BINDIR)
	mkdir -p $(LIBEXECDIR)
	$(INSTALL) -c -m $(BINMODE) $(SERVER_BIN) $(BINDIR)
	$(INSTALL) -c -m $(BINMODE) $(SERVER_LIBEXEC) $(LIBEXECDIR)

install-client: client
	mkdir -p $(BINDIR)
	mkdir -p $(LIBEXECDIR)
	$(INSTALL) -c -m $(BINMODE) $(CLIENT_BIN) $(BINDIR)
	$(INSTALL) -c -m $(BINMODE) $(CLIENT_LIBEXEC) $(LIBEXECDIR)

install-examples:
	mkdir -p $(DATADIR)/examples
	$(INSTALL) -c -m $(DATAMODE) $(EXAMPLES) $(DATADIR)/examples

clean:
	rm -f $(SERVER_BIN) $(SERVER_LIBEXEC) $(CLIENT_BIN) $(CLIENT_LIBEXEC) \
	      tags *.o

#
# Binary dependencies.
#
DUMPER_OBJS=dumper.o conf.o lock.o strutil.o err.o compat.o
dumper:	$(DUMPER_OBJS)
	$(CC) $(CFLAGS) -o $@ $(DUMPER_OBJS) $(LIBS)

RUN-DUMP_OBJS=run-dump.o conf.o strutil.o err.o compat.o
run-dump: $(RUN-DUMP_OBJS)
	$(CC) $(CFLAGS) -o $@ $(RUN-DUMP_OBJS) $(LIBS)

RUN-ESTIMATE_OBJS=run-estimate.o conf.o strutil.o err.o
run-estimate: $(RUN-ESTIMATE_OBJS)
	$(CC) $(CFLAGS) -o $@ $(RUN-ESTIMATE_OBJS)

TAPER_OBJS=taper.o tapeio.o conf.o lock.o strutil.o err.o compat.o
taper:	$(TAPER_OBJS)
	$(CC) $(CFLAGS) -o $@ $(TAPER_OBJS) $(LIBS)

RESTORE_OBJS=restore.o tapeio.o conf.o lock.o strutil.o compat.o
restore: $(RESTORE_OBJS)
	$(CC) $(CFLAGS) -o $@ $(RESTORE_OBJS)

LABEL_OBJS=label.o tapeio.o conf.o lock.o strutil.o err.o compat.o
label:	$(LABEL_OBJS)
	$(CC) $(CFLAGS) -o $@ $(LABEL_OBJS)

GETCONF_OBJS=getconf.o conf.o strutil.o err.o
getconf: $(GETCONF_OBJS)
	$(CC) $(CFLAGS) -o $@ $(GETCONF_OBJS)

SMRSH_OBJS=smrsh.o
smrsh:	$(SMRSH_OBJS)
	$(CC) $(CFLAGS) -o $@ $(SMRSH_OBJS)

#
# Dependency rules.
#
dumper.o:	conf.h config.h err.h lock.h

run-dump.o:	conf.h strutil.h config.h

run-estimate.o:	conf.h config.h err.h

taper.o:	tapeio.h conf.h config.h err.h lock.h

restore.o:	tapeio.h conf.h config.h lock.h

label.o:	tapeio.h conf.h config.h lock.h

getconf.o:	conf.h config.h

smrsh.o:	config.h

tapeio.o:	tapeio.h err.h strutil.h

conf.o:		conf.h strutil.h config.h err.h

err.o:		err.h config.h

lock.o:		lock.h config.h

strutil.o:	strutil.h config.h

compat.o:	compat.h config.h

config.h:	compat.h Makefile