Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Compiler to use
- CC = gcc
- # regular build
- CFLAGS = -ansi -pedantic -O2 -Wall
- # debug build
- CFLAGSDEBUG = -ansi -pedantic -g -Wall -DDEBUG
- # Directory for header file
- INCLUDES = -I .
- # source directory
- SRCDIR = ./src/
- # source files
- SRC := $(SRCDIR)main.c
- # object directory
- OBJDIR = ./obj/
- # List of objects to be build
- OBJ = $(SRC:srcdir/%.c=objdir/%.o)
- # executable name
- EXE = nc
- # executable name for debug build
- EXEDEBUG = ncdebug
- # To declare all, clean are not files
- .PHONY: all clean
- all: ${OBJECTS}
- # To print "Building.." message
- @echo "Building.."
- ${CC} ${CFLAGS} ${INCLUDES} ${OBJ} -o ${EXE}
- debug: ${OBJECTS}
- # To print "Building with debuging.." message
- @echo "Building with debugging.."
- ${CC} ${CFLAGSDEBUG} ${INCLUDES} ${OBJ} -o ${EXEDEBUG}
- #%.o: %.c
- # % pattern wildcard matching
- # ${CC} ${CFLAGS} -c $*.c ${INCLUDES}
- list:
- # To print output of command 'ls'
- @echo $(shell ls)
- clean:
- @echo "Cleaning up all files.."
- # - prefix for ignoring errors and continue execution
- -rm -rf $(objdir/%)*.o
- -rm ${EXE}
- -rm ${EXEDEBUG}
- clean-main:
- @echo "Cleaning up.."
- # - prefix for ignoring errors and continue execution
- -rm -rf $(objdir/%)*.o
- -rm ${EXE}
- clean-debug:
- @echo "Cleaning up debug.."
- # - prefix for ignoring errors and continue execution
- -rm -rf $(objdir/%)*.o
- -rm ${EXEDEBUG}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement