aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2022-03-03 08:42:47 +0000
committerBad Diode <bd@badd10de.dev>2022-03-03 08:42:47 +0000
commitd0b2e6376f03ac86087f355c56b5d98262deda6b (patch)
tree9b87c2c1b14d71aba8dbef0493f4b8367b276093
downloaduxnfb-d0b2e6376f03ac86087f355c56b5d98262deda6b.tar.gz
uxnfb-d0b2e6376f03ac86087f355c56b5d98262deda6b.zip
Initial commit
-rw-r--r--.gitignore1
-rw-r--r--Makefile36
-rw-r--r--src/main.c7
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 @@
1SRC_DIR ?= src
2BUILD_DIR ?= build
3SRC_MAIN ?= $(SRC_DIR)/main.c
4EXE_NAME ?= fbtest
5BIN := $(BUILD_DIR)/$(EXE_NAME)
6
7CC ?= cc
8CFLAGS := -Wall -Wextra -pedantic
9
10REL_FLAGS := -DNDEBUG -O2
11DEB_FLAGS := -DDEBUG -O0 -g
12
13DEBUG ?= 0
14ifeq ($(DEBUG), 1)
15 CFLAGS += $(DEB_FLAGS)
16else ifeq ($(DEBUG), 2)
17 CFLAGS += $(DEB_FLAGS) -fsanitize=address
18else
19 CFLAGS += $(REL_FLAGS)
20endif
21
22.PHONY: build run clean
23
24main: $(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
32run: $(BIN)
33 ./$(BIN)
34
35clean:
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
3int
4main(void) {
5 printf("hello world\n");
6 return 0;
7}