forked from nir9/lightwm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (49 loc) · 1.77 KB
/
Makefile
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
# Define compiler and linker
CC = cl
LINKER = link
RC = rc
# Define common compiler flags
CFLAGS = /W3 /EHsc
# Define debug specific compiler flags
DBGCFLAGS = $(CFLAGS) /DDEBUG /Zi /Wall
# Define release specific compiler flags
RELCFLAGS = $(CFLAGS) /Ox
# Define source files
EXE_SRCS = wm.c tiling.c error.c config.c keyboard.c
DLL_SRCS = wm_dll.c error.c
RES_FILE = wm_resources.rc
# Define directories
DBGDIR = debug
RELDIR = release
# Define output names
EXE_NAME = lightwm.exe
DLL_NAME = lightwm_dll.dll
all: clean_old debug release
debug: clean prep resource wm.c
$(CC) $(DBGCFLAGS) $(EXE_SRCS) $(RES_FILE).res /link user32.lib shell32.lib ole32.lib shlwapi.lib /out:$(DBGDIR)/$(EXE_NAME)
$(CC) $(DBGCFLAGS) $(DLL_SRCS) /LD /link user32.lib /DEF:wm_dll.def /out:$(DBGDIR)/$(DLL_NAME)
release: clean prep resource wm.c
$(CC) $(RELCFLAGS) $(EXE_SRCS) $(RES_FILE).res /link user32.lib shell32.lib ole32.lib shlwapi.lib /out:$(RELDIR)/$(EXE_NAME)
$(CC) $(RELCFLAGS) $(DLL_SRCS) /LD /link user32.lib /DEF:wm_dll.def /out:$(RELDIR)/$(DLL_NAME)
resource: $(RES_FILE)
$(RC) /fo $(RES_FILE).res $(RES_FILE)
prep:
@echo off > temp.bat && \
echo IF NOT EXIST $(DBGDIR) mkdir $(DBGDIR) >> temp.bat && \
echo IF NOT EXIST $(RELDIR) mkdir $(RELDIR) >> temp.bat && \
temp.bat && \
del temp.bat
# Temporary for a couple of weeks
clean_old:
if exist wm.exe ( del wm.exe )
if exist wm_dll.dll ( del wm_dll.dll )
echo Old cleanup done
clean:
del *.obj *.exe *.dll *.lib *.exp *.ilk *.pdb *.res
@echo off > temp.bat && \
echo IF EXIST $(DBGDIR) del /S /Q $(DBGDIR) >> temp.bat && \
echo IF EXIST $(RELDIR) del /S /Q $(RELDIR) >> temp.bat && \
echo IF EXIST $(DBGDIR) rd /S /Q $(DBGDIR) >> temp.bat && \
echo IF EXIST $(RELDIR) rd /S /Q $(RELDIR) >> temp.bat && \
temp.bat && \
del temp.bat