# File   : Makefile
# Author : Karyl F. Stein <xenon@xenos.net>
# Purpose: Makefile for xnew.

# Location of programs
CP=/bin/cp
MV=/bin/mv
CHOWN=/bin/chown
CHMOD=/bin/chmod

CC=gcc

# Program to build
PROG=xnew

# Installation details
PROG_DIR=/usr/noton/xnew
PROG_OWN=0.0
PROG_MOD=4555


########## Nothing below this line should need to be changed #################


all: xnew

xnew: xnew.o do_command.o get_arguments.o list_func.o xnew_func.o stack_func.o
	$(CC) $(COPTS) -o xnew xnew.o do_command.o get_arguments.o \
	list_func.o xnew_func.o stack_func.o
xnew.o: xnew.c xnew.h config.h xnew_func.h stack_func.h get_arguments.h
	$(CC) $(COPTS) -c xnew.c -o xnew.o
do_command.o: do_command.c do_command.h config.h xnew_func.h
	$(CC) $(COPTS) -c do_command.c -o do_command.o
get_arguments.o: get_arguments.c get_arguments.h list_func.h
	$(CC) $(COPTS) -c get_arguments.c -o get_arguments.o
list_func.o: list_func.c list_func.h xnew.h
	$(CC) $(COPTS) -c list_func.c -o list_func.o
xnew_func.o: xnew_func.c xnew_func.h list_func.h config.h
	$(CC) $(COPTS) -c xnew_func.c -o xnew_func.o
stack_func.o: stack_func.c stack_func.h
	$(CC) $(COPTS) -c stack_func.c -o stack_func.o
xnew.h: list_func.h

clean:
	rm -f *~ *.o xnew core
clean_modules:
	(cd modules; make clean)

install:
	$(CP) -f xnew $(PROG_DIR)/$(PROG)
	$(CHMOD) $(PROG_MOD) $(PROG_DIR)/$(PROG)
	$(CHOWN) $(PROG_OWN) $(PROG_DIR)/$(PROG)

modules:
	(cd modules; make)

install_modules: modules
	(cd modules; make install)

install_text:
	(cd text; make install)

install_all: install install_modules install_text
clean_all: clean clean_modules
