Coder Social home page Coder Social logo

build's Introduction

Build

Non-recursive make based build engine targeted for modular projects (modules, components based).

Module.mk structure

Hints

Quickly list source files within a directory:

ls -1 *.c | xargs -i echo "{} \\"

Head Makefile example

# *******************************************************************************
# Main makefile project
# This makefile calls all the modules defined in the config.mk file
# *******************************************************************************

# *******************************************************************************
# DEFAULT DEFINITIONS
# These definitions can be overloaded from the command line
# *******************************************************************************
PROJECT		?= example
TARGET 		?= release
BOARD 		?= host
OPTIM 		?= high
ENABLE_DEP 	?= true
ARCH		?= host-freertos-gcc



TOPDIR		:= ./
OUTDIR		:= $(TOPDIR)build/output/


# Export them to be sure that they are available in sub-makefiles
export PROJECT
export TARGET
export BOARD
export DEFINES
export OPTIM
export ENABLE_DEP
export ARCH
export TOPDIR
export OUTDIR

# *******************************************************************************
# APPLICATION DEFINITIONS
# List of modules and extra libraries needed to generate project targets
# *******************************************************************************
LIB_STM32F4		:= lib/rtos 


LIB_METER				:= lib/system lib/database lib/application lib/crypto lib/ip lib/util
LIB_CLIENT				:= lib/crypto lib/serial lib/util lib/hdlc src
LIB_BSP					:= arch/host
LIB_TESTS				:= tests lib/util lib/hdlc
LIB_EXAMPLE_SERVER		:= examples/server
LIB_EXAMPLE_CLIENT		:= examples/client
LIB_GURUX				:= lib/gurux
LIB_CLIENT_UTILS		:= lib/client
LIB_ICL					:= lib/icl

export LIB_STM32F4
export LIB_METER
export LIB_BSP
export LIB_TESTS
export LIB_EXAMPLE


# *******************************************************************************
# SERVER CONFIGURATION
# *******************************************************************************
ifeq ($(MAKECMDGOALS), server)

APP_MODULES 	:= src $(LIB_METER) $(LIB_BSP) $(LIB_EXAMPLE_SERVER)
APP_LIBPATH 	:= 
APP_LIBS 		:= 

endif

# *******************************************************************************
# CLIENT CONFIGURATION
# *******************************************************************************
ifeq ($(MAKECMDGOALS), client)

DEFINES += -DDEBUG=0

APP_MODULES 	:= $(LIB_CLIENT) $(LIB_EXAMPLE_CLIENT) $(LIB_GURUX) $(LIB_ICL) $(LIB_CLIENT_UTILS)
APP_LIBPATH 	:= 
APP_LIBS 		:= 

endif

# *******************************************************************************
# TESTS CONFIGURATION
# *******************************************************************************
ifeq ($(MAKECMDGOALS), tstu)

DEFINES += -DDEBUG=1

APP_MODULES 	:= src $(LIB_METER) $(LIB_BSP) $(LIB_TESTS) $(LIB_ICL) $(LIB_CLIENT_UTILS)
APP_LIBPATH 	:= 
APP_LIBS 		:= 

endif

# *******************************************************************************
# BUILD ENGINE
# *******************************************************************************
include build/Main.mk

server: $(OBJECTS)
	$(call linker, $(OBJECTS), $(APP_LIBS), cosem_server)

client: $(OBJECTS)
	$(call linker, $(OBJECTS), $(APP_LIBS), cosem_client)
	
tstu: $(OBJECTS)
	$(call linker, $(OBJECTS), $(APP_LIBS), cosem_tests)
	
clean:
	@echo "Cleaning generated files..."
	$(VERBOSE) $(RM) -rf $(OUTDIR)/*.o $(OUTDIR)/*.d $(OUTDIR)/*.gcov $(OUTDIR)/*.gcov.htm

wipe:
	@echo "Wiping output directory..."
	$(VERBOSE) $(RM) -rf $(OUTDIR)


# *******************************************************************************
# END OF MAKEFILE
# *******************************************************************************

build's People

Contributors

arabine avatar

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.