diff options
author | Bad Diode <bd@badd10de.dev> | 2022-03-03 08:42:47 +0000 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2022-03-03 08:42:47 +0000 |
commit | d0b2e6376f03ac86087f355c56b5d98262deda6b (patch) | |
tree | 9b87c2c1b14d71aba8dbef0493f4b8367b276093 | |
download | uxnfb-d0b2e6376f03ac86087f355c56b5d98262deda6b.tar.gz uxnfb-d0b2e6376f03ac86087f355c56b5d98262deda6b.zip |
Initial commit
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 36 | ||||
-rw-r--r-- | src/main.c | 7 |
3 files changed, 44 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/.gitignore | |||
@@ -0,0 +1 @@ | |||
build | |||
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..53d756b --- /dev/null +++ b/Makefile | |||
@@ -0,0 +1,36 @@ | |||
1 | SRC_DIR ?= src | ||
2 | BUILD_DIR ?= build | ||
3 | SRC_MAIN ?= $(SRC_DIR)/main.c | ||
4 | EXE_NAME ?= fbtest | ||
5 | BIN := $(BUILD_DIR)/$(EXE_NAME) | ||
6 | |||
7 | CC ?= cc | ||
8 | CFLAGS := -Wall -Wextra -pedantic | ||
9 | |||
10 | REL_FLAGS := -DNDEBUG -O2 | ||
11 | DEB_FLAGS := -DDEBUG -O0 -g | ||
12 | |||
13 | DEBUG ?= 0 | ||
14 | ifeq ($(DEBUG), 1) | ||
15 | CFLAGS += $(DEB_FLAGS) | ||
16 | else ifeq ($(DEBUG), 2) | ||
17 | CFLAGS += $(DEB_FLAGS) -fsanitize=address | ||
18 | else | ||
19 | CFLAGS += $(REL_FLAGS) | ||
20 | endif | ||
21 | |||
22 | .PHONY: build run clean | ||
23 | |||
24 | main: $(BIN) | ||
25 | |||
26 | $(BIN): $(SRC_MAIN) $(BUILD_DIR) | ||
27 | $(CC) $(CFLAGS) -o $(BIN) $(SRC_MAIN) | ||
28 | |||
29 | $(BUILD_DIR): | ||
30 | mkdir -p $(BUILD_DIR) | ||
31 | |||
32 | run: $(BIN) | ||
33 | ./$(BIN) | ||
34 | |||
35 | clean: | ||
36 | rm -rf $(BUILD_DIR) | ||
diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..e08dc19 --- /dev/null +++ b/src/main.c | |||
@@ -0,0 +1,7 @@ | |||
1 | #include<stdio.h> | ||
2 | |||
3 | int | ||
4 | main(void) { | ||
5 | printf("hello world\n"); | ||
6 | return 0; | ||
7 | } | ||