Skip to content

Commit 1357f54

Browse files
committed
Update Makefile
1 parent 1b251e6 commit 1357f54

File tree

3 files changed

+28
-20
lines changed

3 files changed

+28
-20
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Module.symvers
5151
Mkfile.old
5252
dkms.conf
5353

54+
build/
5455
output.*.png
5556
.cache/
5657

Makefile

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,32 @@
1-
BUILD_DIR=build/
1+
CC=gcc
2+
CFLAGS=-Isrc/ -Iinclude/ -std=c99 -Wall -MMD -MP -O0 -g
3+
LFLAGS=-lm
4+
BUILD=build
5+
BIN=$(BUILD)/imgc
26

3-
gen:
4-
@meson setup $(BUILD_DIR) -Db_sanitize=address,undefined
7+
SOURCES=src/main.c src/blend.c src/image.c src/impl.c
8+
OBJECTS=$(SOURCES:.c=.c.o)
9+
OBJECTS:=$(patsubst %,$(BUILD)/%,$(OBJECTS))
10+
DEPENDS=$(OBJECTS:.o=.d)
511

6-
all:
7-
@ninja -C $(BUILD_DIR)
12+
-include $(DEPENDS)
13+
14+
all: $(BIN)
15+
16+
$(BUILD)/%.c.o: %.c
17+
@echo "CC -" $<
18+
@mkdir -p "$$(dirname "$@")"
19+
@$(CC) $(CFLAGS) -c $< -o $@
20+
21+
$(BIN): $(OBJECTS)
22+
@echo "LD -" $@
23+
@$(CXX) $(LFLAGS) $(OBJECTS) -o $@
24+
25+
.PHONY: clean
26+
27+
clean:
28+
@$(RM) -rv $(BIN) $(BUILD)
829

930
run: all
10-
@./build/imgc
31+
@$(BIN)
1132

meson.build

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)