Permalink
Browse files

var

  • Loading branch information...
1 parent 16fc4e6 commit 01d9e1199d69d1cf77d0709440a49aaf9809dcac @dlinyj committed Oct 6, 2016
Showing with 18 additions and 8 deletions.
  1. +10 −3 var/Makefile
  2. +6 −0 var/print_count.c
  3. +1 −0 var/print_count.h
  4. +1 −5 var/var.c
View
@@ -1,8 +1,15 @@
# Makefile for Hello World project
#
-abort: var.c
- gcc -o var -g var.c
+all: var
+
+var: var.o print_count.o
+ gcc -o var -g var.o print_count.o
+
+print_count.o: print_count.c print_count.h
+ gcc -c -g print_count.c
+
+var.o: var.c print_count.h
+ gcc -c -g var.c
clean:
rm -f *.o var
-
View
@@ -0,0 +1,6 @@
+#include <stdio.h>
+#include "print_count.h"
+
+void print_count(int count) {
+ printf("count=%d\n", count);
+}
View
@@ -0,0 +1 @@
+void print_count(int count);
View
@@ -3,10 +3,8 @@
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
+#include "print_count.h"
-void print_count(int count) {
- printf("count=%d\n", count);
-}
int print_var (int var){
static int count=0;
@@ -30,5 +28,3 @@ int main(int argc, char * argv[])
print_var(var);
return 0;
}
-
-//

0 comments on commit 01d9e11

Please sign in to comment.