clean:
        rm -f $(clean-files)
 
-# Create a dependency chain in generated files
-# to avoid concurrent invocations of the single
-# rule that builds them all.
-$(OUTDIR)/aicasm_gram.c: $(OUTDIR)/aicasm_gram.h
 $(OUTDIR)/aicasm_gram.c $(OUTDIR)/aicasm_gram.h: aicasm_gram.y
-       $(YACC) $(YFLAGS) -b $(<:.y=) $<
-       mv $(<:.y=).tab.c $(OUTDIR)/$(<:.y=.c)
-       mv $(<:.y=).tab.h $(OUTDIR)/$(<:.y=.h)
-
-# Create a dependency chain in generated files
-# to avoid concurrent invocations of the single
-# rule that builds them all.
-$(OUTDIR)/aicasm_macro_gram.c: $(OUTDIR)/aicasm_macro_gram.h
+       $(YACC) $(YFLAGS) -b $(<:.y=) $< -o $(OUTDIR)/$(<:.y=.c)
+
 $(OUTDIR)/aicasm_macro_gram.c $(OUTDIR)/aicasm_macro_gram.h: aicasm_macro_gram.y
-       $(YACC) $(YFLAGS) -b $(<:.y=) -p mm $<
-       mv $(<:.y=).tab.c $(OUTDIR)/$(<:.y=.c)
-       mv $(<:.y=).tab.h $(OUTDIR)/$(<:.y=.h)
+       $(YACC) $(YFLAGS) -b $(<:.y=) -p mm $< -o $(OUTDIR)/$(<:.y=.c)
 
 $(OUTDIR)/aicasm_scan.c: aicasm_scan.l
        $(LEX) $(LFLAGS) -o $@ $<