CURDIR=main
SBIN=/sbin
BIN=/bin
all: main
OBJS =  linuxconf.o _dict.o
LDF = $(OPTDYNAMIC) -lm
LIBS_PROJECT = ../askrunlevel/askrunlevel.a ../netconf/netconf.a \
	../xconf/xconf.a ../translate/translate.a ../misc/misc.a \
	../dialog/dialog.a
LIBS =  $(LIBS_PROJECT) -lncurses

LOCAL_INSTALLLADR=localinstall_ladr
LOCAL_INSTALL=localinstall
LOCAL_CLEAN=localclean
localclean:
	rm -f linuxconf

include ../rules.mak

proto:
	proto -m0+ *.c

# LNXMODULES allows one to link "statically" a module. This helps
# debugging. Nothing has to be changed in the module to link it
# this way. Statically linked module is against the licensing agreement
# of linuxconf but tolerate to supply solutions to a.out users.
main: main.obt $(OBJS) $(LIBS_PROJECT)
	$(GCC) $(LNXMODULES) $(LDF) -o linuxconf $< $(OBJS) $(LIBS)

localinstall: msg.eng html_version
	install -m 4755 -o root -g bin linuxconf $(BIN)/linuxconf
	ln -sf $(BIN)/linuxconf $(BIN)/netconf
	ln -sf $(BIN)/linuxconf $(BIN)/xconf
	ln -sf $(BIN)/linuxconf $(BIN)/lpdconf
	ln -sf $(BIN)/linuxconf $(BIN)/fsconf
	ln -sf $(BIN)/linuxconf $(SBIN)/askrunlevel
	ln -sf $(BIN)/linuxconf $(SBIN)/fixperm
	ln -sf $(BIN)/linuxconf $(SBIN)/mailconf
	ln -sf $(BIN)/linuxconf $(SBIN)/uucpconf
	ln -sf $(BIN)/linuxconf $(SBIN)/dnsconf
	ln -sf $(BIN)/linuxconf $(BIN)/userconf
	install -m 444 -o root -g bin /tmp/linuxconf-msg-$(LINUXCONF_REV).eng $(HELP)
	install -m 444 -o root -g bin ../help.files/sources/main/introweb.html \
		$(HELP)/help.eng/main
	rm ../help.files/sources/main/introweb.html

# Installation in the L.A.D.R directories
localinstall_ladr: msg.eng html_version
	install --strip -m 4755 -o root -g bin linuxconf $(BIN_LADR)/linuxconf
	( cd $(BIN_LADR); \
		ln -sf linuxconf netconf; \
		ln -sf linuxconf xconf; \
		ln -sf linuxconf fsconf; \
		ln -sf linuxconf lpdconf; \
		ln -sf /bin/linuxconf ../sbin/askrunlevel; \
		ln -sf /bin/linuxconf ../sbin/fixperm; \
		ln -sf /bin/linuxconf ../sbin/mailconf; \
		ln -sf /bin/linuxconf ../sbin/uucpconf; \
		ln -sf /bin/linuxconf ../sbin/dnsconf; \
		ln -sf linuxconf userconf; \
		ln -sf linuxconf passwd; \
		ln -sf linuxconf hostname; \
		ln -sf linuxconf domainname; \
	)
	install -m 444 -o root -g bin /tmp/linuxconf-msg-$(LINUXCONF_REV).eng $(HELP_LADR)
	install -m 444 -o root -g bin ../help.files/sources/main/introweb.html \
		$(HELP_LADR)/help.eng/main
	rm ../help.files/sources/main/introweb.html

# Update the file introweb.html with the current release number
html_version:
	(cd ../help.files/sources/main && make)

# Test program



