1CLIENTS:= loc_api
2SERVERS:= loc_api_cb
3COMMON:= loc_api_common
4RPC_INC:= inc-$(AMSS_VERSION)
5
6all: $(CLIENTS) $(SERVERS) $(COMMON) fixup
7
8$(CLIENTS) $(SERVERS) $(COMMON):: xdr = $(@:=.xdr)
9
10$(CLIENTS) $(SERVERS) $(COMMON)::
11	rpcgen -h -M $(xdr) -o ../$(RPC_INC)/$(addsuffix .h, $@)
12	rpcgen -c -M $(xdr) -o $(addsuffix _xdr.c, $@)
13
14$(CLIENTS)::
15	rpcgen -l -M $(xdr) -o $(addsuffix _clnt.c, $@)
16
17$(SERVERS)::
18	rpcgen -m -M $(xdr) -o $(addsuffix _svc.c, $@)
19
20fixup:
21	mv ../$(RPC_INC)/loc_api_common.h ../$(RPC_INC)/loc_api_common.h.bak
22	sed ../$(RPC_INC)/loc_api_common.h.bak -e "/#include <rpc/a#include \"loc_api_fixup.h\"" > ../$(RPC_INC)/loc_api_common.h
23	rm -f ../$(RPC_INC)/loc_api_common.h.bak
24
25clean:
26	rm -f $(addsuffix _clnt.c, $(CLIENTS))
27	rm -f $(addsuffix _svc.c, $(SERVERS))
28	rm -f $(addsuffix _xdr.c, $(CLIENTS) $(SERVERS) $(COMMON))
29	rm -f $(addprefix ../$(RPC_INC)/, $(addsuffix .h, $(CLIENTS) $(SERVERS) $(COMMON)))
30