Skip to content

nmattia/makefile

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
nix
 
 
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

CircleCI

Haskell Makefile Parser and Generator

Parse and generate Makefiles. The project is available on hackage (latest).

Example

Parsing

# Define compiler
CC:=gcc

# Define lazy compiler
LC=ghc

all: hello

hello: foo bar
	$(CC) baz.o

Running parseMakefile :: IO (Either String Makefile) (pretty-printed for convenience):

Right
    ( Makefile
        { entries =
            [ Assignment SimpleAssign "CC" "gcc"
            , Assignment RecursiveAssign "LC" "ghc"
            , Rule
                (Target "all")
                [Dependency "hello"]
                []
            , Rule
                (Target "hello")
                [ Dependency "foo"
                , Dependency "bar"
                ]
                [Command "$(CC) baz.o"]
            ]
        }
    )

Generating

myMakefile :: Makefile
myMakefile =
    Makefile
        { entries =
            [ Assignment SimpleAssign "foo" "bar"
            , Rule (Target "baz") [Dependency "qux"] [Command "rm -rf /"]
            ]
        }

Running encodeMakefile :: Makefile -> Text:

foo:=bar
baz: qux
	rm -rf /

Release checklist

  1. Make sure you're on (latest) master.

  2. Bump the version in makefile.cabal: 0.MAJOR.MINOR.PATCH.

Given a version number MAJOR.MINOR.PATCH, increment the:

MAJOR version when you make incompatible API changes, MINOR version when you add functionality in a backwards-compatible manner, and PATCH version when you make backwards-compatible bug fixes.

  1. Commit the updated makefile.cabal file with commit name Release v1.MAJOR.MINOR.PATCH, as well as the updated documentation.
  2. Tag the commit with git tag v1.MAJOR.MINOR.PATCH.
  3. Run stack upload --pvp-bounds both . to upload makefile to hackage.
  4. Push with git push --follow-tags.

About

Haskell Makefile parser

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published