# (C) Copyleft 2011 2012 2013 2014 2015 2016 2017 2018 # Late Lee(li@latelee.org) from http://www.latelee.org # # A simple Makefile for *ONE* project(c or/and cpp file) in *ONE* or *MORE* directory # # note: # you can put head file(s) in 'include' directory, so it looks # a little neat. # # usage: # $ make # $ make V=1 # verbose ouput # $ make CROSS_COMPILE=arm-arago-linux-gnueabi- # cross compile for ARM, etc. # $ make debug=y # debug # # log # 2013-05-14 sth about debug... # 2016-02-29 sth for c/c++ multi diretory # 2017-04-17 -s for .a/.so if no debug # 2017-05-05 Add V for verbose ouput ###############################################################################
# !!!=== cross compile... CROSS_COMPILE ?=
MKDIR_P ?= mkdir -p
CC = $(CROSS_COMPILE)gcc CXX = $(CROSS_COMPILE)g++ AR = $(CROSS_COMPILE)ar
# !!!=== # in case all .c/.cpp need g++... # CC = $(CXX)
ARFLAGS = -cr RM = -rm -rf MAKE = make
CFLAGS = LDFLAGS = DEFS = LIBS =
# !!!=== # target executable file or .a or .so target = a.out
#**************************************************************************** # debug can be set to y to include debugging info, or n otherwise debug = y
# !!!=== # include head file directory here INC = ./include ./inc # or try this #INC := $(shell find $(INC) -type d)
# !!!=== # build directory BUILD_DIR ?= #./build/
# !!!=== # source file(s), including ALL c file(s) or cpp file(s) # just need the directory. SRC_DIRS = . foo bar crc hello # or try this #SRC_DIRS = ./ #SRC_DIRS += ../outbox