commit 487906354dd68d48e0f329237850d004b8a72a4c
parent 664b46d15ccd7e2d89eeefc7b036395749854dcd
Author: William Casarin <jb55@jb55.com>
Date: Sat, 4 Jan 2020 20:07:56 -0800
make: even better tcc support
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
@@ -3,11 +3,11 @@ BIN=bcalc
DEPS=$(wildcard deps/*/*.c) $(GEN)
PREFIX ?= /usr/local
-CFLAGS = -O2 -g -std=c99
+CFLAGS = -O2 -std=c99
SRC = num.c
-DEPS = $(wildcard deps/*/*.c) $(SRC)
-OBJS = $(DEPS:.c=.o) parser.tab.o lex.yy.o
-GEN = parser.tab.c parser.tab.h lex.yy.c $(OBJS)
+DEPS = $(wildcard deps/*/*.c) $(SRC) parser.tab.c lex.yy.c
+OBJS = $(DEPS:.c=.o)
+GEN = parser.tab.c parser.tab.h lex.yy.c $(OBJS) $(BIN)
all: $(BIN)
@@ -29,8 +29,8 @@ check: $(BIN) fake
TAGS: fake
etags -o - *.c > $@
-$(BIN): $(OBJS) bcalc.c num.h
- $(CC) $(CFLAGS) -Ideps -o $@ bcalc.c $(OBJS)
+$(BIN): $(DEPS) bcalc.c
+ $(CC) $(CFLAGS) -Ideps -o $@ $^
clean: fake
rm -f $(GEN)
diff --git a/default.nix b/default.nix
@@ -1,5 +1,6 @@
-{ stdenv, bison, flex }:
+{ nixpkgs ? import <nixpkgs> {} }:
+with nixpkgs;
stdenv.mkDerivation rec {
name = "bcalc";
version = "0.1";
@@ -8,6 +9,7 @@ stdenv.mkDerivation rec {
installFlags = "PREFIX=$(out)";
+ nativeBuildInputs = [ tinycc ];
buildInputs = [ bison flex ];
meta = with stdenv.lib; {