GNU make to uncompress and compile?
Hi all!
I'm just getting started with Unix, C and somebody suggested me to use GNU make too. So I thought of doing that.
One thing I tried to do is to uncompress a .gtz file and compile the C files inside it with few flags on. Here's my code if you don't laugh.
What I'm trying to do here is to uncompress lab.tgz file and compile the C source files inside it.
Code:
CC=gcc
FLAGS=-l./-O3 -Wall -c
all:
tar -xzvf lab.tgz
cd lab
CFILES = $(shell ls /lab | grep .c)
OBJS = $(CFILES:%.c=%.o)
main : $(OBJS)
$(CC) $(FLAGS) $(OBJS) -o main
$(OBJS):$(CFILES)
$(CC) $(FLAGS) $(OBJS)
Obviously, this is not working. I want the assignments
to be executed before
Code:
CFILES = $(shell ls /lab | grep .c)
But the second one executed earlier and complains that /lab does not exist. I'll be really thankful if somebody help me with this.
Thanks