commit bb423816c9aa06d503c95888bb15ebf47265471b
parent 1984c75daa14398097e9b535a97fbd92cf3e6907
Author: al1-ce <al1-ce@null.net>
Date: Sat, 19 Jul 2025 16:46:56 +0300
add make
Diffstat:
2 files changed, 75 insertions(+), 1 deletion(-)
diff --git a/package.json b/package.json
@@ -4,7 +4,7 @@
},
"name": "al1-ce.dev",
"version": "1.0.0",
- "description": "personal website",
+ "description": "Personal Wiki",
"main": "index.js",
"scripts": {
"start": "node ./index.js",
diff --git a/public/wiki/make.md b/public/wiki/make.md
@@ -0,0 +1,74 @@
+# Make (GNU Make)
+
+This article is a stub.
+
+```makefile
+CC=gcc
+CXX=g++
+RM=rm -f
+CPPFLAGS=-g -Wall -Wextra -Werror -I./lib/godot-cpp/include
+LDFLAGS=-g
+LDLIBS=
+
+# SOURCES=tool.cc support.cc
+# OBJS=$(subst .cc,.o,$(SOURCES))
+
+SOURCES := $(wildcard src/*.cpp)
+OBJS=$(patsubst src/%.cpp,obj/%.o,$(SOURCES))
+
+all: $(OBJS)
+
+$(OBJS): $(SOURCES)
+ $(CXX) $(LDFLAGS) $< -o $@ $(LDLIBS)
+
+clean:
+ $(RM) $(OBJS)
+
+# Outputs target name
+echo $@
+
+# Outputs all prerequisites newer than the target
+echo $?
+
+# Outputs all prerequisites
+echo $^
+
+# Outputs the first prerequisite
+echo $<
+
+# Simple assignment :=
+# A simple assignment expression is evaluated only once, at the very first occurrence. For example, if CC :=${GCC} ${FLAGS} during the first encounter is evaluated to gcc -W then each time ${CC} occurs it will be replaced with gcc -W.
+
+# Recursive assignment =
+# A Recursive assignment expression is evaluated everytime the variable is encountered in the code. For example, a statement like CC = ${GCC} {FLAGS} will be evaluated only when an action like ${CC} file.c is executed. However, if the variable GCC is reassigned i.e GCC=c++ then the ${CC} will be converted to c++ -W after the reassignment.
+
+# Conditional assignment ?=
+# Conditional assignment assigns a value to a variable only if it does not have a value
+
+# Appending +=
+# Assume that CC = gcc then the appending operator is used like CC += -w
+# then CC now has the value gcc -W
+
+# WINLIBS := -L"/c/Windows/System32" \
+# -l:ntdll.dll \
+# -l:KERNEL32.DLL \
+# -l:KERNELBASE.dll \
+# -l:msvcrt.dll \
+# -l:advapi32.dll \
+# -l:sechost.dll \
+# -l:RPCRT4.dll \
+# -l:CRYPTBASE.DLL \
+# -l:bcryptPrimitives.dll
+
+# -MM make makedeps
+# -MT specify which file to generate depends for
+# -MF output file
+$(DEPFILES): .deps/%.d: src/%.cpp src/%.h
+ g++ -MM -MT $(patsubst src/%.cpp,bin/%.o,$<) -MF $@ $(GODOT_CPP_INCLUDES) -Isrc $<
+
+NODEPS := clean purge
+
+ifeq (0, $(words $(findstring $(MAKECMDGOALS), $(NODEPS))))
+ -include $(DEPFILES)
+endif
+```