mirror of
https://github.com/Hizenberg469/Makefile-tutorial.git
synced 2026-04-19 13:52:24 +03:00
Makefile update
This commit is contained in:
20
Makefile
20
Makefile
@@ -1,3 +1,5 @@
|
|||||||
|
#make "rule" -f "makefile name"
|
||||||
|
|
||||||
#############GUIDE LIST##########################################
|
#############GUIDE LIST##########################################
|
||||||
# G1. CC: #
|
# G1. CC: #
|
||||||
# Flag to mention the C compiler to used. #
|
# Flag to mention the C compiler to used. #
|
||||||
@@ -48,7 +50,8 @@
|
|||||||
#Flags
|
#Flags
|
||||||
# C program
|
# C program
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CFLAGS = -g
|
INCDIRS = -I./include
|
||||||
|
CFLAGS = -g $(INCDIRS)
|
||||||
OUTPUT_OPTION = -MMD -MP -o $@
|
OUTPUT_OPTION = -MMD -MP -o $@
|
||||||
SHARED_LIBRARY_EXTENSION = so
|
SHARED_LIBRARY_EXTENSION = so
|
||||||
SHARED_LIBRARY_FLAG = -shared
|
SHARED_LIBRARY_FLAG = -shared
|
||||||
@@ -88,6 +91,18 @@ ${EXE_NAME}: ${OBJS}
|
|||||||
${CC} ${OJBS} -o ${EXE_NAME}
|
${CC} ${OJBS} -o ${EXE_NAME}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#regular expression where % is a wildcard
|
||||||
|
%.o: %.c
|
||||||
|
$(CC) $(CFLAGS) -c $^ -o $@
|
||||||
|
|
||||||
|
#OR
|
||||||
|
|
||||||
|
%.o: %.c
|
||||||
|
$(CC) $(CFLAGS) -c -o $@ $^
|
||||||
|
|
||||||
|
|
||||||
##G12.
|
##G12.
|
||||||
#####SOURCE FILE DEPENDENT ON HEADER FILE################
|
#####SOURCE FILE DEPENDENT ON HEADER FILE################
|
||||||
# "src or obj file": "header file" #
|
# "src or obj file": "header file" #
|
||||||
@@ -131,8 +146,9 @@ ${LIB}.${SHARED_LIBRARY_EXTENSION}: ${OBJS}
|
|||||||
##G14.
|
##G14.
|
||||||
###MEANING OF $@ AND $^ SYMBOLS ON ABOVE RULE####################
|
###MEANING OF $@ AND $^ SYMBOLS ON ABOVE RULE####################
|
||||||
# $@ -> Replacing itself with rule under which #
|
# $@ -> Replacing itself with rule under which #
|
||||||
# its written. #
|
# its written. (Left side of rule) #
|
||||||
# $^ -> Replacing itself with dependencies of rule. #
|
# $^ -> Replacing itself with dependencies of rule. #
|
||||||
|
# (Right side of rule) #
|
||||||
#################################################################
|
#################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
0
featureful_makefile/Makefile
Normal file
0
featureful_makefile/Makefile
Normal file
Reference in New Issue
Block a user