From e1f5bea9820a9d24a981d8886387f12456c6f560 Mon Sep 17 00:00:00 2001 From: halosghost Date: Mon, 3 Feb 2020 23:32:25 -0600 Subject: [PATCH 1/2] (#122) Support building with tcc - replace ``mpc.h`` with ``$(PROJ).h`` - ``filter-out`` ``$(PROJ).h`` when building examples - expose ``$(STD)`` --- Makefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 50b1ba3..435f0f2 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ PROJ = mpc CC ?= gcc -STND = -ansi +STD ?= -ansi DIST = build MKDIR ?= mkdir -p PREFIX ?= /usr/local -CFLAGS ?= $(STND) -pedantic -O3 -g -Wall -Werror -Wextra -Wformat=2 -Wshadow \ +CFLAGS ?= $(STD) -pedantic -O3 -g -Wall -Werror -Wextra -Wformat=2 -Wshadow \ -Wno-long-long -Wno-overlength-strings -Wno-format-nonliteral -Wcast-align \ -Wwrite-strings -Wstrict-prototypes -Wold-style-definition -Wredundant-decls \ -Wnested-externs -Wmissing-include-dirs -Wswitch-default @@ -25,26 +25,26 @@ check: $(DIST)/test-file $(DIST)/test-static $(DIST)/test-dynamic ./$(DIST)/test-static LD_LIBRARY_PATH=$(DIST) ./$(DIST)/test-dynamic -$(DIST)/test-file: $(TESTS) $(PROJ).c mpc.h tests/ptest.h +$(DIST)/test-file: $(TESTS) $(PROJ).c $(PROJ).h tests/ptest.h $(CC) $(filter-out -Werror, $(CFLAGS)) $(TESTS) $(PROJ).c -lm -o $(DIST)/test-file -$(DIST)/test-dynamic: $(TESTS) $(DIST)/lib$(PROJ).so mpc.h tests/ptest.h +$(DIST)/test-dynamic: $(TESTS) $(DIST)/lib$(PROJ).so $(PROJ).h tests/ptest.h $(CC) $(filter-out -Werror, $(CFLAGS)) $(TESTS) -lm -L$(DIST) -l$(PROJ) -o $(DIST)/test-dynamic -$(DIST)/test-static: $(TESTS) $(DIST)/lib$(PROJ).a mpc.h tests/ptest.h +$(DIST)/test-static: $(TESTS) $(DIST)/lib$(PROJ).a $(PROJ).h tests/ptest.h $(CC) $(filter-out -Werror, $(CFLAGS)) $(TESTS) -lm -L$(DIST) -l$(PROJ) -static -o $(DIST)/test-static -examples/%: $(DIST) examples/%.c $(PROJ).c mpc.h - $(CC) $(CFLAGS) $(filter-out $(DIST), $^) -lm -o $(DIST)/$@ +examples/%: $(DIST) examples/%.c $(PROJ).c $(PROJ).h + $(CC) $(CFLAGS) $(filter-out $(DIST) $(PROJ).h, $^) -lm -o $(DIST)/$@ -$(DIST)/lib$(PROJ).so: $(PROJ).c mpc.h +$(DIST)/lib$(PROJ).so: $(PROJ).c $(PROJ).h ifneq ($(OS),Windows_NT) $(CC) $(CFLAGS) -fPIC -shared $(PROJ).c -o $(DIST)/lib$(PROJ).so else $(CC) $(CFLAGS) -shared $(PROJ).c -o $(DIST)/lib$(PROJ).so endif -$(DIST)/lib$(PROJ).a: $(PROJ).c mpc.h +$(DIST)/lib$(PROJ).a: $(PROJ).c $(PROJ).h $(CC) $(CFLAGS) -c $(PROJ).c -o $(DIST)/$(PROJ).o $(AR) rcs $(DIST)/lib$(PROJ).a $(DIST)/$(PROJ).o From 7869e2087ec25f808dca74d451af5c0e45c8b618 Mon Sep 17 00:00:00 2001 From: halosghost Date: Mon, 3 Feb 2020 23:39:35 -0600 Subject: [PATCH 2/2] (closes #122) add ^M to end of line_reader example --- examples/line_reader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/line_reader.c b/examples/line_reader.c index 1354d42..48d01be 100644 --- a/examples/line_reader.c +++ b/examples/line_reader.c @@ -31,4 +31,4 @@ int main(int argc, char **argv) { mpc_delete(Line); return 0; -} \ No newline at end of file +}