点击(此处)折叠或打开

  1. #
  2. DIR_INC = ./include
  3. DIR_SRC = ./src
  4. DIR_OBJ = ./obj
  5. DIR_BIN = ./bin
  6. DIR_LIB = ./lib

  7. SRC = $(wildcard ${DIR_SRC}/*.c)
  8. OBJ = $(patsubst %.c,${DIR_OBJ}/%.o,$(notdir ${SRC}))

  9. TARGET = unit_test

  10. BIN_TARGET = ${DIR_BIN}/${TARGET}

  11. CC = arm-linux-gcc
  12. CFLAGS = -g -Wall -I${DIR_INC}
  13. LDFLAGS = -L${DIR_LIB}

  14. ${BIN_TARGET}:${OBJ}
  15.     $(CC) $(LDFLAGS) $(OBJ) -o $@

  16. ${DIR_OBJ}/%.o:${DIR_SRC}/%.c
  17.     $(CC) $(CFLAGS) -c $< -o $@

  18. .PHONY:clean
  19. clean:
  20.     find ${DIR_OBJ} -name *.o -exec rm -rf {} \

11-18 17:46