File: Makefile

package info (click to toggle)
nws 2.11-3
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,700 kB
  • ctags: 2,820
  • sloc: ansic: 28,849; sh: 3,289; java: 1,205; makefile: 697; perl: 12
file content (205 lines) | stat: -rwxr-xr-x 6,486 bytes parent folder | download
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
201
202
203
204
205
#
# Makefile for NWS. 
#
# $Id: Makefile,v 1.75 2004/12/06 20:29:25 graziano Exp $

# common variables
include Makedefs

# define the various subdirs we'll use
SUBDIRS		=	Common \
			Include \
			Doc \
			Sensor/ExpCPU \
                        Sensor/ExpDisk \
			Sensor/ExpConnect \
			Sensor/ExpMemory \
			Sensor/ExpTcpBw \
			Sensor/ExpFS \
                        Sensor/ExpAvail \
			Sensor/ExpMemorySpeed \
			Sensor/ExpStart \
			Sensor \
			JavaNwsProtocol
SDKDIRS		= 	Include JavaNwsProtocol
SERVERDIRS	= 	Server Server/Nwslapd
CLIENTDIR	=	Interface


# we create libnws.a here
LIBRARY		=	$(buildlibdir)/$(LIBNWSNAME)

# stuff related to create a tarball
DIST_FILES	=	ChangeLog \
			Makedefs.in \
			Makefile \
			README \
			VERSION \
			config.guess \
			config.sub \
			filelist \
			filelist.in \
			pkg_data_src.gpt \
			install-sh \
			configure

# these are needed to rebuild the old libnws.a
PORTABILITY_OBJS	=	$(buildobjdir)/diagnostic.o \
				$(buildobjdir)/dnsutil.o \
				$(buildobjdir)/formatutil.o \
				$(buildobjdir)/osutil.o \
				$(buildobjdir)/messages.o \
				$(buildobjdir)/strutil.o \
				$(buildobjdir)/timeouts.o \
				$(buildobjdir)/protocol.o
FORECAST_OBJS		=	$(buildobjdir)/exp_smooth.o \
				$(buildobjdir)/fbuff.o \
				$(buildobjdir)/forc.o \
				$(buildobjdir)/nws_forecast_api.o \
				$(buildobjdir)/last_value.o \
				$(buildobjdir)/median.o \
				$(buildobjdir)/mse_forc.o \
				$(buildobjdir)/run_mean.o
NWS_OBJS		=	$(buildobjdir)/nws_api.o \
				$(buildobjdir)/clique_protocol.o\
				$(buildobjdir)/register.o \
				$(buildobjdir)/host_protocol.o \
				$(buildobjdir)/periodic.o \
				$(buildobjdir)/experiments.o \
				$(buildobjdir)/skills.o \
				$(buildobjdir)/sensor.o

.PHONY: all common clients servers help
help:
	@echo "Possible targets for NWS:"
	@echo "   all                  - build everything"
	@echo "   install              - install everything"
	@echo "   clients              - build the clients (contains sensors)"
	@echo "   servers              - build the servers"
	@echo "   install-clients      - install the clients"
	@echo "   install-servers      - install the servers"
	@echo "   install-sdk          - install include file and static libraries"
	@echo "   clean                - remove objects files"
	@echo "   distclean            - remove build directory and configuration"
	@echo "   dist                 - creates a tar file of nws"

all: common clients servers $(LIBRARY)

# the common target: we need to build these for both clients and servers
common: precondition portability 
	@for subdir in $(SUBDIRS); do \
		(cd $$subdir && $(MAKE) all) || exit $$? ; done

# the target for building the clients
clients: common $(LIBRARY)
	@for subdir in $(CLIENTDIR); do \
		(cd $$subdir && $(MAKE) all) || exit $$? ; done

# the target for building the servers
servers: common $(LIBRARY)
	@for subdir in $(SERVERDIRS); do \
		(cd $$subdir && $(MAKE) all) || exit $$? ; done

# this is a temporary cheat: we'll fix when the libraries will be better
# defined. We recreate here the old libnws.a
$(PORTABILITY_OBJS): portability
$(FORECAST_OBJS): portability

$(NWS_OBJS): common

$(LIBRARY): $(SENSORS_OBJS) $(PORTABILITY_OBJS) $(FORECAST_OBJS) $(NWS_OBJS)
	$(AR) cr $(LIBRARY) $(NWS_OBJS) $(SENSORS_OBJS) $(PORTABILITY_OBJS) \
			$(FORECAST_OBJS)
	$(RANLIB) $(LIBRARY)

.PHONY: install install-common install-servers install-clients 
install: install-servers install-sdk install-clients

install-common: common
	@test -w $(prefix) || $(INSTALL) -d $(prefix)
	@test -w $(exec_prefix) || $(INSTALL) -d $(exec_prefix)
	@test -w $(bindir) || $(INSTALL) -d $(bindir)
	@test -w $(libdir) || $(INSTALL) -d $(libdir)
	@test -w $(incdir) || $(INSTALL) -d $(incdir)
	@test -w $(mandir)/man1 || $(INSTALL) -d $(mandir)/man1
	@test -w $(mandir)/man3 || $(INSTALL) -d $(mandir)/man3
	@test -w $(mandir)/man7 || $(INSTALL) -d $(mandir)/man7

install-servers: servers install-common
	@for subdir in $(SERVERDIRS); do \
		(cd $$subdir && $(MAKE) install) || exit $$? ; done

install-clients: clients install-common
	@for subdir in $(SUBDIRS); do \
		(cd $$subdir && $(MAKE) install) || exit $$? ; done
	@for subdir in $(CLIENTDIR); do \
		(cd $$subdir && $(MAKE) install) || exit $$? ; done

install-sdk: common
	@test -w $(libdir) || $(INSTALL) -d $(libdir)
	@test -w $(incdir) || $(INSTALL) -d $(incdir)
	@for subdir in $(SDKDIRS); do \
		(cd $$subdir && $(MAKE) install) || exit $$? ; done
	@$(CP) $(LIBRARY) $(libdir)

.PHONY: clean distclean dist tags 
clean: 
	@for subdir in $(SUBDIRS); do \
		(cd $$subdir && $(MAKE) $@) || exit $$? ; done
	@for subdir in $(CLIENTDIR); do \
		(cd $$subdir && $(MAKE) $@) || exit $$? ; done
	@for subdir in $(SERVERDIRS); do \
		(cd $$subdir && $(MAKE) $@) || exit $$? ; done
	@(cd $(PORTABILITY) && $(MAKE) $@) || exit $$?
	@$(RM) -f $(LIBRARY)

distclean: clean
	@(cd $(PORTABILITY) && $(MAKE) $@) || exit $$?
	@echo "Removing build directories ..."
	@$(RM) -fr build* $(DIST_NAME) $(DIST_NAME).md5sum
	@echo "Removing configuration files ..."
	@$(RM) -f Include/config_nws.h config.cache config.log config.status Makedefs tags
	@$(RM) -rf $(DIST_ROOT) $(DIST_NAME)

tags:
	$(CTAGS) -R 

dist: 
	@$(RM) -rf $(DIST_ROOT) $(DIST_NAME)
	@$(INSTALL) -d $(DIST_ROOT)
	@$(CP) $(DIST_FILES) $(DIST_ROOT)
	@for subdir in $(SUBDIRS); do \
		(cd $$subdir && $(MAKE) dist) || exit $$? ; done
	@for subdir in $(CLIENTDIR); do \
		(cd $$subdir && $(MAKE) dist) || exit $$? ; done
	@for subdir in $(SERVERDIRS); do \
		(cd $$subdir && $(MAKE) dist) || exit $$? ; done
	@(cd $(PORTABILITY); $(MAKE) $@) || exit $$?
	@(cd $(DIST_ROOT); $(TAR) -xf $(TOP)/$(PORTABILITY)/$(PORTABILITY).tar)
	@$(TAR) -cf $(DIST_NAME) $(DIST_DIR) || exit $$?
	@if test -x "`which md5sum`"; then md5sum $(DIST_NAME) > $(DIST_NAME).md5sum; fi
	@$(RM) -rf $(DIST_ROOT)

.PHONY: precondition portability 
portability: 
	@(cd $(PORTABILITY); $(MAKE) all) || exit $$? 

precondition: 
	@$(RM) -f compile.log
	@if test `./config.guess` != "$(configured)"; then \
		echo "NWS was configured for $(configured)!!"; \
		echo "you may want to run make clean and reconfigure for `./config.guess`!";\
		sleep 5; fi
	@$(INSTALL) -d $(buildobjdir)
	@$(INSTALL) -d $(buildlibdir)
	@$(INSTALL) -d $(buildincdir)
	@$(INSTALL) -d $(buildbindir)

Makedefs: Makedefs.in config.status
	./config.status

config.status: configure
	@if test ! -x ./config.status; then \
		echo "you have to run ./configure!"; exit 1; fi
	./config.status --recheck