1 |
# Makefile.msvc - liblscp.lib |
2 |
# For Microsoft Visual C++ 4.0 and later. |
3 |
# |
4 |
# Usage: nmake /f Makefile.msvc |
5 |
# |
6 |
|
7 |
CC = cl |
8 |
LD = link |
9 |
AR = $(LD) /LIB |
10 |
RM = del |
11 |
|
12 |
LIBNAME = liblscp |
13 |
|
14 |
INCDIR = ..\lscp |
15 |
SRCDIR = ..\src |
16 |
|
17 |
CCFLAGS = -O -W3 -nologo -I.. |
18 |
LDFLAGS = |
19 |
LDLIBS = $(LIBNAME).lib wsock32.lib |
20 |
|
21 |
all: $(LIBNAME).lib examples |
22 |
|
23 |
# |
24 |
# Static library build rules. |
25 |
# |
26 |
|
27 |
thread.obj: $(SRCDIR)\thread.c $(INCDIR)\thread.h |
28 |
$(CC) $(CCFLAGS) -c $(SRCDIR)\thread.c |
29 |
|
30 |
socket.obj: $(SRCDIR)\socket.c $(INCDIR)\socket.h |
31 |
$(CC) $(CCFLAGS) -c $(SRCDIR)\socket.c |
32 |
|
33 |
client.obj: $(SRCDIR)\client.c $(INCDIR)\client.h |
34 |
$(CC) $(CCFLAGS) -c $(SRCDIR)\client.c |
35 |
|
36 |
device.obj: $(SRCDIR)\device.c $(INCDIR)\device.h |
37 |
$(CC) $(CCFLAGS) -c $(SRCDIR)\device.c |
38 |
|
39 |
common.obj: $(SRCDIR)\common.c $(SRCDIR)\common.h |
40 |
$(CC) $(CCFLAGS) -c $(SRCDIR)\common.c |
41 |
|
42 |
event.obj: $(SRCDIR)\event.c $(SRCDIR)\event.h |
43 |
$(CC) $(CCFLAGS) -c $(SRCDIR)\event.c |
44 |
|
45 |
$(LIBNAME).lib: thread.obj socket.obj client.obj device.obj common.obj event.obj |
46 |
echo dummy > $(LIBNAME).lib |
47 |
$(RM) $(LIBNAME).lib |
48 |
$(AR) /OUT:$(LIBNAME).lib thread.obj socket.obj client.obj device.obj common.obj event.obj |
49 |
|
50 |
|
51 |
# |
52 |
# Examples build rules. |
53 |
# |
54 |
|
55 |
EXDIR = ..\examples |
56 |
|
57 |
examples: example_client.exe example_server.exe |
58 |
|
59 |
server.obj: $(EXDIR)\server.c $(EXDIR)\server.h |
60 |
$(CC) $(CCFLAGS) -c $(EXDIR)\server.c |
61 |
|
62 |
parser.obj: $(EXDIR)\parser.c $(EXDIR)\parser.h |
63 |
$(CC) $(CCFLAGS) -c $(EXDIR)\parser.c |
64 |
|
65 |
example_client.obj: $(EXDIR)\example_client.c |
66 |
$(CC) $(CCFLAGS) -I$(EXDIR) -c $(EXDIR)\example_client.c |
67 |
|
68 |
example_server.obj: $(EXDIR)\example_server.c |
69 |
$(CC) $(CCFLAGS) -I$(EXDIR) -c $(EXDIR)\example_server.c |
70 |
|
71 |
example_client.exe: example_client.obj $(LIBNAME).lib |
72 |
$(LD) $(LDFLAGS) example_client.obj $(LDLIBS) /OUT:example_client.exe /SUBSYSTEM:CONSOLE |
73 |
|
74 |
example_server.exe: example_server.obj server.obj parser.obj $(LIBNAME).lib |
75 |
$(LD) $(LDFLAGS) example_server.obj server.obj parser.obj $(LDLIBS) /OUT:example_server.exe /SUBSYSTEM:CONSOLE |
76 |
|
77 |
|
78 |
# |
79 |
# Common rules. |
80 |
# |
81 |
|
82 |
clean: |
83 |
del *.obj |
84 |
del *.lib |
85 |
del *.exe |
86 |
del *.bak |
87 |
|