######
#
# A Makefile for processing [Makefile.atxt]
# to generate Makefiles that do the actual work
#
######
#
# Author: Hongwei Xi (gmhwxiATgmailCOM)
#
######

ATSHOMEQ="$(ATSHOME)"

######

ATSCC=$(ATSHOMEQ)/bin/atscc
ATSDOC=$(ATSHOMEQ)/bin/atsdoc

######

Makefile: Makefile.exe ; ./$< > $@

Makefile.exe: Makefile_atxt.dats
	$(ATSCC) $(GCFLAG) -o $@ $< -latsdoc
Makefile_atxt.dats: Makefile.atxt
	$(ATSDOC) --outcode $@ -i $< > Makefile_atxt.txt

######

Makefile2: Makefile2.exe ; ./$< > $@

Makefile2.exe: Makefile2_atxt.dats
	$(ATSCC) $(GCFLAG) -o $@ $< -latsdoc
Makefile2_atxt.dats: Makefile2.atxt
	$(ATSDOC) --outcode $@ -i $< > Makefile2_atxt.txt

######

RMF=rm -f

######

clean:: ; $(RMF) *~
clean:: ; $(RMF) *_?ats.o *_?ats.c
clean:: ; $(RMF) *_atxt.txt
clean:: ; $(RMF) *_atxt.dats
clean:: ; $(RMF) Makefile.exe
clean:: ; $(RMF) Makefile2.exe

cleanall:: clean
cleanall:: ; $(RMF) Makefile
cleanall:: ; $(RMF) Makefile2

######

###### end of [Makefile.gen] ######
