TAGSRC = \
 numo/types/*.h \
 *.c

tags : TAGS
TAGS : $(TAGSRC)
	etags $(TAGSRC)

doc :
	yard doc *.c

C_TMPL = <%=Dir.glob("#{__dir__}/gen/tmpl*/*.c").join(" ")%>

COGEN = <%= __dir__ %>/gen/cogen.rb
DEPENDS = $(C_TMPL) <%= __dir__ %>/gen/*.rb

<%
   type_c = []
   type_rb = Dir.glob("#{__dir__}/gen/def/*.rb")
   type_rb.each do |s|
     type_c << c = "t_"+File.basename(s,".rb")+".c"
%>
<%=c%>: <%=s%> $(DEPENDS)
	/opt/local/bin/ruby3.3 $(COGEN) -l -o $@ <%=s%>
<% end %>

src : <%= type_c.join(" ") %>

CLEANOBJS = *.o t_*.c *.bak
DISTCLEANFILES = depend TAGS
