Instructions to build libmodbus in a VS project
[libmodbus.git] / src / win32 / Make-tests
blobd4a569e63323109611a67268f141ab8a4c20088a
1 # Windows makefile
2 # --
3 #       use mingw make
4 #       Get make-3.82-5-mingw32-bin.tar.lzma from
5 #       http://sourceforge.net/projects/mingw/files/MinGW/Extension/make/make-3.82-mingw32/
6 # --
7 #       Set CC=gcc or CC=cl for the pre-defined compilers
8 #       before using this Makefile
9 # --
10 # Compile and link the bandwidth and random tests.
11 # Build modbus.dll and the import library before building the tests
12 # modbus.lib/libmodbus.a (the import library) should be in this directory
13 # modbus.dll should be in this directory or in path
15 INCLUDES:=-I../.. -I.. -I.
17 ifeq ($(CC),cl)
18 DEFS+=-D_CRT_SECURE_NO_DEPRECATE=1 -D_CRT_NONSTDC_NO_DEPRECATE=1
19 CFLAGS=-Zi -W3 -MT -ID:/include/msvc_std
20 LDOPTS=-link -incremental:NO 
21 LDLIBS=-Fe$@ ws2_32.lib modbus.lib $(LDOPTS)
22 RES:=res
23 RCOUT=
24 endif
26 ifeq ($(CC),gcc)
27 CFLAGS=-g -Wall -O -static -static-libgcc
28 LDLIBS=-o$@ -lws2_32 -luser32 -L. -lmodbus
29 LDOPTS=
30 RES:=o
31 RCOUT=-o$@
32 endif
34 CFLAGS+=-DHAVE_CONFIG_H $(DEFS) $(INCLUDES)
36 .SUFFIXES:
37 .SUFFIXES: .c .rc .$(RES) .$(oo)
39 # pattern rule for resources
40 %.$(RES) : %.rc
41         $(RC) $< $(RCOUT)
43 vpath %.c ../../tests
44 vpath %.h ../src
46 all: random-test-client random-test-server bandwidth-client bandwidth-server-one
48 random-test-client: random-test-client.c
49         $(LINK.c) $^ $(LDLIBS)
51 random-test-server: random-test-server.c
52         $(LINK.c) $^ $(LDLIBS)
54 bandwidth-server-one: bandwidth-server-one.c
55         $(LINK.c) $^ $(LDLIBS)
57 bandwidth-client: bandwidth-client.c
58         $(LINK.c) $^ $(LDLIBS)
61 clean:
62         -@cmd "/c del /Q /S $(OBJS) *.o *.obj *.exe *.pdb *.ilk *.ncb *.res *.dll *.exp *.lib *.ncb *.a *.map *.asm" > NUL: 2>&1