blob: eb9e87bf1009c91f1032f0754026d0beec1a3cd6 (
plain)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
!ifndef FLEXTBUILD
INCPATH=$(INCPATH) /I$(FLEXTPATH)
LIBPATH=$(LIBPATH) /LIBPATH:$(FLEXTPATH)
LIBS=$(LIBS) $(FLEXTNAME).lib
!endif
!ifdef MSVCPATH
INCPATH=$(INCPATH) /I$(MSVCPATH)\include
LIBPATH=$(LIBPATH) /LIBPATH:$(MSVCPATH)\lib
!endif
# for VC7 - enable exception handling
CFLAGS=$(CFLAGS) /EHsc
##############################################
!ifdef DEBUG
CFLAGS=$(CFLAGS) /D_DEBUG /DMTd
LDFLAGS=$(LDFLAGS) /DEBUG
!else
CFLAGS=$(CFLAGS) $(OFLAGS) /DNDEBUG /DMT
LDFLAGS=$(LDFLAGS) /INCREMENTAL:NO
!endif
##############################################
!ifdef FLEXTBUILD
OUTNAME=$(FLEXTNAME)
!ifdef SHARED
EXT=dll
!else
EXT=lib
BUILDLIB=1
!endif
!else
OUTNAME=$(NAME)
!endif
##############################################
TARGETPATH=$(OUTPATH)\$(OUTSUB)
TARGET=$(TARGETPATH)\$(OUTNAME).$(EXT)
##############################################
# default target
_all_: $(TARGET)
# convert both *.c and *.cpp
OBJSTMP= $(SRCS:.c=.obj)
OBJS= $(OBJSTMP:.objpp=.obj)
$(TARGETPATH):
if not exist $(OUTPATH) mkdir $(OUTPATH) > nul
if not exist $@ mkdir $@ > nul
{$(SRCDIR)}.cpp{}.obj:
cl /c /LD $(CFLAGS) $(DEFS) $(INCPATH) $** /Fo$(TARGETPATH)\$@
{$(SRCDIR)}.c{}.obj:
cl /c /LD $(CFLAGS) $(DEFS) $(INCPATH) $** /Fo$(TARGETPATH)\$@
$(TARGET):: $(TARGETPATH)
$(TARGET):: $(OBJS)
@cd $(TARGETPATH)
!ifdef BUILDLIB
lib /OUT:$(@F) $(OBJS)
cd ..
!else
echo $**
link /DLL $(LDFLAGS) $(LIBPATH) $(OBJS) $(LIBS) /out:$(@F)
!endif
cd ..
##############################################
# remove build
_clean_:
-del /q $(TARGET) > nul
-cd $(TARGETPATH)
-del /q $(OBJS) > nul
##############################################
$(INSTPATH):
if not exist $@ mkdir $@ > nul
$(FLEXTPATH):
if not exist $@ mkdir $@ > nul
_install_:: $(INSTPATH) $(FLEXTPATH)
_install_::
!ifdef FLEXTBUILD
-copy $(TARGET) $(FLEXTPATH) > nul
@cd $(SRCDIR)
-for %%i in ($(HDRS)) do @copy %%i $(FLEXTPATH) > nul
!else
copy $(TARGET) $(INSTPATH) > nul
!endif
|