Executing shell cmd inside makefile
by barunparichha from LinuxQuestions.org on (#4Y1VE)
I am building start.c and test.c inside Makefile.
Requirment:
Building of test.c should start, if executable(start) returns 1.
But I am not getting string "Start", from executable start.
So probably Makefile is not executing start.
Makefile:
Code:CC = gcc
CFLAGS = -g
RM = rm -f
TRG=test
ST=start
all: $(TRG) $(ST)
echo "hello"
$(TARGET): $(TRG) $(ST)
$(ST):
$(CC) $(CFLAGS) -o $(ST) $(ST).c
sh `$(./$(ST))`
$(TRG):
$(CC) $(CFLAGS) -o $(TRG) $(TRG).c
clean: $(TRG) $(ST)
$(RM) $(TRG) $(TRG).o
$(RM) $(ST) $(ST).ostart.c:
Code:#include<stdio.h>
int main()
{
printf("\nStart");
return 1;
}Output of make:
Code:gcc -g -o test test.c
gcc -g -o start start.c
sh ``


Requirment:
Building of test.c should start, if executable(start) returns 1.
But I am not getting string "Start", from executable start.
So probably Makefile is not executing start.
Makefile:
Code:CC = gcc
CFLAGS = -g
RM = rm -f
TRG=test
ST=start
all: $(TRG) $(ST)
echo "hello"
$(TARGET): $(TRG) $(ST)
$(ST):
$(CC) $(CFLAGS) -o $(ST) $(ST).c
sh `$(./$(ST))`
$(TRG):
$(CC) $(CFLAGS) -o $(TRG) $(TRG).c
clean: $(TRG) $(ST)
$(RM) $(TRG) $(TRG).o
$(RM) $(ST) $(ST).ostart.c:
Code:#include<stdio.h>
int main()
{
printf("\nStart");
return 1;
}Output of make:
Code:gcc -g -o test test.c
gcc -g -o start start.c
sh ``