Hello,
I am trying to write rules in order to build a program with ghc
I end up with this, I think that I could improve all this a lot.
So I would like your advices in order to improve this
thanks for considering
Frederic
GHCLINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(GHC) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
.hsc.o:
# fake in order to let automake generate clean rules for _OBJECTS files
hsc2hs --cflag=$(AM_CFLAGS) -o $@ $<
.hs.o:
# fake in order to let automake generate clean rules for _OBJECTS files
ghc --make -i$(srcdir)/src -i$(builddir)/src -outputdir=$(builddir)/src
-c -O -o $@ $<
hsc_sources=\
src/Hkl/C/Hkl.hsc \
src/Hkl/C/Binoculars.hsc
sources=\
src/Hkl.hs \
src/Hkl/Binoculars.hs \
src/Hkl/Binoculars/Command.hs \
src/Hkl/Binoculars/Common.hs \
src/Hkl/Binoculars/Config.hs \
...
CLEANFILES=\
src/Hkl/Binoculars.hi \
src/Hkl/Binoculars/Config.hi \
src/Hkl/Binoculars/Config.dyn_o \
src/Hkl/Binoculars/Config.dyn_hi \
src/Hkl/Binoculars/Config/Common.hi \
src/Hkl/Binoculars/Config/Sample.hi \
...
bin_PROGRAMS = binoculars-ng
binoculars_ng_SOURCES = $(hsc_sources) $(sources)
binoculars_ng_LDADD = \
$(top_builddir)/hkl/libhkl.la \
$(top_builddir)/binoculars/libhkl-binoculars.la
binoculars_ng_LINK=$(GHCLINK) \
-i$(srcdir)/src -i$(builddir)/src -outputdir=$(builddir)/src \
$(builddir)/src/Hkl/C/Hkl.hs \
$(builddir)/src/Hkl/C/Binoculars.hs \
$(srcdir)/app/Binoculars.hs
binoculars-ng$(EXEEXT): $(binoculars_ng_DEPENDENCIES)
$(EXTRA_binoculars_ng_DEPENDENCIES)
@rm -f binoculars-ng$(EXEEXT)
mkdir -p $(builddir)/src/Hkl/C/
@rm -f src/Hkl/C/Hkl.hs
$(HSC2HS) --cflag=$(AM_CFLAGS) -o src/Hkl/C/Hkl.hs
$(srcdir)/src/Hkl/C/Hkl.hsc
@rm -f src/Hkl/C/Binoculars.hs
$(HSC2HS) --cflag=$(AM_CFLAGS) -o src/Hkl/C/Binoculars.hs
$(srcdir)/src/Hkl/C/Binoculars.hsc
$(AM_V_GEN)$(binoculars_ng_LINK) $(binoculars_ng_LDADD) $(LIBS)