# @(#) $Id: Makefile 2 2022-02-25 17:44:09Z perette $
INSTALL = /usr/local
LIBS=

ifndef X10MANAGER
X10MANAGER:=x10
endif

.C.o:
	$(CXX) -c -I../x10iod $<


all: setunit.o showunit.o fade.o turn.o x10test.o x10cli.o
	$(CXX) -o x10cli x10cli.o setunit.o showunit.o fade.o turn.o \
		x10test.o $(LIBS)
	rm -f showunit setunit fade turn x10test
	ln x10cli showunit
	ln x10cli setunit
	ln x10cli x10test
	ln x10cli turn
	ln x10cli fade

install:
	install    -o root -g $(X10MANAGER) -m 0740 -b action ~/bin/action

installroot: all
	[ -d $(INSTALL)/bin ] || \
		install -d -o root -g 0 -m 0755 $(INSTALL)/bin
	install    -o root -g $(X10MANAGER) -m 06750 -s x10cli $(INSTALL)/bin/x10cli
	install -d -o root -g 0 -m 0755 $(INSTALL)/man
	install -d -o root -g 0 -m 0755 $(INSTALL)/man/man1
	install    -o root -g 0 -m 0440 x10cli.1 $(INSTALL)/man/man1/x10cli.1

	rm -f $(INSTALL)/bin/showunit $(INSTALL)/bin/setunit
	rm -f $(INSTALL)/bin/x10test $(INSTALL)/bin/turn $(INSTALL)/bin/fade
	ln $(INSTALL)/bin/x10cli $(INSTALL)/bin/showunit
	ln $(INSTALL)/bin/x10cli $(INSTALL)/bin/setunit
	ln $(INSTALL)/bin/x10cli $(INSTALL)/bin/x10test
	ln $(INSTALL)/bin/x10cli $(INSTALL)/bin/turn
	ln $(INSTALL)/bin/x10cli $(INSTALL)/bin/fade

clean:
	rm -f *.o fade turn x10test setunit showunit x10cli core a.out
	rm -f x10io.H x10map.H
	rm -rf SunWS_cache

templates:
	# Do nothing.

uninstallroot:
	rm -f $(INSTALL)/bin/x10cli $(INSTALL)/man/man1/x10cli.1
	rm -f $(INSTALL)/bin/showunit $(INSTALL)/bin/setunit
	rm -f $(INSTALL)/bin/x10test $(INSTALL)/bin/turn $(INSTALL)/bin/fade

