From e215b283f4fa9576fa1d47af44ebb40ccbd537b9 Mon Sep 17 00:00:00 2001 From: "Begerad, Stefan" Date: Tue, 3 Jan 2023 15:44:54 +0100 Subject: [PATCH] feat: add sleep --- sleep/main.c | 17 +++++++++++++++++ sleep/makefile | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 sleep/main.c create mode 100644 sleep/makefile diff --git a/sleep/main.c b/sleep/main.c new file mode 100644 index 0000000..5788c7d --- /dev/null +++ b/sleep/main.c @@ -0,0 +1,17 @@ +/*use sleep*/ +#include + +/*use printf*/ +#include + +int main() +{ + printf("main() Started...\n"); + while(1) + { + printf("main() blub\n"); + sleep(1); + } + printf("main() Done.\n"); + return 0; +} diff --git a/sleep/makefile b/sleep/makefile new file mode 100644 index 0000000..4cadb15 --- /dev/null +++ b/sleep/makefile @@ -0,0 +1,33 @@ +# Source, Executable, Includes, Library Defines +INCL = +SRC = main.c +OBJ = $(SRC:.c=.o) +LIBS = +EXE = sleep + +# Compiler, Linker Defines +CC = /usr/bin/gcc +CFLAGS = -ansi -pedantic -Wall -O2 +LIBPATH = -L. +LDFLAGS = -o $(EXE) $(LIBPATH) $(LIBS) +CFDEBUG = -ansi -pedantic -Wall -g -DDEBUG $(LDFLAGS) +RM = /bin/rm -f + +# Compile and Assemble C Source Files into Object Files +%.o: %.c + $(CC) -c $(CFLAGS) $*.c + +# Link all Object Files with external Libraries into Binaries +$(EXE): $(OBJ) + $(CC) $(LDFLAGS) $(OBJ) + +# Objects depend on these Libraries +$(OBJ): $(INCL) + +# Create a gdb/dbx Capable Executable with DEBUG flags turned on +debug: + $(CC) $(CFDEBUG) $(SRC) + +# Clean Up Objects, Exectuables, Dumps out of source directory +clean: + $(RM) $(OBJ) $(EXE) core a.out *.csv