save
This commit is contained in:
57
Makefile
Normal file
57
Makefile
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
prefix=/usr/bin
|
||||||
|
|
||||||
|
YAIT_SRCS=yait/main.c
|
||||||
|
YAIR_DOC_SRCS=yait-doc/main.c
|
||||||
|
|
||||||
|
YAIT_OBJS = $(addprefix obj/yait,$(patsubst yait/%,obj/%,$(patsubst %.c,%.o,$(notdir $(YAIT_SRCS)))))
|
||||||
|
YAIT_DOC_OBJS = $(addprefix obj/yait-doc,$(patsubst yait-doc/%,obj/%,$(patsubst %.c,%.o,$(notdir $(YAIT_DOC_SRCS)))))
|
||||||
|
|
||||||
|
YAIT=$(prefix)/yait
|
||||||
|
YAIT_DOC=$(prefix)/yait-doc
|
||||||
|
|
||||||
|
-include config.mak
|
||||||
|
|
||||||
|
ifeq ($(wildcard config.mak),)
|
||||||
|
all:
|
||||||
|
@echo "File config.mak not found, run configure"
|
||||||
|
@exit 1
|
||||||
|
else
|
||||||
|
|
||||||
|
all: clean obj bin $(YAIT) $(YAIT_DOC)
|
||||||
|
|
||||||
|
obj:
|
||||||
|
mkdir -p $@/yait
|
||||||
|
mkdir -p $@/yait-doc
|
||||||
|
|
||||||
|
bin:
|
||||||
|
mkdir -p $@
|
||||||
|
|
||||||
|
obj/yait/%.o: yait/**/%.c
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
obj/yait-doc/%.o: yait-doc/**/%.c
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
$(YAIT):
|
||||||
|
$(CC) $(YAIT_SCRS) -o ./bin/yait
|
||||||
|
|
||||||
|
$(YAIT_DOC):
|
||||||
|
$(CC) $(YAIT_DOC_SRCS) -o ./bin/yait-doc
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
install:
|
||||||
|
@echo "NOT IMPL"
|
||||||
|
exit 1
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
@echo "NOT IMPL"
|
||||||
|
exit 1
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf obj bin
|
||||||
|
|
||||||
|
dist-clean: clean
|
||||||
|
rm config.mak
|
||||||
|
|
||||||
|
.PHONY: all clean dist-clean install uninstall
|
||||||
5
README
5
README
@@ -2,6 +2,9 @@ yait ( yet another init tool )
|
|||||||
|
|
||||||
yait is designed to allow you to create more side projects; that you will
|
yait is designed to allow you to create more side projects; that you will
|
||||||
definitely complete. This tool will create a new directory containing all
|
definitely complete. This tool will create a new directory containing all
|
||||||
project files needed for your new C ( maybe C++ ) project. It provided you with
|
project files needed for your new C ( maybe C++ ) project. It provides you with
|
||||||
a build system and some basic source files to give you a kick start on your new
|
a build system and some basic source files to give you a kick start on your new
|
||||||
project--with optional libraries!
|
project--with optional libraries!
|
||||||
|
|
||||||
|
For a more in-depth explanation of how to use the tool refer to `--help` or use
|
||||||
|
the doc tool `yait-doc`.
|
||||||
|
|||||||
4
config.mak
Normal file
4
config.mak
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
PREFIX=/usr/bin/
|
||||||
|
CFLAGS=-Wall -Wextra -O2
|
||||||
|
LDFLAGS=
|
||||||
|
CC=gcc
|
||||||
56
configure
vendored
Executable file
56
configure
vendored
Executable file
@@ -0,0 +1,56 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||||
|
|
||||||
|
To assign environment variables (e.g., CC, CFLAGS...), specify them as
|
||||||
|
VAR=VALUE.
|
||||||
|
|
||||||
|
CC C compiler command [detected]
|
||||||
|
CFLAGS C compiler flags [-g, ...]
|
||||||
|
|
||||||
|
EOF
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
echo () { printf "%s\n" "$*" ; }
|
||||||
|
cmdexists () { type "$1" >/dev/null 2>&1 ; }
|
||||||
|
trycc () { test -z "$CC" && cmdexists "$1" && CC=$1 ; }
|
||||||
|
|
||||||
|
prefix=/usr/bin/
|
||||||
|
CFLAGS="-Wall -Wextra -O2"
|
||||||
|
LDFLAGS=
|
||||||
|
CC=
|
||||||
|
|
||||||
|
for arg ; do
|
||||||
|
case "$arg" in
|
||||||
|
--help|h) usage ;;
|
||||||
|
CFLAGS=*) CFLAGS=${arg#*=} ;;
|
||||||
|
LDFLAGS=*) LDFLAGS=${arg#*=} ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
printf "checking for C compiler... "
|
||||||
|
trycc gcc
|
||||||
|
trycc cc
|
||||||
|
trycc clang
|
||||||
|
printf "%s\n" "$CC"
|
||||||
|
|
||||||
|
printf "checking weather C compiler works... "
|
||||||
|
status="fail"
|
||||||
|
tmpc="$(mktemp -d)/test.c"
|
||||||
|
echo "typedef int x;" > "$tmpc"
|
||||||
|
if output=$($CC $CFLAGS -c -o /dev/null "$tmpc" 2>&1) ; then
|
||||||
|
printf "yes\n"
|
||||||
|
else
|
||||||
|
printf "no; %s\n" "$output"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "creating config.mak... "
|
||||||
|
printf "PREFIX=%s\n" "$prefix" > config.mak
|
||||||
|
printf "CFLAGS=%s\n" "$CFLAGS" >> config.mak
|
||||||
|
printf "LDFLAGS=%s\n" "$LDFLAGS" >> config.mak
|
||||||
|
printf "CC=%s\n" "$CC" >> config.mak
|
||||||
|
printf "done\n"
|
||||||
6
yait-doc/main.c
Normal file
6
yait-doc/main.c
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
printf("Hello, Yait-doc!\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
6
yait/main.c
Normal file
6
yait/main.c
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
printf("Hello, Yait!\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user