Files
cros-libc/test-makefile
2024-05-28 14:50:00 -05:00

30 lines
530 B
Plaintext

#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