-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
executable file
·51 lines (34 loc) · 990 Bytes
/
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
# Copyright (c) 2013 Reitaro IZU
# Released under the MIT license. See LICENSE for more detail.
PROJECT_NAME = viewgrafy
CROSS_PREFIX ?= i686-pc-mingw32-
CXX = $(CROSS_PREFIX)g++
RC = $(CROSS_PREFIX)windres
LD = $(CROSS_PREFIX)g++
SOURCES = viewgrafy.cpp
RESOUCES = resource.rc
BUILD_DIR = obj
APP_DIR = $(PROJECT_NAME)
OBJ_FILES = $(SOURCES:.cpp=.o)
OBJS = $(patsubst %,$(BUILD_DIR)/%,$(OBJ_FILES))
RESOBJ_FILES = $(RESOUCES:.rc=.o)
RESOBJS = $(patsubst %,$(BUILD_DIR)/%,$(RESOBJ_FILES))
APP = $(APP_DIR)/$(PROJECT_NAME).exe
VPATH=source
CXXFLAGS = -Wall -O2
LDFLAGS = -static-libgcc -mwindows -lgdi32 -lgdiplus -lComCtl32 -static
.PHONY: all clean
.SUFFIXES: .o .cpp .rc
all: $(APP)
clean:
rm -rf $(BUILD_DIR)
rm -rf $(APP_DIR)
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
$(BUILD_DIR)/%.o: %.cpp
$(CXX) $(CXXFLAGS) -o $@ -c $<
$(BUILD_DIR)/%.o: %.rc
$(RC) $< -o $@
$(APP): $(BUILD_DIR) $(OBJS) $(RESOBJS)
mkdir -p $(APP_DIR)
$(LD) -o $(APP) $(OBJS) $(RESOBJS) $(LDFLAGS)