1 ifeq ($(shell [ -f Makefile.local ] && echo true),true)
2 ALL_BEGIN := $(MAKE) -f Makefile.local all_begin
3 ALL_END := $(MAKE) -f Makefile.local all_end
4 MAKE_LOCAL_CLEAN := $(MAKE) -f Makefile.local clean
23 # may need to remove --param max-inline-insns-single=500 for older versions of gccs
24 WARN :=-Wstrict-prototypes
26 #--param max-inline-insns-single=500
31 #OPTIMIZE :=-O3 -ffast-math -ftree-vectorize -ftree-vectorizer-verbose=4
33 DLL_COMMAND := -shared
35 dependson := $(shell cat depends)
37 HEADERS :=-I. -I./source
38 others := $(dependson)
39 others := $(addprefix -I../,$(others))
40 others := $(addsuffix /_build/headers,$(others))
44 DLL_L := $(addprefix -L../,$(DLL_L))
45 DLL_L := $(addsuffix /_build/dll,$(DLL_L))
48 DLL_l := $(addprefix -l,$(DLL_l))
50 CFLAGS = $(OPTIMIZE) $(WARN) $(HEADERS) #--param max-inline-insns-single=500
52 # Uncommment for Coros to register their stack with Valgrind
53 #CFLAGS += -DUSE_VALGRIND
55 ### PLATFORM #####################################################
57 SYS ?= $(shell uname -s)
60 CFLAGS += -falign-loops=16
63 DLL_COMMAND := -dynamiclib
64 FLAT_NAMESPACE := -flat_namespace
66 hasEditLib := $(wildcard ../../tools/editlib_test/editlib_test)
67 ifneq ($(strip $(hasEditLib)),)
74 CFLAGS += -falign-loops=16
82 ifneq (,$(findstring CYGW,$(SYS)))
86 ifneq (,$(findstring MINGW,$(SYS)))
90 ifneq (,$(findstring Windows,$(SYS)))
94 OPTIMIZE :=-Zi -MD -D_USE_MATH_DEFINES -DWIN32 -DNDEBUG -D_CRT_SECURE_NO_DEPRECATE
99 LINKDLLOUTFLAG :=-out:
100 LINKDIRFLAG := -libpath:
102 DLL_LIB_SUFFIX := .lib
103 DLL_COMMAND := -link /INCREMENTAL:NO -subsystem:WINDOWS -machine:X86 -DLL $(DEF_FILE)
105 DLL_EXTRAS := ws2_32.lib
107 RANLIB := echo no ranlib
110 ### FILES #########################################################
112 NAME := $(notdir $(subst $() ,_,$(shell pwd)))
113 LIBR := _build/lib/lib$(NAME).a
114 DLL := _build/dll/lib$(NAME).$(DLL_SUFFIX)
115 infiles := $(wildcard source/*.c)
116 #infiles += $(wildcard *.S)
117 asmfiles := $(wildcard source/*.S)
118 hfiles := $(wildcard source/*.h)
119 objects := $(notdir $(infiles))
120 objects := $(basename $(objects))
121 objects := $(addsuffix .o,$(objects))
122 objects := $(addprefix _build/objs/,$(objects))
124 vmall_objects := $(notdir $(infiles))
125 vmall_objects := $(basename $(vmall_objects))
126 vmall_objects := $(addsuffix .o,$(vmall_objects))
127 vmall_objects := $(addprefix _build/vmall_objs/,$(vmall_objects))
130 DLL_L := $(dependson)
131 DLL_L := $(addprefix $(LINKDIRFLAG)../,$(DLL_L))
132 DLL_L := $(addsuffix /_build/dll,$(DLL_L))
134 DLL_l := $(dependson)
135 DLL_l := $(addprefix $(LINKLIBFLAG),$(DLL_l))
136 DLL_l := $(addsuffix $(DLL_LIB_SUFFIX),$(DLL_l))
140 ### RULES ###########################################################
146 mkdir -p _build/headers
151 ifneq (,$(findstring Windows,$(SYS)))
152 mkdir -p _build/vmall_objs
156 cp $(hfiles) _build/headers
160 _build/objs/%.o: source/%.c
161 $(CC) -DINSTALL_PREFIX=\"$(INSTALL_PREFIX)\" $(CFLAGS) -c $< $(CCOUTFLAG)$@
163 _build/vmall_objs/%.o: source/%.c
164 $(CC) -DINSTALL_PREFIX=\"$(INSTALL_PREFIX)\" $(CFLAGS) \
165 -DBUILDING_IOVMALL_DLL -c $< $(CCOUTFLAG)$@
171 vmall_objs: _build/vmall_objs $(vmall_objects)
175 $(CC) $(CFLAGS) -c $(asmfiles) $(CCOUTFLAG)_build/objs/asm.o || true
177 $(AR) $(ARFLAGS) $(AROUTFLAG)$@ _build/objs/*.o
181 $(LINKDLL) $(DLL_COMMAND) $(FLAT_NAMESPACE) $(DLL_L) _build/objs/*.o $(LINKDLLOUTFLAG)$(DLL) $(DLL_l) $(DLL_EXTRAS)