forked from Endermanch/XPConfirmationIDKeygen
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile.linux
More file actions
89 lines (69 loc) · 2.34 KB
/
Makefile.linux
File metadata and controls
89 lines (69 loc) · 2.34 KB
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
# xp_activate32 MAKEFILE for compiling under Linux MinGW32
# Compiler and tools
CC := i686-w64-mingw32-gcc-win32
CXX := i686-w64-mingw32-g++-win32
LD := i686-w64-mingw32-g++-win32
RC := i686-w64-mingw32-windres
# Targets
NAME := xp_activate32
TARGET := xp_activate32.exe
# Build type: choose Debug or Release
# Default is Release
BUILDTYPE ?= Release
# Directories
SRC_DIR := src
# Automatically discover source files
HEADERS := $(wildcard $(SRC_DIR)/*.h)
SRC_C := $(wildcard $(SRC_DIR)/*.c)
SRC_CPP := $(wildcard $(SRC_DIR)/*.cc)
SRC_RC := $(wildcard $(SRC_DIR)/*.rc)
# Objects
OBJ_C := $(SRC_C:.c=.o)
OBJ_CPP := $(SRC_CPP:.cc=.o)
OBJ_RC := $(SRC_RC:.rc=.res)
# Compiler flags #
DEFINES := -DUNICODE -D_UNICODE -D_WINDOWS -DWINVER=0x0501 -D_WIN32_WINNT=0x0501 -D_WIN64_WINNT=0x0502 -D_WIN32_IE=0x0600 -DPSAPI_VERSION=1
# Show all errors, compile everything static, ensure src dir is included, -municode
# since this is a GUI windows app, ensure relocatable data
CFLAGS := $(DEFINES) -Wall -static -static-libgcc -municode
# Compiler optimization and architecture flags
ifeq ($(BUILDTYPE), Release)
CFLAGS += -O2 -g0 -s -MMD -MP -mfpmath=sse -mfxsr -msse -msse2
endif
ifeq ($(BUILDTYPE), Debug)
CFLAGS += -Og -g -MMD -MP -mfpmath=sse -mfxsr -msse -msse2
endif
# C++ only flags
CXXFLAGS := $(CFLAGS) -std=c++17 -static-libstdc++
# Libraries
LIBS := -lkernel32 -luser32 -lcomctl32 -lcomdlg32 -lshell32 -lgdi32 -ladvapi32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -lversion
# Linker flags
LDFLAGS := $(LIBS) -static -municode -Wl,--subsystem,windows:5.00
# Include generated dependency files
-include $(OBJ_C:.o=.d)
-include $(OBJ_CPP:.o=.d)
# Build Commands #
all: $(TARGET)
# The only target for now is xp_activate32.exe
$(NAME): $(TARGET)
# xp_activate32.exe itself
$(TARGET): $(OBJ_C) $(OBJ_CPP) $(OBJ_RC)
$(LD) $(OBJ_C) $(OBJ_CPP) $(OBJ_RC) -o $(TARGET) $(LDFLAGS)
# Compilation Rules #
# Compile C sources
%.o: %.c $(HEADERS)
$(CC) $(CFLAGS) -c $< -o $@
# Compile C++ sources
%.o: %.cc $(HEADERS)
$(CXX) $(CXXFLAGS) -c $< -o $@
# Compile .rc → .o or .res
%.res: %.rc
$(RC) $< -O coff $@
# Cleaning Rules #
clean:
rm -f -v $(OBJ_C) $(OBJ_CPP) $(OBJ_RC) $(OBJ_C:.o=.d) $(OBJ_CPP:.o=.d) $(TARGET)
# Testing rules #
test:
cat $(TARGET)
# PHONY targets for build deps tracking
.PHONY: all $(NAME) clean test