##############################################################################
# library-building rules

TARGETS = $(THISLIB)

all:
	@if [ "x$(CONDITIONAL_BUILD)" != "x" ] && \
	       egrep -s FALSE ../../config/vdefs/$(CONDITIONAL_BUILD).h; \
          then \
	       echo "skipping $(CUR)"; \
	       rm -f .objects; touch .objects; \
	       ln -fs $(TOPSRC)/fe/dummy.a $(THISLIB); \
	  else \
	       $(MAKE) $(THISLIB); fi

objects: .objects
	@if [ -r .objects ]; then cat .objects; fi

# This rule should not get run when the system is working.
# It can only happen thru version skew. Hence, rebuild completely.
.objects:
	@echo "Oog... rebuilding, sorry"
	$(MAKE) clean
	$(MAKE)
	
$(THISLIB): $(OBJECTS) 
	@rm -f .objects; for f in $(OBJECTS); do echo $$f >> .objects; done
	$(RM) -f $@
	$(AR) cq $@ $(OBJECTS)
	$(RANLIB) $@

