mirror of
https://github.com/TrudeEH/web.git
synced 2025-12-06 08:23:37 +00:00
Misc fixes; Update index; Add meson to compiling note
This commit is contained in:
@@ -64,16 +64,50 @@ gcc -o hello hello.c -lcs50
|
||||
## Make
|
||||
|
||||
`Make` Is a build automation tool that automates the process of compiling, linking and building executables.
|
||||
An example `Makefile` could look like the following:
|
||||
An example `Makefile` (for an app using `GTK4`) could be as follows:
|
||||
|
||||
```Makefile
|
||||
hello:
|
||||
gcc -o hello hello.c -lcs50
|
||||
CC = gcc
|
||||
CFLAGS = $(shell pkg-config --cflags gtk4)
|
||||
LIBS = $(shell pkg-config --libs gtk4)
|
||||
|
||||
hello: hello.c
|
||||
$(CC) $(CFLAGS) -o hello hello.c $(LIBS) -O2
|
||||
|
||||
debug: hello.c
|
||||
$(CC) $(CFLAGS) -o hello hello.c $(LDFLAGS) -Wall -Wextra -Og -g
|
||||
|
||||
clean:
|
||||
rm -f hello
|
||||
```
|
||||
|
||||
```Shell
|
||||
make # Compiles hello.c
|
||||
make debug # Compiles hello.c using debug flags
|
||||
make clean # Removes the executable (hello) generated by the make command.
|
||||
```
|
||||
|
||||
## Meson
|
||||
|
||||
While `make` automates compiling, on larger projects, makefiles can grow hard to read quickly, and dependency resolution has to be done using external tools (such as `pkg-config`).
|
||||
|
||||
Meson is a more modern alternative, which is faster, and uses declarative syntax (describe *what* to build, instead of *how* to build it). Meson can automatically manage dependencies, header files, and compiler flags.
|
||||
|
||||
When `meson` is executed, it generates a `ninja.build` file, which is then parsed by `ninja`, a lower-level build tool.
|
||||
|
||||
```meson.build
|
||||
project('hello', 'c')
|
||||
|
||||
gtk4_dep = dependency('gtk4')
|
||||
|
||||
executable('hello', 'hello.c',
|
||||
dependencies: gtk4_dep)
|
||||
```
|
||||
|
||||
```bash
|
||||
mkdir build
|
||||
meson setup build # Generate files for Ninja in the build dir
|
||||
meson compile -C build # Compile the project (same as `ninja -C build`)
|
||||
./build/hello
|
||||
ninja clean -C build # Clean executable files in the build directory
|
||||
```
|
||||
|
||||
@@ -10,29 +10,30 @@ weight: "1"
|
||||
---
|
||||
|
||||
- [Building a Computer From Scratch](../how_to_computer/)
|
||||
- [Operating Systems](../linux/) `Linux`
|
||||
- Shell Scripting `BASH` - `Coming Soon!`
|
||||
- [C](../c-language/)
|
||||
- [Compiling](../compiling/) `Make` `GCC` `Clang`
|
||||
- [Operating System](../linux/) `Linux`
|
||||
- [C Language](../c-language/)
|
||||
- [Algorithms & Data Structures](../algorithms_and_data/)
|
||||
- [Compiling](../compiling/) `GCC` `Make` `Meson`
|
||||
- [Debugging](../gdb/) `GDB`
|
||||
- [Snippets](../c-snippets/)
|
||||
- [Algorithms & Data Structures](../algorithms_and_data/)
|
||||
- Rust Lang - `Coming Soon!`
|
||||
- GUI Apps `GTK4` - `Coming Soon!`
|
||||
- [Python](../python/)
|
||||
- [Flask](../flask/)
|
||||
- [Databases](../databases/) `SQL`
|
||||
- GUI Apps
|
||||
- Object-Oriented C `GObject` - `Coming Soon!`
|
||||
- GUI Toolkit `GTK4` - `Coming Soon!`
|
||||
- Shell Scripting `BASH` - `Coming Soon!`
|
||||
- Networking
|
||||
- [HTTP](../http/) `CURL`
|
||||
- [Encryption](../encryption/) `GPG` `Cryptsetup`
|
||||
- [HTTPS and SSL Certificates](../https-ssl-certs/) `Certbot`
|
||||
- [SSH](../ssh/)
|
||||
- [Firewall](../firewall/) `UFW`
|
||||
- [IRC](../irc/)
|
||||
- [Instant Messaging](../irc/) `IRC`
|
||||
- Web Development
|
||||
- [HTML](../html/)
|
||||
- CSS - `Coming Soon!`
|
||||
- JS - `Coming Soon!`
|
||||
- [Python](../python/)
|
||||
- [Flask](../flask/)
|
||||
- [Databases](../databases/) `SQL`
|
||||
- Tools
|
||||
- [Version Control](../git/) `GIT`
|
||||
- [Password Manager](../pass/) `PASS`
|
||||
|
||||
@@ -204,7 +204,7 @@ The GPU still has a device file, which is used by the Kernel's DRM and Mesa, but
|
||||
|
||||
## Shell (`bash`)
|
||||
|
||||
The kernel by itself isn't intractable, so a shell is needed for the user to be able to execute programs and run commands. Bash is not only a prompt, but also an interpreter for [its own programming language](../bash), which can be used to write scripts and automate tasks.
|
||||
The kernel by itself isn't intractable, so a shell is needed for the user to be able to execute programs and run commands. Bash is not only a prompt, but also an interpreter for its own programming language, which can be used to write scripts and automate tasks.
|
||||
|
||||
### Compiling
|
||||
|
||||
@@ -910,7 +910,7 @@ Then, after the installation finishes, install your preferred desktop environmen
|
||||
|
||||
```bash
|
||||
sudo apt update
|
||||
sudo apt install gnome-core # change to kde-plasma-desktop
|
||||
sudo apt install gnome-core # or kde-plasma-desktop
|
||||
sudo systemctl reboot
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user