New repo setup
This commit is contained in:
29
test-makefile
Normal file
29
test-makefile
Normal file
@@ -0,0 +1,29 @@
|
||||
#Compiler settings
|
||||
CC = gcc
|
||||
CFLAGS = -g -Wall -Werror -std=c11
|
||||
LDFLAGS =
|
||||
|
||||
#Directories
|
||||
SRCDIR = src
|
||||
INCDIR = include
|
||||
|
||||
#Create executable file
|
||||
program: main.o math.o
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
#Create Main object file
|
||||
main.o: main.c $(INCDIR)/math.h
|
||||
$(CC) $(CFLAGS) -I$(INCDIR) -c $< -o $@
|
||||
|
||||
#Create Math object file
|
||||
math.o: $(SRCDIR)/math.c $(INCDIR)/math.h
|
||||
$(CC) $(CFLAGS) -I$(INCDIR) -c $< -o $@
|
||||
|
||||
#Remove all executable and object files
|
||||
clean:
|
||||
rm -f *.o program
|
||||
|
||||
#Run Main executable file
|
||||
exec: program
|
||||
./program
|
||||
|
||||
Reference in New Issue
Block a user