C1541  = c1541
 
 # --------------------------------------------------------------------------
-# System dependent settings
+# System-dependent settings
 
 # The Apple machines need the start address adjusted when using TGI
 LDFLAGS_mandelbrot_apple2 = --start-addr 0x4000
 .PRECIOUS: %.o
 
 .o:
-       @$(LD) $(LDFLAGS_$(basename $@)_$(SYS)) -o $@ -t $(SYS) -m $@.map $^ $(CLIB)
+       @$(LD) $(LDFLAGS_$(@F)_$(SYS)) -o $@ -t $(SYS) -m $@.map $^ $(CLIB)
 
 # --------------------------------------------------------------------------
-# List of executables. This list could be made target dependent by checking
+# List of executables. This list could be made target-dependent by checking
 # $(SYS).
 
 EXELIST        =       ascii           \
                tgidemo
 
 # --------------------------------------------------------------------------
-# Rules how to make each one of the binaries
+# Rules to make the binaries
 
 .PHONY:        all
 all:   $(EXELIST)
 
 # --------------------------------------------------------------------------
-# Rule to make a disk with all samples. Needs the c1541 program that comes
+# Overlay rules. Overlays need special ld65 configuration files.  Also, the
+# overlay file-names are shortenned to fit the Atari's 8.3-character limit.
+
+multdemo:      multidemo.o
+       @$(LD) -o $@ -C $(SYS)-overlay.cfg -m $@.map $^ $(CLIB)
+
+ovrldemo:      overlaydemo.o
+       @$(LD) -o $@ -C $(SYS)-overlay.cfg -m $@.map $^ $(CLIB)
+
+# --------------------------------------------------------------------------
+# Rule to make a CBM disk with all samples. Needs the c1541 program that comes
 # with the VICE emulator.
 
 .PHONY:        disk
        done
 
 # --------------------------------------------------------------------------
-# Cleanup rules
+# Clean-up rules
 
 .PHONY:        clean
 clean:
 .PHONY:        zap
 zap:   clean
        $(RM) $(EXELIST) samples.d64
+       $(RM) multdemo.? ovrldemo.?