diff --git a/Makefile.am b/Makefile.am index 02fa6f6a86883df7cfad3c49f9881342a2d314d2..89050e87e433d31207a805e75e03577e7286c6af 100644 --- a/Makefile.am +++ b/Makefile.am @@ -269,7 +269,6 @@ CLEANFILES = \ src/ganeti-confd \ src/ganeti-luxid \ src/ganeti-mond \ - src/hs2py-constants \ .hpc/*.mix src/*.tix test/hs/*.tix *.tix \ doc/hs-lint.html @@ -600,9 +599,7 @@ HS_DEFAULT_PROGS = \ HS_ALL_PROGS = $(HS_DEFAULT_PROGS) $(HS_MYEXECLIB_PROGS) -HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_DEFAULT_PROGS)) \ - src/mon-collector.hs \ - src/hs2py-constants.hs +HS_PROG_SRCS = $(patsubst %,%.hs,$(HS_DEFAULT_PROGS)) src/mon-collector.hs HS_BUILT_TEST_HELPERS = $(HS_BIN_ROLES:%=test/hs/%) test/hs/hail HFLAGS = \ @@ -969,24 +966,6 @@ install-exec-hook: done endif -# This target cannot be merged with the '$(HS_ALL_PROGS)' target -# because 'hs2py-constants' cannot depend on 'Ganeti.Constants'. And -# the reason for this is because 'hs2py-constants' needs to generate -# Python code, and 'Ganeti.Constants' is generated by Python. -src/hs2py-constants: src/hs2py-constants.hs src/AutoConf.hs \ - src/Ganeti/BasicTypes.hs \ - src/Ganeti/Constants.hs \ - src/Ganeti/ConstantUtils.hs \ - src/Ganeti/JSON.hs src/Ganeti/THH.hs \ - src/Ganeti/Hs2Py/GenConstants.hs \ - src/Ganeti/Hs2Py/ListConstants.hs \ - src/Ganeti/PyValueInstances.hs \ - | stamp-srclinks - $(GHC) --make \ - $(HFLAGS) \ - -osuf $(notdir $@).o -hisuf $(notdir $@).hi \ - $(HEXTRA) $(HEXTRA_INT) src/hs2py-constants.hs - $(HS_ALL_PROGS): %: %.hs $(HS_LIBTESTBUILT_SRCS) Makefile @if [ "$(notdir $@)" = "test" ] && [ "$(HS_NODEV)" ]; then \ echo "Error: cannot run unittests without the development" \ @@ -1769,10 +1748,9 @@ test/hs/Test/Ganeti/TestImports.hs: test/hs/Test/Ganeti/TestImports.hs.in \ done ; \ } > $@ -lib/_constants.py: Makefile lib/_constants.py.in src/hs2py-constants \ - | stamp-directories +lib/_constants.py: Makefile src/hs2py lib/_constants.py.in | stamp-directories cat $(abs_top_srcdir)/lib/_constants.py.in > $@ - src/hs2py-constants >> $@ + src/hs2py --constants >> $@ lib/constants.py: lib/_constants.py @@ -1867,9 +1845,8 @@ lib/_vcsversion.py: Makefile vcs-version | stamp-directories echo "VCS_VERSION = '$$VCSVER'"; \ } > $@ -lib/opcodes.py: Makefile src/hs2py src/Ganeti/Constants.hs \ - lib/opcodes.py.in_before lib/opcodes.py.in_after \ - | stamp-directories +lib/opcodes.py: Makefile src/hs2py lib/opcodes.py.in_before \ + lib/opcodes.py.in_after | stamp-directories cat $(abs_top_srcdir)/lib/opcodes.py.in_before > $@ src/hs2py --opcodes >> $@ cat $(abs_top_srcdir)/lib/opcodes.py.in_after >> $@ diff --git a/src/hs2py-constants.hs b/src/hs2py-constants.hs deleted file mode 100644 index 9eea9970098dd2ad4e15cc750c93de198aba9ff9..0000000000000000000000000000000000000000 --- a/src/hs2py-constants.hs +++ /dev/null @@ -1,31 +0,0 @@ -{-| hs2py-constants - -This program outputs the all the converted Haskell to Python -constants. - --} - -{- - -Copyright (C) 2013 Google Inc. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301, USA. - --} -import Ganeti.Hs2Py.ListConstants - -main :: IO () -main = putConstants diff --git a/src/hs2py.hs b/src/hs2py.hs index 3a9d3db5f73bdb268d88d6b5fe087d0440eb51c9..0743fdae19c5ff1032be0b1b5fdb48e77fef55d7 100644 --- a/src/hs2py.hs +++ b/src/hs2py.hs @@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -} import Ganeti.Hs2Py.GenOpCodes +import Ganeti.Hs2Py.ListConstants import System.Environment (getArgs) import System.Exit (exitFailure) @@ -34,6 +35,7 @@ main = do args <- getArgs case args of ["--opcodes"] -> putStrLn showPyClasses + ["--constants"] -> putConstants _ -> do - hPutStrLn stderr "Usage: hs2py --opcodes" + hPutStrLn stderr "Usage: hs2py --opcodes | --constants" exitFailure