ChasmMakefile


Because of the dependencies of files in Chasm, it can be problematic to create a good Makefile. So, here are the rules to create Chasm files which I use.


OBJS=Button Event etc...
  # --- These are the concepts you wish to compile. Notice they have
  #     no file extension.

<-- place instructions here -->

# Because the dependency information depends on having the
# headers of .chasm.h, you need to generate this before running
# depend so add the following as a prereq to the depend rule. It
# will generate the chasm.h and chasm.C files before running
# depend.
depend: $(OBJS:%=%.chasm.C)
  ...


.SECONDARY : $(OBJS:%=%.chasm.C)
  # --- Sets the .chasm.C file as secondary so it is not removed when
  #        make is done.

# Create the chasm.o file using the .chasm.C .chasm.h .chasmxml
# .h and .C files.
%.chasm.o : %.chasm.h %.chasm.C %.chasmxml %.h %.C
  @echo -n " ...making $(*:%=%.chasm.o)"
  @${CC} $(*:%=%.chasm.C) -c ${PARAMS} -o $(*:%=%.chasm.o)
  @echo "... success"

# Create the chasm.C and chasm.h file
%.chasm.h %.chasm.C : %.chasmxml %.h %.C
  @echo -n " ...making $(*:%=%.chasm).[hC]"
  @$(CHASMPROCESS) $(CHASMPROCESSPARAMS) $* $*
  @echo "... success"