aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/build/win/make-bcc.inc
blob: 2ef1acfcb85ee7277594601c8c94aba7c8f262ae (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
INCPATH=$(INCPATH) -I$(FLEXTPATH)
LIBPATH=$(LIBPATH) -L$(FLEXTPATH)

!ifdef BCCPATH
INCPATH=$(INCPATH) -I$(BCCPATH)\include 
LIBPATH=$(LIBPATH) -L$(BCCPATH)\lib
!endif

LIBS=$(LIBS) cw32.lib import32.lib C0D32.OBJ 
CFLAGS=$(CFLAGS) -tWD -tWM -w-8004 -w-8027 -w-8057
LDFLAGS=$(LDFLAGS) /C /Tpd 

##############################################

# use multithreaded static libraries
!ifdef DEBUG
CFLAGS=$(CFLAGS) -v -D_DEBUG
LDFLAGS=$(LDFLAGS) /v
!else
CFLAGS=$(CFLAGS) $(OFLAGS) -DNDEBUG
!endif

!ifdef SHARED
# --- shared ---
DEFS=$(DEFS) -DFLEXT_SHARED

!else
!ifdef THREADED
# --- static multi-threaded ---
DEFS=$(DEFS) -DFLEXT_THREADS

!else 
# --- static single-threaded ---

!endif
!endif

##############################################

TARGET=$(OUTPATH)\$(NAME).$(EXT)

# default target
all: $(OUTPATH) print $(TARGET)

# convert both *.c and *.cpp
OBJSTMP= $(SRCS:.c=.obj)
OBJS= $(OBJSTMP:.objpp=.obj)

print:
    echo $(OBJS)

$(OUTPATH):
	@-if not exist $< mkdir $<

SETUPFUNCTION=$(NAME)_setup

$(OUTPATH)\$(NAME).def:
	@echo EXPORTS $(SETUPFUNCTION) = _$(SETUPFUNCTION) > $<
# this next line fixes a strange problem with implib - lacking underscore?!
	@echo IMPORTS _rtext_retext=PD.rtext_retext >> $<

{$(SRCDIR)}.cpp{}.obj:
	bcc32 -c $(CFLAGS) $(DEFS) $(INCPATH) -n$(OUTPATH) $<

{$(SRCDIR)}.c{}.obj:
	bcc32 -c $(CFLAGS) $(DEFS) $(INCPATH) -n$(OUTPATH) $<

$(TARGET) :: $(OUTPATH) $(OUTPATH)\$(NAME).def

$(TARGET) :: $(OBJS)
	cd $(OUTPATH)
	ilink32 $(LDFLAGS) $(LIBPATH) $** ,..\$<,,$(LIBS),$(NAME).def
	cd ..

$(INSTPATH):
	-mkdir $@

# remove build
clean:
	-del /q $(OUTPATH) > nul
	-rmdir $(OUTPATH) > nul

# install build
install: $(INSTPATH) $(TARGET)
	copy $(TARGET) $(INSTPATH) > nul