diff options
author | salaaad2 <arthurdurant263@gmail.com> | 2022-03-31 22:57:06 +0200 |
---|---|---|
committer | salaaad2 <arthurdurant263@gmail.com> | 2022-03-31 22:57:06 +0200 |
commit | ad9bf788be5dedfc001ceae51512827596a0af04 (patch) | |
tree | 3c1863e126893c47bbf5ce958324f5acda9a30a1 | |
download | smith-ad9bf788be5dedfc001ceae51512827596a0af04.tar.gz smith-ad9bf788be5dedfc001ceae51512827596a0af04.tar.bz2 smith-ad9bf788be5dedfc001ceae51512827596a0af04.tar.xz smith-ad9bf788be5dedfc001ceae51512827596a0af04.tar.zst smith-ad9bf788be5dedfc001ceae51512827596a0af04.zip |
mrsmith_v0.0.1
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | Makefile | 80 | ||||
-rw-r--r-- | csrc/smith.c | 15 | ||||
-rw-r--r-- | csrc/smith.h | 6 | ||||
-rw-r--r-- | go.mod | 5 | ||||
-rw-r--r-- | main.go | 24 |
6 files changed, 137 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4d7c973 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.DS_Store +.idea +*.log +tmp/ +csrc/obj +libsmith.a +go.sum diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6119205 --- /dev/null +++ b/Makefile @@ -0,0 +1,80 @@ +#==============================================================================# +# SMITH ( // +# Makefile ( )/ +# by salade )(/ +# ________________ ( /) +# ()__)____________))))) :^} +#==============================================================================# +# smith c/go makefile +# @version 0.1 +# +default: all + +#==============================================================================# +#--------------------------------- SHELL --------------------------------------# +#==============================================================================# +SHELL := /bin/sh +OS = $(shell uname) + +#==============================================================================# +#------------------------------ DIRECTORIES -----------------------------------# +#==============================================================================# +C_DIR = csrc/ +SRCS_DIR = ${C_DIR} +INCS_DIR = ${C_DIR} +OBJS_DIR = ${C_DIR}obj/ +OUT_DIR = ./ +#==============================================================================# +#------------------------------ FILES -----------------------------------------# +#==============================================================================# +SRCS_NAME = smith +#------------------------------------------------------------------------------# +SRCS = $(addprefix ${SRCS_DIR}, $(addsuffix .c, ${SRCS_NAME})) +#------------------------------------------------------------------------------# +INCS_NAME = smith +#------------------------------------------------------------------------------# +INCS = $(addprefix ${INCS_DIR}, $(addsuffix .h, ${INCS_NAME})) +#------------------------------------------------------------------------------# +OBJS = $(patsubst ${SRCS_DIR}%.c,${OBJS_DIR}%.o,${SRCS}) + +#==============================================================================# +#------------------------------ TARGETS ---------------------------------------# +#==============================================================================# +C_NAME = libsmith.a +NAME = smith +CC = clang +GO = go +#------------------------------------------------------------------------------# +CFLAGS = -O2 +CFLAGS += -Wall -Werror -Wextra -pedantic +CFLAGS += -finline -pipe + +#==============================================================================# +#------------------------------ C TARGET --------------------------------------# +#==============================================================================# +LDFLAGS = -O2 -pipe -pedantic +#------------------------------------------------------------------------------# +${OBJS_DIR}%.o: ${SRCS_DIR}%.c ${INCS} + ${CC} -c ${CFLAGS} ${CDEFS} -o $@ $< +#------------------------------------------------------------------------------# +${OBJS_DIR}: + mkdir -p ${OBJS_DIR} +#------------------------------------------------------------------------------# +${C_NAME}: ${OBJS_DIR} ${OBJS} ${INCS} + ar rcs ${OUT_DIR}${C_NAME} ${OBJS} + +#==============================================================================# +#------------------------------ ALL -------------------------------------------# +#==============================================================================# +#------------------------------------------------------------------------------# +all: ${C_NAME} + go build +#------------------------------------------------------------------------------# +clean: + rm -rvf ${OBJS_DIR} ${OUT_DIR}${NAME} +#------------------------------------------------------------------------------# +fclean: clean + go clean +#------------------------------------------------------------------------------# +# end :^} +#------------------------------------------------------------------------------# diff --git a/csrc/smith.c b/csrc/smith.c new file mode 100644 index 0000000..4ff5553 --- /dev/null +++ b/csrc/smith.c @@ -0,0 +1,15 @@ +/*********************************/ +/* SMITH ( // */ +/* smith ( )/ */ +/* by salade )(/ */ +/* ________________ ( /) */ +/* ()__)____________))))) :^} */ +/*********************************/ + +#include "smith.h" + +char * +mr_smith() +{ + return ("---SMITH_V0.0.0---"); +} diff --git a/csrc/smith.h b/csrc/smith.h new file mode 100644 index 0000000..b342e54 --- /dev/null +++ b/csrc/smith.h @@ -0,0 +1,6 @@ +#ifndef SMITH_H_ +#define SMITH_H_ + +char * mr_smith(); + +#endif // SMITH_H_ @@ -0,0 +1,5 @@ +module smith + +go 1.16 + +require github.com/rivo/tview v0.0.0-20220307222120-9994674d60a8 // indirect @@ -0,0 +1,24 @@ +// SMITH ( // / +// main ( )/ / +// by salade )(/ / +// ________________ ( /) / +// ()__)____________))))) :^} / + +package main + +import ( + "github.com/rivo/tview" +) + +// #include "csrc/smith.h" +// #cgo LDFLAGS: -lsmith -L. +import "C" + +func main() { + ctogo := C.mr_smith() + box := tview.NewBox().SetBorder(true).SetTitle(C.GoString(ctogo)) + + if err := tview.NewApplication().SetRoot(box, true).Run(); err != nil { + panic(err) + } +} |