# This make file is a modified version of makefile.linux from the
# Netscape 3.0b5 Plugin SDK
################################################################################
# Copyright (c) 1996 Netscape Communications. All rights reserved.
################################################################################

# Change the following two definitions to match you system configuration
# This is the location where the plugins directory you would like to install
#    the mimeplugin.so is located
NETSCAPE_DIR= /usr/local/lib/netscape/
#NETSCAPE_DIR= ${HOME}/.netscape/

# This is the name of the configuration file that mimeplugin.so gets its
#    information, you will most likely not need to change this definition
CONF_FILE= mimeplugin.conf

# These are the names of the files that log the STDOUT and STDERR
#    messages from the plug-in and the applications the plugin
#    executes.  If you are having problems or are using DEBUG, set
#    these variables to real file names.  The default settings should
#    be good for most people.
STDOUT_FILE= /dev/null
#STDOUT_FILE= /tmp/mimeplugin.out.txt
#STDERR_FILE= /dev/null
STDERR_FILE= /tmp/mimeplugin.err.txt

# Uncomment one of the following for debugging purposes
#    -O optimizes, i.e., no debugging
#    -g adds debugging information to the binary
#    -DPLUGIN_TRACE for messages when the plugin gets control,
#               See Netscape SDK documentation for more information
#    -DDEBUG for extremely verbose messages
DEBUG= -O
#DEBUG= -DPLUGIN_TRACE
#DEBUG= -g\
#       -DPLUGIN_TRACE\
#       -DDEBUG

# OS Specific settings
# Compiler/linker
CC= gcc
#CC= cc

# Position independent code option
PIC= -fPIC
#PIC= -KPIC

# Shared library linker option
SHARE= -shared
#SHARE= -G -z text

# Include directories
X_INC_DIR= -I/usr/openwin/include

CFLAGS= $(DEBUG)\
        -Wall\
        $(PIC)\
        $(PLUGIN_DEFINES)\
        -I.\
        $(X_INC_DIR)

LDFLAGS=

### Do NOT change anything below this line ###

PLUGIN_DEFINES= -DXP_UNIX\
                -DNS_DIR=\"$(NETSCAPE_DIR)\"\
                -DCONF_FILE=\"$(CONF_FILE)\"\
                -DSTDOUT=\"$(STDOUT_FILE)\"\
                -DSTDERR=\"$(STDERR_FILE)\"

SRC= mimeplugin.c\
     npunix.c
OBJ= mimeplugin.o\
     npunix.o

SHAREDTARGET= mimeplugin.so

default all: $(SHAREDTARGET)

.c.o:
	$(CC) $(CFLAGS) $(ARCH) -c $*.c

$(SHAREDTARGET): $(OBJ)
	$(CC) $(SHARE) -o $(SHAREDTARGET) $(OBJ) $(LDFLAGS)

install: $(SHAREDTARGET) $(CONF_FILE) $(NETSCAPE_DIR)
	@echo "Copying default configuration file to '$(NETSCAPE_DIR)plugins/../$(CONF_FILE)'..."
	@install -m644 $(CONF_FILE) $(NETSCAPE_DIR)plugins/../$(CONF_FILE)
	@echo "Installing plugin as '$(NETSCAPE_DIR)plugins/$(SHAREDTARGET)'"
	@install -m755 $(SHAREDTARGET) $(NETSCAPE_DIR)plugins/$(SHAREDTARGET)

clean:
	rm -f $(OBJ) $(SHAREDTARGET) test
