-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
26 lines (23 loc) · 851 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
include ./config.mk
CFLAGS = -O2
DEBUGFLAGS = -Wall -Wextra -Wpedantic
SRCFILES = $(wildcard ./src/*.c)
TESTFILES = $(wildcard ./test/*.c)
OBJFILES = $(SRCFILES:.c=.o)
compile: $(SRCFILES)
ifeq ($(IS_DYNAMIC), false)
$(CC) $(DEBUGFLAGS) $(CFLAGS) -c $(SRCFILES) -o $(OBJFILES)
$(AR) rcs libcute.a $(OBJFILES)
else ifeq ($(IS_DYNAMIC), true)
$(CC) $(DEBUGFLAGS) $(CFLAGS) -fPIC -c $(SRCFILES) -o $(OBJFILES)
$(CC) $(CFLAGS) -shared -o libcute.so $(OBJFILES)
endif
test: compile
ifeq ($(IS_DYNAMIC), true)
@echo -e "\n-------------------------------\nBe sure to set \$LD_LIBRARY_PATH to this current directory\n-----------------------------------\n"
endif
$(CC) $(CFLAGS) -c $(TESTFILES) -o $(TESTFILES:.c=.o)
$(CC) $(CFLAGS) -o main $(TESTFILES:.c=.o) -L. -lcute
./main
clean:
rm -f $(OBJFILES) $(TESTFILES:.c=.o) main libcute.a libcute.so