Commit 37e73d6a authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

test: Add test-counter test

Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@gmail.com>
parent af4eb76b
SRCS += test-counter.c
OBJS := $(patsubst %.c,%.o,$(SRCS))
PROGS := $(patsubst %.c,%,$(SRCS))
all: $(PROGS)
$(PROGS): $(OBJS)
$(E) " LINK " $@
$(Q) $(CC) $< -o $@
%.o: %.c
$(E) " CC " $@
$(Q) $(CC) -c $(CFLAGS) $< -o $@
clean:
$(Q) $(RM) -f ./*.o
$(Q) $(RM) -f ./$(PROGS)
.PHONY: clean
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
int main(int argc, char *argv[])
{
int counter = 0;
while (1) {
printf("Pid: %10d Counter: %10d\n",
getpid(), counter++);
sleep(3);
}
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment