-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (41 loc) · 1.05 KB
/
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
CXX = gcc
CFLAGS = -Wall -Werror -Wextra -pedantic
LIBSDIR = -L.
INCLUDEDIR = -I.
DEBUG ?= 0 # can be changed on the command line
ifeq ($(DEBUG), 1)
CFLAGS += -ggdb
CFLAGS += -DDEBUG
endif
LIBCORENAME = boggle
ifeq ($(OS), Windows_NT)
EXPORT = export.bat
LIBTARGET :=$(LIBCORENAME:=.dll)
CLEANCMD = @del /q *.o *.so *.exe *.dll
else
CFLAGS += -fpic
EXPORT = sh export.sh
LIBTARGET := lib$(LIBCORENAME:=.so)
CLEANCMD = rm -rf *.o *.so *.exe *.dll
LIBSDIR += -L/usr/lib
INCLUDEDIR += -I/usr/include
endif
LIBSOURCE = gui grid game save
LIBSOURCECFILE = $(LIBSOURCE:=.c)
LIBSOURCEOFILE = $(LIBSOURCE:=.o)
EXESOURCE = main
TARGET = $(EXESOURCE:=.exe)
EXESOURCECFILE = $(EXESOURCE:=.c)
EXESOURCEOFILE = $(EXESOURCE:=.o)
all: $(TARGET)
run: $(TARGET)
$(EXPORT) $(TARGET)
$(TARGET): $(EXESOURCEOFILE) $(LIBTARGET)
$(CXX) $(EXESOURCEOFILE) -l$(LIBCORENAME) $(LIBSDIR) -o $(TARGET) -lm
$(LIBTARGET): $(LIBSOURCEOFILE)
$(CXX) $(CFLAGS) -shared $(LIBSOURCEOFILE) -o $(LIBTARGET)
.c.o:
$(CXX) $(CFLAGS) $(INCLUDEDIR) -c -o $@ $<
clean:
$(CLEANCMD)
@echo CLEAN