CC=gcc
TAR=tar

LDFLAGS = `gtk-config --libs`

CFLAGS =-Wall `gtk-config --cflags`
objects = glaunch.o pack.o process.o file.o create_gui_functions.o \
	data_handlers.o

#-DDEBUG prints some debug info to stderr.
DEBUGFLAGS= -g -DDEBUG

#Uncomment -DUSE_STATUSBAR for a not useful, ugly statusbar.
DEFS= -DGLOBAL_CONFIG_FILE=\"/usr/local/lib/glaunchrc\"        \
      -DLOCAL_CONFIG_FILE=\".glaunchrc\"                       \
      -DXTERM_PATH=\"/usr/X11R6/bin/xterm\"                    \
      -DXTERM_NAME=\"xterm\"                                   \
      -DXTERM_EXECUTE_FLAG=\"-e\" # -DUSE_STATUSBAR

glaunch: $(objects)
	$(CC) $(DEBUGFLAGS) $(LDFLAGS) $(objects) -o $@ 

glaunch.o: glaunch.c glaunch.h
	$(CC) $(CFLAGS) $(DEBUGFLAGS) $(DEFS) -c $< -o $@

pack.o: pack.c glaunch.h
	$(CC) $(CFLAGS) $(DEBUGFLAGS) $(DEFS) -c $< -o $@

process.o: process.c glaunch.h
	$(CC) $(CFLAGS) $(DEBUGFLAGS) $(DEFS) -c $< -o $@

file.o: file.c glaunch.h
	$(CC) $(CFLAGS) $(DEBUGFLAGS) $(DEFS) -c $< -o $@

create_gui_functions.o: create_gui_functions.c glaunch.h
	$(CC) $(CFLAGS) $(DEBUGFLAGS) $(DEFS) -c $< -o $@

data_handlers.o: data_handlers.c glaunch.h
	$(CC) $(CFLAGS) $(DEBUGFLAGS) $(DEFS) -c $< -o $@

.PHONY : clean
clean:
	rm -f glaunch $(objects)

.PHONY : tarball
tarball:
	$(MAKE) clean; cd .. ; $(TAR) zcvf glaunch-`date +%d-%m-%y`.tar.gz glaunch --exclude=RCS
