added t1 t2 and readme
This commit is contained in:
1
trial2/include/hellomake.h
Normal file
1
trial2/include/hellomake.h
Normal file
@@ -0,0 +1 @@
|
||||
void myPrintHelloMake(void);
|
||||
9
trial2/src/hellofunc.c
Normal file
9
trial2/src/hellofunc.c
Normal file
@@ -0,0 +1,9 @@
|
||||
#include <stdio.h>
|
||||
#include <hellomake.h>
|
||||
|
||||
void myPrintHelloMake(void) {
|
||||
|
||||
printf("Hello makefiles!\n");
|
||||
|
||||
return;
|
||||
}
|
||||
BIN
trial2/src/hellomake
Normal file
BIN
trial2/src/hellomake
Normal file
Binary file not shown.
8
trial2/src/hellomake.c
Normal file
8
trial2/src/hellomake.c
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <hellomake.h>
|
||||
|
||||
int main() {
|
||||
// call a function in another file
|
||||
myPrintHelloMake();
|
||||
|
||||
return(0);
|
||||
}
|
||||
26
trial2/src/makefile
Normal file
26
trial2/src/makefile
Normal file
@@ -0,0 +1,26 @@
|
||||
IDIR =../include
|
||||
CC=gcc
|
||||
CFLAGS=-I$(IDIR)
|
||||
|
||||
ODIR=obj
|
||||
LDIR =../lib
|
||||
|
||||
LIBS=-lm
|
||||
|
||||
_DEPS = hellomake.h
|
||||
DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS))
|
||||
|
||||
_OBJ = hellomake.o hellofunc.o
|
||||
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))
|
||||
|
||||
|
||||
$(ODIR)/%.o: %.c $(DEPS)
|
||||
$(CC) -c -o $@ $< $(CFLAGS)
|
||||
|
||||
hellomake: $(OBJ)
|
||||
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
clean:
|
||||
rm -f $(ODIR)/*.o *~ core $(INCDIR)/*~
|
||||
BIN
trial2/src/obj/hellofunc.o
Normal file
BIN
trial2/src/obj/hellofunc.o
Normal file
Binary file not shown.
BIN
trial2/src/obj/hellomake.o
Normal file
BIN
trial2/src/obj/hellomake.o
Normal file
Binary file not shown.
Reference in New Issue
Block a user