1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-24 15:30:27 +00:00
This commit is contained in:
Calvin Rose 2018-08-07 00:57:32 -04:00
commit 77344b3f79
4 changed files with 65 additions and 31 deletions

41
lib/colors.dst Normal file
View File

@ -0,0 +1,41 @@
# Ansi terminal colors
(def- colormap
{:black 30
:bg-black 40
:red 31
:bg-red 41
:green 32
:bg-green 42
:yellow 33
:bg-yellow 43
:blue 34
:bg-blue 44
:magenta 35
:bg-magenta 45
:cyan 36
:bg-cyan 46
:white 37
:bg-white 47
:bright-black 90
:bg-bright-black 100
:bright-red 91
:bg-bright-red 101
:bright-green 92
:bg-bright-green 102
:bright-yellow 93
:bg-bright-yellow 103
:bright-blue 94
:bg-bright-blue 104
:bright-magenta 95
:bg-bright-magenta 105
:bright-cyan 96
:bg-bright-cyan 106
:bright-white 97
:bg-bright-white 107})
(loop [[name color] :in (pairs colormap)]
(defglobal (string.slice name 1)
(fn color-wrapper [& pieces]
(string "\e[" color "m" (apply1 string pieces) "\e[0m"))))

View File

@ -46,6 +46,7 @@
(emit-rule out "%.o" @["%.c" "${HEADERS}"] "${CC} ${CFLAGS} -o $@ $< ${LDFLAGS}")
(emit-rule out "${TARGET}" "${OBJECTS}" "${CC} ${CFLAGS} -o $@ $^ ${LDFLAGS}")
(emit-rule out "clean" "" "rm ${OBJECTS}")
(emit-rule out "clean" "" @["rm ${OBJECTS}" "rm @{TARGET}"])
# Phony targets
(emit-rule out ".PHONY" @["all" "clean"])
nil)

View File

@ -1,37 +1,24 @@
# Copyright (c) 2018 Calvin Rose
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
# Autogenerated Makefile, do not edit
# Generated at Fri Aug 3 22:55:50 EDT 2018
CFLAGS=-std=c99 -Wall -Wextra -I../../src/include -O2
TARGET=hello.so
CFLAGS:=-std=c99 -Wall -Wextra -O2 -shared -fpic
LDFLAGS:=
SOURCES:=main.c
HEADERS:=
OBJECTS:=$(patsubst %.c,%.o,${SOURCES})
TARGET:=hello.so
UNAME:=$(shell uname -s)
ifeq ($(UNAME), Darwin)
CFLAGS:=$(CFLAGS) -undefined dynamic_lookup
endif
all: ${TARGET}
SOURCES=main.c
%.o: %.c ${HEADERS}
${CC} ${CFLAGS} -o $@ -c $< ${LDFLAGS}
$(TARGET): $(SOURCES)
$(CC) $(CFLAGS) -shared -fpic -o $@ $<
${TARGET}: ${OBJECTS}
${CC} ${CFLAGS} -o $@ $^ ${LDFLAGS}
clean:
rm $(TARGET)
clean:
rm ${OBJECTS}
rm ${TARGET}
.PHONY: all clean
.PHONY: clean

5
natives/hello/metab.dst Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env dst
(import metabuild :as mb)
(mb.generate "hello" @["main.c"])