Giter VIP home page Giter VIP logo

easymake's Introduction

Easymake

Introduction

Easymake is a handy makefile for C/C++ applications on Linux system. For simple applications, you don’t even need to write a single line of makefile code to build your target with easymake.

Features description:

  • Finds and compiles all C/C++ source files in the directory recursively (optional). Places the object files and target files in a separate directory.
  • Only re-compiles the changed and affected source files. That is, if you modify your header foo.h, all your source files with #include "foo.h" will be re-compiled.
  • Supports Simple unit testing.
  • Handles more than one entry point in the project.
  • Support both static library(libfoo.a) and shared library(libfoo.so) building.

NOTICE: Easymake is designed to be easy to use on simple applications, not as a highly flexible or extensible template. If you want more customization, you might need to look for a small and simple example for start.

Getting Started

Basics

git clone https://github.com/roxma/easymake
cd easymake/samples/basics
cp ../../easymake.mk Makefile
make
./bin/add  # if you rename add.cpp to myprogram.cpp, then you get ./bin/myprogram.cpp

basics

Unit Testing

Files with *_test.cpp or *_test.c pattern will be used for testing (inspired by golang).

unit_test

Multi Entries

multi_entries

Options

Easymake is trying to follow the Makefile Conventions (1) (2). The following options are supported.

  • CFLAGS Extra flags to give to the C compiler.
  • CXXFLAGS Extra flags to give to the C++ compiler.
  • LDFLAGS Extra flags to give to compilers when they are supposed to invoke the linker
  • LDLIBS Library flags or names given to compilers when they are supposed to invoke the linker
  • ARFLAGS Flags to give the archive-maintaining program; default cr

Recommended Style

In the GIFs, I simply copy easymake.mk into my souce code directory as a makefile. However, for code simplicity, I recommend the following style:

CXXFLAGS=-O2

# other options
# ...

include /path/to/easymake.mk

easymake's People

Contributors

roxma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

easymake's Issues

'make clean' doesn't remove files

I copied the easymake.mk into my working directory and created a Makefile containing

CXXFLAGS=-O2

include ./easymake.mk

After executing make and successfully building I tried make clean but it just printed

if [ -d bin ]; then find bin '(' -name "*.o" -o -name "*.d" -o -name "*.a" -o -name "*.so" -o -name "em_*" ')' -exec rm -f '{}' ';' ; fi

I modified the em_clean rule in the easymake.mk like this

em_clean:
    @if [ -d $(BUILD_ROOT) ]; then find $(BUILD_ROOT) '(' -name "*.o" -o -name "*.d" -o -name "*.a" -o -name "*.so" -o -    name "em_*" ')' -exec rm -f '{}' ';' ; fi

and the clean command worked.

filter out some files

I'd really like to use easymake for a retrofit of a disaster of a build system but most of our test files are named Test* or /some/path/Test/foo.cpp. I tried to figure out what magic to add to easymake_nontest_entry_list (or whatever) but since your Makefile-fu is 100x stronger than mine I can't figure it out.

So thanks for providing this project but a potentially staunch convert requires a bit of support. ;)

I tried adding this function based on a stackoverflow answer but I'm doing something wrong and/or just don't understand how your Makefile works.

FILTER_OUT = $(foreach v,$(2),$(if $(findstring $(1),$(v)),,$(v)))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.