#
# Login.app Makefile
#

# Directory where Login.app will be installed
INSTALL_DIR = /usr/local/GNUstep/Apps/Login.app

# Use shadow passwords, comment out to disable
SHADOW = -DSHADOW_PASSWD

# Debug
CFLAGS = -g

INSTALL = /usr/bin/install -c
CC = cc
CFLAGS += -Wall -pedantic -D_GNU_SOURCE `get-wraster-flags --cflags` $(SHADOW)
LDFLAGS += `get-wraster-flags --ldflags` `get-wraster-flags --libs` -lXmu -lPropList -lcrypt

TARGET = Login

OBJS =  main.o \
	preferences.o \
	resources.o \
	switchuser.o \
	panel.o \
	graphics.o \
	util.o

SCRIPTS = Scripts/Login.root \
	Scripts/Login.user \
	Scripts/Logout.root \
	Scripts/Restart \
	Scripts/Suspend \
	Scripts/PowerOff \
	Scripts/Startup

THEME_LINUX = Themes/Linux/Settings \
	Themes/Linux/fieldlabels.tiff \
	Themes/Linux/inputfield.tiff \
	Themes/Linux/panel.tiff \
	Themes/Linux/powerbuttondown.tiff \
	Themes/Linux/powerbuttonup.tiff \
        Themes/Linux/restartbuttondown.tiff \
	Themes/Linux/restartbuttonup.tiff \
        Themes/Linux/stop.tiff 

THEME_GNUSTEP = Themes/GNUstep/Settings \
	Themes/GNUstep/fieldlabels.tiff \
	Themes/GNUstep/inputfield.tiff \
	Themes/GNUstep/panel.tiff \
	Themes/GNUstep/powerbuttondown.tiff \
	Themes/GNUstep/powerbuttonup.tiff \
	Themes/GNUstep/restartbuttondown.tiff \
	Themes/GNUstep/restartbuttonup.tiff \
	Themes/GNUstep/stop.tiff

$(TARGET): $(OBJS)
	$(CC) -o $(TARGET) $(OBJS) $(LDFLAGS)

clean: 
	rm -rf $(TARGET) $(OBJS) core `find -name \*~`

install: $(TARGET)
	$(INSTALL) -d $(INSTALL_DIR)
	$(INSTALL) -d $(INSTALL_DIR)/Scripts
	$(INSTALL) -d $(INSTALL_DIR)/Themes
	$(INSTALL) -d $(INSTALL_DIR)/Themes/Linux
	$(INSTALL) -d $(INSTALL_DIR)/Themes/GNUstep
	$(INSTALL) -s $(TARGET) $(INSTALL_DIR)
	$(INSTALL) -m 644 Preferences $(INSTALL_DIR)/Preferences
	$(INSTALL) $(SCRIPTS) $(INSTALL_DIR)/Scripts/
	$(INSTALL) -m 644 $(THEME_LINUX) $(INSTALL_DIR)/Themes/Linux/
	$(INSTALL) -m 644 $(THEME_GNUSTEP) $(INSTALL_DIR)/Themes/GNUstep/

uninstall:
	rm -rf $(INSTALL_DIR)

# End of file
