Skip to content

An absurdly extensive C library of useful (and possibly excessive) functions usefull in 42 path

License

Notifications You must be signed in to change notification settings

Sheratan095/Corekit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Usage

COREKIT_PATH = ./Corekit #path of corekit folder

FLAGS		= -Wall -Werror -Wextra -g

INCLUDES = -I$(COREKIT_PATH)/includes #path of includes folder in corekit

%.o: %.c
	cc $(FLAGS) $(INCLUDES) -c $< -o $@

$(NAME): $(OBJ)
	$(MAKE) -sC $(COREKIT_PATH) #execute make in corekit folder in silent mode
	cc $(FLAGS) $(INCLUDES) $(OBJ) -L$(COREKIT_PATH) -lcorekit -o $(NAME)
	#-lcorekit: includes library name (libcorekit)
	#-L$(COREKIT_PATH): link the specified directory to main compilation

clean:
	@${MAKE} -C corekit clean

fclean: clean
	@${MAKE} -C corekit fclean -s

In this example the project structure is:

.
├── main.c
├── makefile
├── corekit ▼
│   ├── Makefile
│   ├── README.md
│   ├── includes ►
│   └── src ►

Makefile explanation

The library (.a file) is called libcorekit.a beacause all the library during compilation must start with 'lib' prefix

$@  rename with target file name and in the directory of c original file

$< takes the firts prerequisite, so the c file

-c  flag is used to generate .o file

%.o: %.c
	@$(COMPILE) -c $< -Iincludes -o $@

-c $< means that the compiler should compile the source file specified by the first prerequisite without linking it, resulting in the generation of an object file

-Iincludes includes the 'includes' folder that contain all the headers that are to be included


R=\033[0m isn't a color but 's a control code to reset the text attributes to the default, including color.


TABLE OF CONTENT

About

An absurdly extensive C library of useful (and possibly excessive) functions usefull in 42 path

Topics

Resources

License

Stars

Watchers

Forks