add Makefile, add main.[hc], update .gitignore
This commit is contained in:
		
							parent
							
								
									6919c4c98c
								
							
						
					
					
						commit
						9a50b6f481
					
				
							
								
								
									
										5
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -19,3 +19,8 @@ tags | ||||
| # Persistent undo | ||||
| [._]*.un~ | ||||
| 
 | ||||
| # ---> cc | ||||
| # compiled files | ||||
| *.o | ||||
| /rush-02 | ||||
| a.out | ||||
|  | ||||
							
								
								
									
										46
									
								
								Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								Makefile
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,46 @@ | ||||
| # **************************************************************************** #
 | ||||
| #                                                                              #
 | ||||
| #                                                         :::      ::::::::    #
 | ||||
| #    Makefile                                           :+:      :+:    :+:    #
 | ||||
| #                                                     +:+ +:+         +:+      #
 | ||||
| #    By: achubuko <marvin@42.fr>                    +#+  +:+       +#+         #
 | ||||
| #                                                 +#+#+#+#+#+   +#+            #
 | ||||
| #    Created: 2023/12/02 21:33:22 by achubuko          #+#    #+#              #
 | ||||
| #    Updated: 2023/12/02 21:33:31 by achubuko         ###   ########.fr        #
 | ||||
| #                                                                              #
 | ||||
| # **************************************************************************** #
 | ||||
| 
 | ||||
| NAME=rush-02 | ||||
| _CFLAGS = -Wall -Wextra -Werror | ||||
| CFLAGS = -g | ||||
| #####################################
 | ||||
| ######### MANDATORY RULES ###########
 | ||||
| #####################################
 | ||||
| 
 | ||||
| # all: default rule
 | ||||
| # norme prerequisite is not mandatory
 | ||||
| all: $(NAME) norme | ||||
| 
 | ||||
| # clean: Delete *.o for project and libraries
 | ||||
| clean: | ||||
| 	rm -rdf $(wildcard */*.o) | ||||
| 
 | ||||
| # fclean: Delete *.o files and delete named executable
 | ||||
| fclean: clean | ||||
| 	rm -f $(NAME) | ||||
| 
 | ||||
| # re: full clean and recompilation
 | ||||
| re: fclean all | ||||
| 
 | ||||
| # these targets are not backed by files, therefore, always run when called
 | ||||
| .PHONY: all clean fclean re purge norme | ||||
| #####################################
 | ||||
| ########## PROJECT RULES ############
 | ||||
| #####################################
 | ||||
| norme: | ||||
| 	norminette ex00 | ||||
| cfiles := $(wildcard ex00/*.c) | ||||
| ofiles = $(foreach f, $(cfiles), $(subst .c,.o,$f)) | ||||
| %.o: %.c %.h | ||||
| 	$(CC) $(_CFLAGS) $(CFLAGS) -c -o $@ $< | ||||
| $(NAME):  $(ofiles) | ||||
							
								
								
									
										22
									
								
								ex00/main.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								ex00/main.c
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,22 @@ | ||||
| /* ************************************************************************** */ | ||||
| /*                                                                            */ | ||||
| /*                                                        :::      ::::::::   */ | ||||
| /*   rush-02.c                                          :+:      :+:    :+:   */ | ||||
| /*                                                    +:+ +:+         +:+     */ | ||||
| /*   By: achubuko <marvin@42.fr>                    +#+  +:+       +#+        */ | ||||
| /*                                                +#+#+#+#+#+   +#+           */ | ||||
| /*   Created: 2023/12/02 21:01:21 by achubuko          #+#    #+#             */ | ||||
| /*   Updated: 2023/12/02 21:25:56 by achubuko         ###   ########.fr       */ | ||||
| /*                                                                            */ | ||||
| /* ************************************************************************** */ | ||||
| #include "main.h" | ||||
| 
 | ||||
| int	main(int argc, char **argv) | ||||
| { | ||||
| 	if (argc > 3) | ||||
| 	{ | ||||
| 		write(1, "Error: program requires 1 or 2 arguments passed!", 48); | ||||
| 		return (1); | ||||
| 	} | ||||
| 	write(1, argv[1], 1); | ||||
| } | ||||
							
								
								
									
										17
									
								
								ex00/main.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								ex00/main.h
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,17 @@ | ||||
| /* ************************************************************************** */ | ||||
| /*                                                                            */ | ||||
| /*                                                        :::      ::::::::   */ | ||||
| /*   rush-02.h                                          :+:      :+:    :+:   */ | ||||
| /*                                                    +:+ +:+         +:+     */ | ||||
| /*   By: achubuko <marvin@42.fr>                    +#+  +:+       +#+        */ | ||||
| /*                                                +#+#+#+#+#+   +#+           */ | ||||
| /*   Created: 2023/12/02 21:14:25 by achubuko          #+#    #+#             */ | ||||
| /*   Updated: 2023/12/02 21:25:18 by achubuko         ###   ########.fr       */ | ||||
| /*                                                                            */ | ||||
| /* ************************************************************************** */ | ||||
| #ifndef MAIN_H | ||||
| # define MAIN_H | ||||
| # include <unistd.h> | ||||
| # include <stdlib.h> | ||||
| 
 | ||||
| #endif | ||||
		Reference in New Issue
	
	Block a user