feat: add sleep

This commit is contained in:
dancingCycle 2023-01-03 15:44:54 +01:00
parent 87ff9a2bf1
commit e215b283f4
2 changed files with 50 additions and 0 deletions

17
sleep/main.c Normal file
View File

@ -0,0 +1,17 @@
/*use sleep*/
#include <unistd.h>
/*use printf*/
#include <stdio.h>
int main()
{
printf("main() Started...\n");
while(1)
{
printf("main() blub\n");
sleep(1);
}
printf("main() Done.\n");
return 0;
}

33
sleep/makefile Normal file
View File

@ -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