workaround ghc weirdness with -odir

The option cause it to always build to build/Main.o, no matter what
binary it was building. This caused extra work, and in some cases,
could cause the wrong code to be put into the final binary.
This commit is contained in:
Joey Hess 2011-01-07 02:15:23 -04:00
parent 55ca64d851
commit f189929b8b
3 changed files with 8 additions and 10 deletions

3
.gitignore vendored
View file

@ -1,4 +1,5 @@
build/* *.hi
*.o
test test
configure configure
SysConfig.hs SysConfig.hs

View file

@ -1,6 +1,6 @@
PREFIX=/usr PREFIX=/usr
GHCFLAGS=-O2 -Wall GHCFLAGS=-O2 -Wall
GHCMAKE=ghc -odir build -hidir build $(GHCFLAGS) --make GHCMAKE=ghc $(GHCFLAGS) --make
bins=git-annex git-annex-shell bins=git-annex git-annex-shell
mans=git-annex.1 git-annex-shell.1 mans=git-annex.1 git-annex-shell.1
@ -29,11 +29,11 @@ install: all
rsync -a --delete html/ $(DESTDIR)$(PREFIX)/share/doc/git-annex/html/; \ rsync -a --delete html/ $(DESTDIR)$(PREFIX)/share/doc/git-annex/html/; \
fi fi
test: test: $(bins)
$(GHCMAKE) test $(GHCMAKE) test
./test ./test
testcoverage: testcoverage: $(bins)
rm -f test.tix test rm -f test.tix test
ghc -odir build/test -hidir build/test $(GHCFLAGS) --make -fhpc test ghc -odir build/test -hidir build/test $(GHCFLAGS) --make -fhpc test
./test ./test
@ -59,5 +59,6 @@ docs: $(mans)
clean: clean:
rm -rf build $(bins) $(mans) test configure SysConfig.hs *.tix .hpc rm -rf build $(bins) $(mans) test configure SysConfig.hs *.tix .hpc
rm -rf doc/.ikiwiki html rm -rf doc/.ikiwiki html
find . \( -name \*.o -or -name \*.hi \) -exec rm {} \;
.PHONY: $(bins) test install .PHONY: $(bins) test install

View file

@ -1,4 +1,4 @@
{- git-annex main program {- git-annex main program stub
- -
- Copyright 2010 Joey Hess <joey@kitenet.net> - Copyright 2010 Joey Hess <joey@kitenet.net>
- -
@ -7,12 +7,8 @@
import System.Environment import System.Environment
import qualified GitRepo as Git
import CmdLine
import GitAnnex import GitAnnex
main :: IO () main :: IO ()
main = do main = do
args <- getArgs args <- getArgs
gitrepo <- Git.repoFromCwd run args
dispatch gitrepo args cmds options header