From cd2d696006bdaebb2e2af7027f5d923d8cc4beb1 Mon Sep 17 00:00:00 2001 From: _N3m0 Date: Sun, 13 Aug 2023 14:33:10 +0200 Subject: [PATCH] zopajdnfv --- Makefile | 123 ++++++++++++--------- bashrc | 9 +- newp-template/cpp.template/CMakeLists.txt | 31 ------ newp-template/cpp.template/Makefile | 1 + newp-template/cppl.template/CMakeLists.txt | 31 ------ newp-template/cppl.template/Makefile | 1 + 6 files changed, 82 insertions(+), 114 deletions(-) delete mode 100644 newp-template/cpp.template/CMakeLists.txt create mode 120000 newp-template/cpp.template/Makefile delete mode 100644 newp-template/cppl.template/CMakeLists.txt create mode 120000 newp-template/cppl.template/Makefile diff --git a/Makefile b/Makefile index 4bcb2e6..3fe2493 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,15 @@ -PROJECTNAME=OMTRTA +PROJECTNAME=MasterMakefile BIN=build/$(PROJECTNAME) CC=g++ EXT=cpp INCFOLDERS=include lib -INCDIRS=$(foreach I,$(INCFOLDERS),$(shell find $(I) -type d 2>/dev/null)) +RECURSIVE_INCLUDE=false +ifeq ($(RECURSIVE_INCLUDE), true) + INCDIRS=$(foreach I,$(INCFOLDERS),$(shell find $(I) -type d 2>/dev/null)) +else + INCDIRS=$(INCFOLDERS) +endif # make mode=release ifeq ($(mode), release) @@ -13,85 +18,103 @@ else OPT=-Og -g endif DEPFLAGS=-MP -MD -FLAGS=-Wall -Wextra $(foreach F,$(INCDIRS),-I$(F)) $(OPT) $(DEPFLAGS) +MACROS=HW PI=3.14 +FLAGS=-Wall -Wextra $(foreach F,$(INCDIRS),-I$(F)) $(OPT) $(DEPFLAGS) $(foreach M,$(MACROS),-D$(M)) SRC=$(shell find . -name "*.$(EXT)" -path "./src/*") OBJ=$(subst ./src/,./build/,$(SRC:.$(EXT)=.o)) -DEP=$(OBJ:.o=.d) -ASM=$(OBJ:.o=.s) +LIB=$(shell find . -name "*.$(EXT)" -path "./lib/*") +LIBO=$(subst ./lib/,./build/,$(LIB:.$(EXT)=.o)) TEST=$(shell find . -name "*.$(EXT)" -path "./test/*") -TESTO=$(subst ./test/,./build/,$(TEST:.$(EXT)=.test)) +TESTO=$(subst ./test/,./build/,$(TEST:.$(EXT)=.t)) $(shell mkdir -p build) + all : $(BIN) -$(BIN) : $(OBJ) +$(BIN) : $(OBJ) $(LIBO) $(CC) $(FLAGS) -o $@ $^ --include $(DEP) +-include $(OBJ:.o=.d) $(LIBO:.o=.d) build/%.o : src/%.$(EXT) @mkdir -p $(@D) $(CC) $(FLAGS) -o $@ -c $< +build/%.o : lib/%.$(EXT) + @mkdir -p $(@D) + $(CC) $(FLAGS) -o $@ -c $< -run : all - ./$(BIN) $(input) +# make test file=testGenID.cpp +test : build/$(file).t + ./build/$(file).t + +alltest : $(TESTO) + @for i in $(TESTO); do echo $$i; $$i; done + +build/%.t : test/%.$(EXT) + @mkdir -p $(@D) + $(CC) $(FLAGS) -o $@ $< + +asm : $(OBJ:.o=.s) $(BIN).s + +build/%.s : src/%.$(EXT) + @mkdir -p $(@D) + $(CC) $(FLAGS) -S $< -o $@ + +$(BIN).s : $(BIN) + objdump -drwC -Mintel -S $< > $<.s + +preprocess : $(OBJ:.o=.i) + +build/%.i : src/%.$(EXT) + @mkdir -p $(@D) + $(CC) $(FLAGS) -E $< -o $@ + +gigall : $(BIN) $(TESTO) asm preprocess + +# make run input="program input" +run : $(BIN) + ./$< $(input) clean : rm -rf build/* -# make test file=testGenID.cpp -test : build/$(file:.$(EXT)=.test) - ./build/$(file:.$(EXT)=.test) - -alltest : $(TESTO) - for i in $$(ls build/*.test); do echo $$i; $$i; done - -build/%.test : test/%.$(EXT) - @mkdir -p $(@D) - $(CC) $(FLAGS) -o $@ $< - check : cppcheck --enable=all --suppress=missingIncludeSystem $(foreach I,$(INCDIRS),-I$(I)) . flawfinder . -info : - $(info put what ever) - @echo you want +debug : $(BIN) + gdb $< $(input) # unzip : tar -xvf exemple.tgz dist : clean $(info /!\ project folder has to be named $(PROJECTNAME) /!\ ) cd .. && tar zcvf $(PROJECTNAME)/build/$(PROJECTNAME).tgz $(PROJECTNAME) >/dev/null -asm : $(ASM) $(BIN) $(BIN).s - -build/%.s : src/%.$(EXT) - @mkdir -p $(@D) - $(CC) $(FLAGS) -S $^ -o $@ - -$(BIN).s : - objdump -drwC -Mintel -S $(BIN) > $(BIN).s - -debug : $(BIN) - gdb $(BIN) $(input) - -preprocess : $(OBJ:.o=.i) - -build/%.i : src/%.$(EXT) - @mkdir -p $(@D) - $(CC) $(FLAGS) -E $^ -o $@ - -gigall : all asm preprocess $(TESTO) - -install : dist - cp Makefile ../script - mv build/OMTRTA.tgz ../opt/archive - cd .. && rm -rf OMTRTA - push : git push bbsrv git push gh -.PHONY : all run clean test alltest check info dist asm debug preprocess gigall install push +install : dist + cp Makefile ../script + mv build/$(PROJECTNAME).tgz ../opt/archive + cd .. && rm -rf $(PROJECTNAME) + +info : + $(info put what ever) + @echo you want + +# alias + +r : run + +t : test + +c : check + +p : push + +d : debug + +.PHONY : all test t alltest asm preprocess gigall run r clean check c debug d dist push p install info diff --git a/bashrc b/bashrc index 3b6c9d5..47197b2 100644 --- a/bashrc +++ b/bashrc @@ -45,6 +45,7 @@ myip=$(dig +short txt ch whoami.cloudflare @1.0.0.1 | sed 's/\"//g') alias cls="clear && neofetch" alias clr="clear" alias clm="clear && mcphrase" +alias cll="clear && ls" alias rm="trash" alias shut="shutdown 0" alias v="nvim" @@ -57,6 +58,7 @@ alias ....="cd ../../.." alias send-nude="pqiv --fullscreen -t ~/pictures/nude.jpeg" alias libresprite="~/documents/libresprite.AppImage 1>/dev/null &" alias lsa="ls -a" +alias lsA="ls -A" alias lsl="ls -l" alias bashrc="nvim ~/dev/script/bashrc && exec bash" alias agenda="v ~/documents/agenda" @@ -93,6 +95,7 @@ alias vbashrc="v $HOME/dev/script/bashrc" alias obsidian="~/downloads/Obsidian-1.3.5.AppImage >/dev/null 2>/dev/null &" alias hamood="figlet habibi | lolcat -p 0.5 && espeak -v af habibi" alias please="sudo" +alias m="make" # alias avec parametre emoji(){ grep -i $1 ~/documents/emoji; } @@ -108,11 +111,13 @@ cgit(){ [[ $1 = "" ]] && d="." || d=$1 && ls -d $d/*/ | xargs ls -a | grep ^\\.g lsc(){ ls $1 | wc -l; } lsac(){ ls -A $1 | wc -l; } waka(){ echo $1 > .wakatime-project; } -lol(){ [[ $1 = "" ]] && fortune | cowsay -f tux | lolcat || cowsay -f tux $1 | lolcat; } +lole(){ [[ $1 = "" ]] && WTS=$(fortune) || WTS=$1; cowsay -f tux "$WTS" | lolcat && espeak -v en-us "$WTS"; } +lol(){ [[ $1 = "" ]] && WTS=$(fortune) || WTS=$1; cowsay -f tux "$WTS" | lolcat && espeak -v fr-fr "$WTS"; } catall(){ find -type f | grep -v \.git | grep -v build | xargs file | grep text | sed "s/:.*$//g" | xargs tail -n +1; } fgit(){ find | grep \\.git$ | sed s/\\.git//g; } lgit(){ fgit | fgit | grep --color=never ^\\./[^/]*/$ ; } -mkdirc(){ mkdir $1 && cd $1; } +cmkdir(){ mkdir $1 && cd $1; } +clo(){ clr && lole $1; } alias sgit="for i in \$(lgit); do echo -e \"\n\$i\" && cd \$i && git status && back; done" diff --git a/newp-template/cpp.template/CMakeLists.txt b/newp-template/cpp.template/CMakeLists.txt deleted file mode 100644 index d49fb1f..0000000 --- a/newp-template/cpp.template/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -cmake_minimum_required(VERSION 3.10) - -# Project -project(cpp.template LANGUAGES CXX) -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_CXX_EXTENSIONS off) -set(CMAKE_CXX_FLAGS "-Wall -Weffc++ -Wextra -Wsign-conversion") - -# Sources -file(GLOB_RECURSE SOURCES src/*.cpp) -file(GLOB_RECURSE HEADERS include/*.hpp include/*.h src/*.hpp src/*.h) - -# ex librairie -# find_package(exlib REQUIRED) # ou QUIET (req = obligée, si erreur stop ; quiet = si erreur, informe et continue) -# include_directories(${exlib_INCLUDE_DIRS}) # optionnel, si erreur chercher exlibCONFIG.cmake pour trouver le $() qui convient -# link_directories(${exlib_LIB_DIRS}) # optionnel; pareil qu'en dessus -# add_definitions(${exlib_FLAGS}) - -# Executable -add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS}) - -# suite exlib -# target_link_libraries(${PROJECT_NAME} ${exlib_LIBRARIES}) - -# Includes -target_include_directories(${PROJECT_NAME} PUBLIC include) -target_include_directories(${PROJECT_NAME} PUBLIC src) - -# tuto -# https://www.youtube.com/watch?v=9fowTjLimxQ tuto cmake -# https://www.youtube.com/watch?v=Lrt3i83wsy4 tuto cmake lib diff --git a/newp-template/cpp.template/Makefile b/newp-template/cpp.template/Makefile new file mode 120000 index 0000000..94aaae2 --- /dev/null +++ b/newp-template/cpp.template/Makefile @@ -0,0 +1 @@ +../../Makefile \ No newline at end of file diff --git a/newp-template/cppl.template/CMakeLists.txt b/newp-template/cppl.template/CMakeLists.txt deleted file mode 100644 index 7c58ec1..0000000 --- a/newp-template/cppl.template/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -cmake_minimum_required(VERSION 3.10) - -# Project -project(cppl.template LANGUAGES CXX) -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_CXX_EXTENSIONS off) -set(CMAKE_CXX_FLAGS "-Wall -Weffc++ -Wextra -Wsign-conversion") - -# Sources -file(GLOB_RECURSE SOURCES src/*.cpp) -file(GLOB_RECURSE HEADERS include/*.hpp include/*.h src/*.hpp src/*.h) - -# ex librairie -# find_package(exlib REQUIRED) # ou QUIET (req = obligée, si erreur stop ; quiet = si erreur, informe et continue) -# include_directories(${exlib_INCLUDE_DIRS}) # optionnel, si erreur chercher exlibCONFIG.cmake pour trouver le $() qui convient -# link_directories(${exlib_LIB_DIRS}) # optionnel; pareil qu'en dessus -# add_definitions(${exlib_FLAGS}) - -# Executable -add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS}) - -# suite exlib -# target_link_libraries(${PROJECT_NAME} ${exlib_LIBRARIES}) - -# Includes -target_include_directories(${PROJECT_NAME} PUBLIC include) -target_include_directories(${PROJECT_NAME} PUBLIC src) - -# tuto -# https://www.youtube.com/watch?v=9fowTjLimxQ tuto cmake -# https://www.youtube.com/watch?v=Lrt3i83wsy4 tuto cmake lib diff --git a/newp-template/cppl.template/Makefile b/newp-template/cppl.template/Makefile new file mode 120000 index 0000000..94aaae2 --- /dev/null +++ b/newp-template/cppl.template/Makefile @@ -0,0 +1 @@ +../../Makefile \ No newline at end of file