What's the best way to create extra targets?

I have a build that creates .elf files. I want to also generate a .hex file and then a .dfu file from that. If I add the .dfu action as a post action to the .hex file it doesnt get built. Adding it as a post action to the .elf works but it doesn’t properly encode the dependency.

makeHex = env.VerboseAction(" ".join([
    "$OBJCOPY", "-O", "ihex",
    '"$BUILD_DIR/${PROGNAME}.elf"', '"$BUILD_DIR/${PROGNAME}.hex"'
]), "Building $BUILD_DIR/${PROGNAME}.hex")
env.AddPostAction("$BUILD_DIR/${PROGNAME}.elf",makeHex)

makeDfu = env.VerboseAction(" ".join([
    "python3", "dfu-convert.py", "-i",
    '"$BUILD_DIR/${PROGNAME}.hex"', '"$BUILD_DIR/${PROGNAME}.dfu"'
]), "Building $BUILD_DIR/${PROGNAME}.dfu")
# BAD
env.AddPostAction("$BUILD_DIR/${PROGNAME}.elf", makeDfu)