base of the project
This commit is contained in:
commit
ad626f4c54
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
vgcore*
|
||||
build/
|
||||
ft_ls
|
29
Makefile
Normal file
29
Makefile
Normal file
|
@ -0,0 +1,29 @@
|
|||
CC := gcc
|
||||
LD := $(CC)
|
||||
LDFLAGS :=
|
||||
CFLAGS := $(shell cat compile_flags.txt | sed -z "s/\n/ /g")
|
||||
SRC := $(wildcard src/*.c)
|
||||
OBJ_DIR := build
|
||||
OBJ := $(addprefix $(OBJ_DIR)/, $(patsubst %.c,%.o,$(SRC)))
|
||||
DIR := .
|
||||
RAW_NAME:= ft_ls
|
||||
NAME := $(RAW_NAME)
|
||||
|
||||
all: $(NAME)
|
||||
|
||||
$(NAME): $(OBJ)
|
||||
$(LD) $(LDFLAGS) -o $(DIR)/$(NAME) $(OBJ) $(LIBS)
|
||||
|
||||
$(OBJ_DIR)/%.o: %.c
|
||||
@mkdir -p $(@D)
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
clean:
|
||||
@rm -f $(NAME) $(NAME).exe
|
||||
@rm -rf $(OBJ_DIR)
|
||||
|
||||
re:
|
||||
@make --no-print clean
|
||||
@make --no-print all
|
||||
|
||||
.PHONY: all clean re
|
6
compile_flags.txt
Normal file
6
compile_flags.txt
Normal file
|
@ -0,0 +1,6 @@
|
|||
-includeinc/main.h
|
||||
-Wall
|
||||
-Wextra
|
||||
-std=c23
|
||||
-iquoteinc
|
||||
-g
|
11
inc/main.h
Normal file
11
inc/main.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
typedef struct flags {
|
||||
bool l;
|
||||
bool a;
|
||||
bool R;
|
||||
bool r;
|
||||
bool t;
|
||||
} flags_t;
|
||||
|
||||
flags_t get_flags(char **argv);
|
6
src/flags.c
Normal file
6
src/flags.c
Normal file
|
@ -0,0 +1,6 @@
|
|||
flags_t get_flags(char **argv) {
|
||||
|
||||
flags_t flags = {false, false, false, false, false};
|
||||
|
||||
return flags;
|
||||
}
|
8
src/main.c
Normal file
8
src/main.c
Normal file
|
@ -0,0 +1,8 @@
|
|||
int main(int argc, char **argv) {
|
||||
|
||||
if (argc < 2)
|
||||
return 1;
|
||||
|
||||
get_flags(argv);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue