feat: add sleep
This commit is contained in:
parent
87ff9a2bf1
commit
e215b283f4
|
@ -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;
|
||||||
|
}
|
|
@ -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
|
Loading…
Reference in New Issue