From b9d1e9c3ebbca4ce417281bf16a4cbeb7e38671e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Dan=C3=B8?= Date: Thu, 12 May 2022 09:52:51 +0200 Subject: [PATCH 1/4] feat; init makefile iteration --- Makefile | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..df89774 --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +CC := gcc +CFLAGS_BENCH := -std=gnu99 -O3 +LFLAGS_BENCH := -lpng +CFLAGS_CONV := -std=c99 -O3 + +TARGET_BENCH := qoibench +TARGET_CONV := qoiconv + +all := $(TARGET) + +$(TARGET_BENCH):$(TARGET_BENCH).c $(LFLAGS_BENCH) + $(CC) $(CFLAGS_BENCH) $(TARGET_BENCH).c -o $(TARGET_BENCH) $(LFLAGS_BENCH) + +$() +$(TARGET_CONV):$(TARGET_CONV).c + $(CC) $(CFLAGS_CONV) $(TARGET_CONV).c -o $(TARGET_CONV) + +.PHONY: clean +clean: + $(RM) $(TARGET) $(OBJS) $(DEPS) +-include $(DEPS) From 9374bd61aec7f4006aad63ddba4766aa04588a8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Dan=C3=B8?= Date: Thu, 12 May 2022 10:07:44 +0200 Subject: [PATCH 2/4] feat; working makefile --- Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index df89774..2e7a0e9 100644 --- a/Makefile +++ b/Makefile @@ -6,16 +6,18 @@ CFLAGS_CONV := -std=c99 -O3 TARGET_BENCH := qoibench TARGET_CONV := qoiconv -all := $(TARGET) +all: $(TARGET_BENCH) $(TARGET_CONV) + +bench: $(TARGET_BENCH) $(TARGET_BENCH):$(TARGET_BENCH).c $(LFLAGS_BENCH) $(CC) $(CFLAGS_BENCH) $(TARGET_BENCH).c -o $(TARGET_BENCH) $(LFLAGS_BENCH) -$() +conv: $(TARGET_CONV) $(TARGET_CONV):$(TARGET_CONV).c $(CC) $(CFLAGS_CONV) $(TARGET_CONV).c -o $(TARGET_CONV) .PHONY: clean clean: - $(RM) $(TARGET) $(OBJS) $(DEPS) + $(RM) $(TARGET_BENCH) $(TARGET_CONV) $(OBJS) $(DEPS) -include $(DEPS) From 06d032339b8fbbd6abe38dab53f48c78a5094f82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Dan=C3=B8?= Date: Thu, 12 May 2022 14:08:51 +0200 Subject: [PATCH 3/4] CC:= -> CC?= and removal of dependency cleaning --- Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 2e7a0e9..0d5c534 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -CC := gcc +CC ?= gcc CFLAGS_BENCH := -std=gnu99 -O3 LFLAGS_BENCH := -lpng CFLAGS_CONV := -std=c99 -O3 @@ -19,5 +19,4 @@ $(TARGET_CONV):$(TARGET_CONV).c .PHONY: clean clean: - $(RM) $(TARGET_BENCH) $(TARGET_CONV) $(OBJS) $(DEPS) --include $(DEPS) + $(RM) $(TARGET_BENCH) $(TARGET_CONV) From 520434351901e0b2d424e716cf0c35f617c0fece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Dan=C3=B8?= Date: Thu, 12 May 2022 14:53:17 +0200 Subject: [PATCH 4/4] Replaced remaining := with ?= to allow CLI parameters --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 0d5c534..b570e8b 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ CC ?= gcc -CFLAGS_BENCH := -std=gnu99 -O3 -LFLAGS_BENCH := -lpng -CFLAGS_CONV := -std=c99 -O3 +CFLAGS_BENCH ?= -std=gnu99 -O3 +LFLAGS_BENCH ?= -lpng +CFLAGS_CONV ?= -std=c99 -O3 -TARGET_BENCH := qoibench -TARGET_CONV := qoiconv +TARGET_BENCH ?= qoibench +TARGET_CONV ?= qoiconv all: $(TARGET_BENCH) $(TARGET_CONV)