Ajout : vim/ : syntax/ledger.vim.
[comptalang.git] / GNUmakefile
index 2c8180f4012c16652604ee6f46f361fce2e7298c..4c95ed98a515c4ec7528b6dc65bb1d7943e28a7a 100644 (file)
@@ -32,16 +32,20 @@ rmdirw=$(call if_arg,rmdir -p --ignore-fail-on-non-empty,$(wildcard $1))
 ###
 install: cabal/install lib/install cli/install web/install
 cabal/install:
-       cabal update $(CABAL_FLAGS) $(CABAL_UPDATE_FLAGS)
-       cabal install -v $(CABAL_FLAGS) $(CABAL_INSTALL_FLAGS) cabal
+       cabal $(CABAL_FLAGS) update $(CABAL_UPDATE_FLAGS)
+       cabal $(CABAL_FLAGS) install -v $(CABAL_INSTALL_FLAGS) cabal
 .PHONY: lib cli web
-lib lib/install:
-       cabal install -v --force-reinstalls $(CABAL_FLAGS) $(CABAL_INSTALL_FLAGS) ./lib
+lib lib/install: cli/unregister web/unregister cli/unregister/sandbox web/unregister/sandbox
+       cabal $(CABAL_FLAGS) install -v $(CABAL_INSTALL_FLAGS) ./lib
 cli cli/install:
-       cabal install -v --force-reinstalls $(CABAL_FLAGS) $(CABAL_INSTALL_FLAGS) ./cli
+       cabal $(CABAL_FLAGS) install -v $(CABAL_INSTALL_FLAGS) ./cli
 web web/install:
-       cabal install -v                    $(CABAL_FLAGS) $(CABAL_INSTALL_FLAGS) alex happy
-       cabal install -v --force-reinstalls $(CABAL_FLAGS) $(CABAL_INSTALL_FLAGS) ./web
+       cabal $(CABAL_FLAGS) install -v $(CABAL_INSTALL_FLAGS) alex happy
+       cabal $(CABAL_FLAGS) install -v $(CABAL_INSTALL_FLAGS) ./web
+
+%/recomp: CABAL_INSTALL_FLAGS+=--ghc-options -fforce-recomp
+%/recomp: %
+       
 
 #
 ##  clean
@@ -59,11 +63,11 @@ web/clean:
 ###
 test: lib/test cli/test web/test
 lib/test:
-       (cd lib && cabal test --show-details=always $(CABAL_FLAGS) $(CABAL_TEST_FLAGS))
+       (cd lib && cabal $(CABAL_FLAGS) test --show-details=always $(CABAL_TEST_FLAGS))
 cli/test:
-       (cd cli && cabal test --show-details=always $(CABAL_FLAGS) $(CABAL_TEST_FLAGS))
+       (cd cli && cabal $(CABAL_FLAGS) test --show-details=always $(CABAL_TEST_FLAGS))
 web/test:
-       (cd web && cabal test --show-details=always $(CABAL_FLAGS) $(CABAL_TEST_FLAGS))
+       (cd web && cabal $(CABAL_FLAGS) test --show-details=always $(CABAL_TEST_FLAGS))
 %/install/test: CABAL_INSTALL_FLAGS+=--enable-tests
 %/install/test: %/install
        
@@ -73,16 +77,16 @@ web/test:
 ###
 .PHONY: doc
 doc: doc/xhtml lib/doc cli/doc web/doc
-%/prof: CABAL_INSTALL_FLAGS+=-fprof --ghc-options -fforce-recomp --enable-library-profiling --enable-executable-profiling
+%/prof: CABAL_INSTALL_FLAGS+=-fprof --enable-library-profiling --enable-executable-profiling
 %/prof: $(CABAL_SANDBOX) %
        
 
 lib/doc:
-       (cd lib && cabal haddock --hyperlink-source $(CABAL_FLAGS) $(CABAL_HADDOCK_FLAGS))
+       (cd lib && cabal $(CABAL_FLAGS) haddock --hyperlink-source $(CABAL_HADDOCK_FLAGS))
 cli/doc:
-       (cd cli && cabal haddock --hyperlink-source $(CABAL_FLAGS) $(CABAL_HADDOCK_FLAGS))
+       (cd cli && cabal $(CABAL_FLAGS) haddock --hyperlink-source $(CABAL_HADDOCK_FLAGS))
 web/doc:
-       (cd web && cabal haddock --hyperlink-source $(CABAL_FLAGS) $(CABAL_HADDOCK_FLAGS))
+       (cd web && cabal $(CABAL_FLAGS) haddock --hyperlink-source $(CABAL_HADDOCK_FLAGS))
 doc/%: .
        $(MAKE) -C doc $*
 
@@ -93,6 +97,13 @@ doc/%: .
 %/dev: %
        
 
+#
+##  dump
+###
+%/dump: CABAL_INSTALL_FLAGS+=-fdump
+%/dump: %
+       
+
 #
 ##  prof
 ###
@@ -102,11 +113,11 @@ prof: $(foreach command,$(HCOMPTA_COMMANDS),prof/$(command))
 prof/commit/$(commit):
        mkdir -p "$@"
 
-lib/install/prof: CABAL_INSTALL_FLAGS+=-fprof --ghc-options -fforce-recomp --enable-library-profiling
+lib/install/prof: CABAL_INSTALL_FLAGS+=-fprof --enable-library-profiling
 lib/install/prof: cli/unregister/sandbox lib/install | $(CABAL_SANDBOX)
        
 
-cli/install/prof: CABAL_INSTALL_FLAGS+=-fprof --ghc-options -fforce-recomp --enable-library-profiling --enable-executable-profiling
+cli/install/prof: CABAL_INSTALL_FLAGS+=-fprof --enable-library-profiling --enable-executable-profiling
 cli/install/prof: cli/install | $(CABAL_SANDBOX)
        mv \
         $(CABAL_SANDBOX)/bin/hcompta-cli \
@@ -153,8 +164,8 @@ prof/%.ledger.$(command): \
        $$(HCOMPTA_CLI_PROF) $$(HCOMPTA_FLAGS) \
         $(command) $$(HCOMPTA_COMMAND_FLAGS) $$(filter %.ledger,$$^) \
         >prof/$$*.ledger.$(command)
-       mv hcompta-cli-prof.hp   prof/commit/$(commit)/$$*.ledger.$(command).$(hC).hp
-       mv hcompta-cli-prof.prof prof/commit/$(commit)/$$*.ledger.$(command).$(hC).prof
+       mv $(notdir $(HCOMPTA_CLI_PROF)).hp   prof/commit/$(commit)/$$*.ledger.$(command).$(hC).hp
+       mv $(notdir $(HCOMPTA_CLI_PROF)).prof prof/commit/$(commit)/$$*.ledger.$(command).$(hC).prof
 
 prof/$(command)/$(hC): \
  $(addsuffix /$(command)/$(hC),$(wildcard prof/*.ledger))
@@ -179,8 +190,7 @@ endef
 
 prof/%.ledger/clean: \
  $(foreach command,$(HCOMPTA_COMMANDS), \
- prof/%.ledger/$(command)/clean \
- )
+ prof/%.ledger/$(command)/clean )
        
 
 $(foreach command,$(HCOMPTA_COMMANDS), \
@@ -195,19 +205,6 @@ $(foreach command,$(HCOMPTA_COMMANDS), \
 %.ps: %.hp
        (cd $(@D) && hp2ps -b -c -e$(GHC_PROF_PS_WIDTH) -g $(notdir $*.hp))
 
-#prof/%.ledger/clean:
-#      $(call rmw, \
-#       $(foreach command,$(HCOMPTA_COMMANDS), \
-#               prof/$*.ledger.$(command) \
-#               $(foreach hC,$(GHC_PROF_CATEGORIES),\
-#                       prof/commit/$(commit)/$*.ledger.$(command).$(hC).aux \
-#                       prof/commit/$(commit)/$*.ledger.$(command).$(hC).hp \
-#                       prof/commit/$(commit)/$*.ledger.$(command).$(hC).prof \
-#                       prof/commit/$(commit)/$*.ledger.$(command).$(hC).ps \
-#                       prof/commit/$(commit)/$*.ledger.$(command).$(hC).stats \
-#                        )))
-#      $(call rmdirw,prof/commit/$(commit))
-
 #
 ##  not-threaded
 ###
@@ -215,23 +212,28 @@ $(foreach command,$(HCOMPTA_COMMANDS), \
 %/not-threaded: %
        
 
-#
-##  sandbox
-###
-$(CABAL_SANDBOX):
-       cabal sandbox --sandbox="$@" init $(CABAL_FLAGS) $(CABAL_SANDBOX_FLAGS)
-
-%/sandbox: GHC_PKG:=cabal sandbox hc-pkg
-%/sandbox: %
-       
-
 #
 ##  ghc-pkg
 ###
-
 unregister: $(addsuffix /unregister,web cli lib)
 
-%/unregister:
+%/unregister: .
+       if    $(GHC_PKG) list       hcompta-$* | grep -q '^ * hcompta-$*-' ; \
+        then $(GHC_PKG) unregister hcompta-$* ; \
+        fi
+
+%/unregister/sandbox: GHC_PKG:=cabal sandbox hc-pkg
+%/unregister/sandbox: .
        if    $(GHC_PKG) list       hcompta-$* | grep -q '^ * hcompta-$*-' ; \
         then $(GHC_PKG) unregister hcompta-$* ; \
         fi
+
+#
+##  sandbox
+###
+$(CABAL_SANDBOX):
+       cabal $(CABAL_FLAGS) sandbox --sandbox="$@" $(CABAL_SANDBOX_FLAGS) init
+
+%/sandbox: GHC_PKG:=cabal sandbox hc-pkg
+%/sandbox: %
+