-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
39 lines (30 loc) · 916 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
27
28
29
30
31
32
33
34
35
36
37
38
39
BUILDDIR ?= .
SUBDIRS = src
# Default GNU tool chain options
CFLAGS += -c -O2 -Wall -I"$(CURDIR)/include" -o
LDFLAGS += -o
EXESUFFIX ?=
LIBSUFFIX ?= .a
INSTALLDIR ?= /usr/local/bin
# Detect Watcom compiler
ifneq (,$(findstring wc,$(firstword $(CC))))
CFLAGS = -d0 -ox -zastd=c99 -aa -zq -c -i="$(CURDIR)/include" -fo=
LDFLAGS = -zq -l=pmodew -fe=
AR = wlib
ARFLAGS = -q
EXESUFFIX = .exe
LIBSUFFIX = .lib
# Detect Mingw compiler
else ifneq (,$(findstring mingw,$(firstword $(CC))))
EXESUFFIX = .exe
# Detect Zig cc for Windows
else ifneq (,$(findstring windows,$(CC)))
EXESUFFIX = .exe
endif
export CC CFLAGS LDFLAGS AR ARFLAGS EXESUFFIX LIBSUFFIX INSTALLDIR
subdirs: $(SUBDIRS)
$(SUBDIRS):
test -d "$(BUILDDIR)/$@" || mkdir -p "$(BUILDDIR)/$@"
$(MAKE) -C $@ BUILDDIR="../$(BUILDDIR)/$@" $(MAKECMDGOALS)
all clean install uninstall: subdirs
.PHONY: all clean install uninstall subdirs $(SUBDIRS)