Advertisement
nullCompiler

make setup

May 22nd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 1.39 KB | None | 0 0
  1. # Compiler to use
  2. CC = gcc
  3.  
  4. # regular build
  5. CFLAGS = -ansi -pedantic -O2 -Wall
  6.  
  7. # debug build
  8. CFLAGSDEBUG = -ansi -pedantic -g -Wall -DDEBUG
  9.  
  10. # Directory for header file
  11. INCLUDES = -I .
  12.  
  13. # source directory
  14. SRCDIR = ./src/
  15.  
  16. # source files
  17. SRC := $(SRCDIR)main.c
  18.  
  19. # object directory
  20. OBJDIR = ./obj/
  21.  
  22. # List of objects to be build
  23. OBJ = $(SRC:srcdir/%.c=objdir/%.o)
  24.  
  25. # executable name
  26. EXE = nc
  27.  
  28. # executable name for debug build
  29. EXEDEBUG = ncdebug
  30.  
  31. # To declare all, clean are not files
  32. .PHONY: all clean
  33.  
  34. all: ${OBJECTS}
  35.         # To print "Building.." message
  36.         @echo "Building.."
  37.         ${CC} ${CFLAGS} ${INCLUDES} ${OBJ} -o ${EXE}
  38.  
  39. debug: ${OBJECTS}
  40.         # To print "Building with debuging.." message
  41.         @echo "Building with debugging.."
  42.         ${CC} ${CFLAGSDEBUG} ${INCLUDES} ${OBJ} -o ${EXEDEBUG}
  43.  
  44. #%.o: %.c
  45.         # % pattern wildcard matching
  46. #       ${CC} ${CFLAGS} -c $*.c ${INCLUDES}
  47.  
  48. list:
  49.         # To print output of command 'ls'
  50.         @echo $(shell ls)
  51.  
  52. clean:
  53.         @echo "Cleaning up all files.."
  54.         # - prefix for ignoring errors and continue execution
  55.         -rm -rf $(objdir/%)*.o
  56.         -rm ${EXE}
  57.         -rm ${EXEDEBUG}
  58.  
  59. clean-main:
  60.         @echo "Cleaning up.."
  61.         # - prefix for ignoring errors and continue execution
  62.         -rm -rf $(objdir/%)*.o
  63.         -rm ${EXE}
  64.    
  65. clean-debug:
  66.         @echo "Cleaning up debug.."
  67.         # - prefix for ignoring errors and continue execution
  68.         -rm -rf $(objdir/%)*.o
  69.         -rm ${EXEDEBUG}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement