mirror of
https://github.com/ioacademy-jikim/debugging
synced 2026-08-21 13:22:54 +00:00
first commit
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
// foo.c
|
||||
#include <stdio.h>
|
||||
#include <mylib.h>
|
||||
|
||||
void foo()
|
||||
{
|
||||
printf("foo\n");
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
// goo.c
|
||||
#include <stdio.h>
|
||||
#include <mylib.h>
|
||||
|
||||
void goo()
|
||||
{
|
||||
printf("goo\n");
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,16 @@
|
||||
TLIB=mylib.a
|
||||
OBJS=foo.o goo.o
|
||||
CC=cc
|
||||
INCPATH=.
|
||||
CFLAGS=-Wall -I$(INCPATH)
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
|
||||
$(TLIB): $(OBJS)
|
||||
ar cr $(TLIB) $(OBJS)
|
||||
|
||||
$(OBJS): $(INCPATH)/mylib.h
|
||||
|
||||
cleanall:
|
||||
-rm -f *.o *.a
|
||||
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
// mylib.h
|
||||
|
||||
void foo();
|
||||
void goo();
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,10 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <mylib.h>
|
||||
|
||||
int main (int arg, char *argv[])
|
||||
{
|
||||
foo();
|
||||
goo();
|
||||
return 0;
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,16 @@
|
||||
OBJS=main.o
|
||||
CC=cc
|
||||
INCLIB=../MYLIB
|
||||
LIBS=$(INCLIB)/mylib.a
|
||||
CFLAGS=-Wall -I. -I$(INCLIB)
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
|
||||
app: $(OBJS) $(LIBS)
|
||||
$(CC) $(CFLAGS) -o app $(OBJS) $(LIBS)
|
||||
|
||||
$(OBJS): $(INCLIB)/mylib.h
|
||||
|
||||
cleanall:
|
||||
-rm -f *.o app
|
||||
@@ -0,0 +1,29 @@
|
||||
# MYLIB 안에 makefile을 수행하고 application 안에 makefile 수행..
|
||||
|
||||
COND1=`stat app 2>/dev/null | grep Modify`
|
||||
COND2=`stat ./application/app 2>/dev/null | grep Modify`
|
||||
|
||||
all: buildall getexec
|
||||
|
||||
buildall:
|
||||
@echo "****** Invoking MYLIB/makefile"
|
||||
(cd MYLIB; $(MAKE))
|
||||
@echo "****** Invoking application/makefile"
|
||||
(cd application; $(MAKE))
|
||||
|
||||
getexec:
|
||||
@if [ "$(COND1)" != "$(COND2)" ];\
|
||||
then\
|
||||
echo "Getting new app!";\
|
||||
cp -p ./application/app . 2>/dev/null;\
|
||||
chmod 700 app;\
|
||||
else\
|
||||
echo "Nothing done!";\
|
||||
fi
|
||||
|
||||
cleanall:
|
||||
-rm -f app
|
||||
@echo "****** Invoking MYLIB/makefile"
|
||||
@(cd MYLIB; $(MAKE) cleanall)
|
||||
@echo "****** Invoking appl/makefile"
|
||||
@(cd application; $(MAKE) cleanall)
|
||||
Reference in New Issue
Block a user