#-----------------------------------------------------
# The locations where this program should be installed
INSTALL_DIR=/usr/local/bin
MAN_DIR=/usr/local/man/man1

# The location and names of the X11 libraries
LDIR = -L/usr/X11R6/lib
LIBS = -lXpm -lX11

# The include path to the X11 files
C_INCLUDE = -I. -I/usr/X11R6/include

#-----------------------------------------------------
CC = gcc
COPTS = -O2 -pipe -Wall -Wshadow
#COMPILE_FLAGS = -DDEBUG -DTEST -g

CFLAGS = $(COPTS) $(COMPILE_FLAGS) $(C_INCLUDE)

OBJ = asmem.o asmem_x.o read_mem.o x_color.o safecopy.o

all:	asmem
	@echo Ready.

asmem:  $(OBJ)
	$(CC) $(OBJ) $(LDIR) $(LIBS) -o asmem

asmem.o: asmem.c safecopy.h state.h asmem_x.h x_color.h
	$(CC) -c $< $(CFLAGS) -o $@

safecopy.o: safecopy.c
	$(CC) -c $< $(CFLAGS) -o $@

x_color.o: x_color.c
	$(CC) -c $< $(CFLAGS) -o $@

read_mem.o: read_mem.h read_mem.c state.h
	$(CC) -c $< $(CFLAGS) -o $@

asmem_x.o: asmem_x.c asmem_x.h x_color.h safecopy.h state.h\
           background.xpm alphabet.xpm
	$(CC) -c $< $(CFLAGS) -o $@

install: 
	@echo Installing asmem in $(INSTALL_DIR) ...
	-@strip asmem
	-@if [ -e $(INSTALL_DIR)/asmem ] ; then rm $(INSTALL_DIR)/asmem; fi
	@cp asmem $(INSTALL_DIR)/asmem
	@chmod 755 $(INSTALL_DIR)/asmem
	@echo Installing the man page in $(MAN_DIR) ...
	@cp asmem.man $(MAN_DIR)/asmem.1x
	@chmod 644 $(MAN_DIR)/asmem.1x
	@echo Done.

uninstall:
	@echo Uninstalling asmem in $(INSTALL_DIR) ...
	-@if [ -e $(INSTALL_DIR)/asmem ] ; then rm $(INSTALL_DIR)/asmem; fi
	@echo Uninstalling the man page in $(MAN_DIR) ...
	-@if [ -e $(MAN_DIR)/asmem.1x ] ; then rm $(MAN_DIR)/asmem.1x; fi
	@echo Done.

clean:
	rm -f $(OBJ) asmem



syntax highlighted by Code2HTML, v. 0.9.1