TOPDIR = ..
include $(TOPDIR)/MakeVars
include $(TOPDIR)/Makerules

SUBDIRS = $(WIDGET) guilib
SRCS = $(wildcard *.c)
OBJS = $(SRCS:.c=.o)

all: subdir X.o

subdir: 
	$(foreach i, $(SUBDIRS), $(MAKE) -C $(i);)

X.o: $(OBJS) $(WIDGET)/$(WIDGET).o guilib/guilib.o
	$(RM) X.o
	$(LD) -r -o X.o $(OBJS) $(WIDGET)/$(WIDGET).o guilib/guilib.o

tags: 
	cd $(WIDGET); $(MAKE) tags
	ln -sf $(TOPDIR)/TAGS TAGS
	etags -a -o TAGS $(SRCS)
dep depend:
	$(foreach i, $(SUBDIRS), $(MAKE) -C $(i) dep;)
	$(DEPEND) $(SRCS) > .depend

clean:
	$(foreach i, $(SUBDIRS), $(MAKE) -C $(i) clean;)
	$(RM) *.o

#
# include a dependency file if one exists
#
ifeq (.depend,$(wildcard .depend))
include .depend
endif

