summaryrefslogtreecommitdiff
path: root/src/NMakefile
blob: ede3e98f909b52641a53452ae605086cf626f8cd (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
CYGWIN_DIR = C:\cygwin
CYGWIN_PATH = C:\cygwin\bin

CONFUSE_DIR = C:\develop\confuse-2.7
PTHREADS_W32_DIR = C:\develop\pthreads-w32-2-9-1-release
NANOMSG_DIR = C:\develop\nanomsg-0.5-beta
JSON_C_DIR = C:\develop\json-c
GTK3_BUNDLE_DIR = C:\develop\gtk+-bundle_3.6.4-20130921_win32

GENGETOPT = $(CYGWIN_DIR)\usr\local\bin\gengetopt.exe

!IFNDEF CC
CC = cl
!ENDIF
!IFNDEF LINK
LINK = link
!ENDIF

INCLUDE_DIRS = \
	/I$(CONFUSE_DIR)\include \
	/I$(PTHREADS_W32_DIR) \
	/I$(NANOMSG_DIR)\include \
	/I$(JSON_C_DIR)\include \
	/I$(GTK3_BUNDLE_DIR)\include\glib-2.0 \
	/I$(GTK3_BUNDLE_DIR)\lib\glib-2.0\include

LIB_DIRS = \
	/LIBPATH:$(CONFUSE_DIR)\lib \
	/LIBPATH:$(PTHREADS_W32_DIR) \
	/LIBPATH:$(NANOMSG_DIR)\lib \
	/LIBPATH:$(JSON_C_DIR)\lib \
	/LIBPATH:$(GTK3_BUNDLE_DIR)\lib
	
CLFLAGS = /TP /MDd /W2 /WX /nologo /O2 $(INCLUDE_DIRS)
LINKFLAGS = /nologo $(LIB_DIRS)
LIBS = libConfuse.lib pthreadVC2d.lib nanomsg.lib json-c.lib Ws2_32.lib glib-2.0.lib

.SUFFIXES: .c .obj .exe

.c.obj:
	$(CC) $(CLFLAGS) /c /Fo$@ $<

all: biruda.exe workertest.exe

biruda.exe: biruda.obj biruda_cmdline.obj master.obj coordinator.obj worker.obj system.obj cli.obj
	$(LINK) $(LINKFLAGS) $(LIBS) /out:$@ $**

biruda_cmdline.obj: biruda_cmdline.c
biruda.obj: biruda.c biruda_cmdline.h master.h coordinator.h worker.h port.h system.h cli.h biruda_conf.c
master.obj: master.c master.h port.h
coordinator.obj: coordinator.c coordinator.h port.h system.h
worker.obj: worker.c worker.h
system.obj: system.c system.h
cli.obj: cli.c cli.h

biruda_cmdline.c: biruda.ggo
	$(GENGETOPT) -F biruda_cmdline --unamed-opts --conf-parser --include-getopt -i $**

biruda_cmdline.h: biruda.ggo
	$(GENGETOPT) -F biruda_cmdline --unamed-opts --conf-parser --include-getopt -i $**

workertest.exe: workertest.obj
	$(LINK) $(LINKFLAGS) $(LIBS) /out:$@ $**

workertest.obj: workertest.c

3rdParty\xxd\xxd.exe: 3rdParty\xxd\xxd.c
	$(CC) /nologo /c /Fo3rdParty\xxd\xxd.obj 3rdParty\xxd\xxd.c
	$(LINK) /out:3rdParty\xxd\xxd.exe 3rdParty\xxd\xxd.obj

biruda_conf.c: biruda.conf 3rdParty\xxd\xxd.exe
	3rdParty\xxd\xxd.exe -i biruda.conf > biruda_conf.c

clean:
	@-erase *.obj 2>NUL
	@-erase *.dll 2>NUL
	@-erase gspawn-win32-helper-console.exe 2>NUL
	@-erase biruda.exe workertest.exe 2>NUL
	@-erase biruda_cmdline.h biruda_cmdline.c 2>NUL
	@-erase 3rdParty\xxd\xxd.exe 3rdParty\xxd\xxd.obj 2>NUL
	@-rm biruda_conf.c

run: all
	@-copy $(CONFUSE_DIR)\bin\libConfuse.dll .
	@-copy $(PTHREADS_W32_DIR)\pthreadVC2d.dll .
	@-copy $(NANOMSG_DIR)\bin\nanomsg.dll .
	@-copy "$(GTK3_BUNDLE_DIR)\bin\libglib-2.0-0.dll" .
	@-copy "$(GTK3_BUNDLE_DIR)\bin\libintl-8.dll" .
	@-copy "$(GTK3_BUNDLE_DIR)\bin\libiconv-2.dll" .
	@-copy "$(GTK3_BUNDLE_DIR)\bin\pthreadGC2.dll" .
	@-copy "$(GTK3_BUNDLE_DIR)\bin\gspawn-win32-helper-console.exe .
	@-biruda -c biruda.conf -p
	@-biruda --guess-env --human-readable