forked from packjpg/packJPG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
61 lines (49 loc) · 1.35 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
# packXXX Makefile, based on UniMake: Universal Makefile
# Created by Matthias Stirner, 01/2016
TARGET = jpegpack
CC = gcc
CPP = g++
RC = windres -O coff
CPPFLAGS = -Wall -O3 -std=c++14 -Isrc -pedantic -funroll-loops -ffast-math -fsched-spec-load -fomit-frame-pointer
LDFLAGS = -lstdc++fs -s
CSRC = $(wildcard src/*.c)
CPPSRC = $(wildcard src/*.cpp)
DEPS = $(wildcard src/*.h) Makefile
OBJ = $(patsubst %.c,%.o,$(CSRC)) $(patsubst %.cpp,%.o,$(CPPSRC))
RM = rm -f
# conditional stuff
ifeq ($(OS),Windows_NT)
LDFLAGS += -lpthread -L libwinpthread-1.dll
RES = icons.res
UPX := -upx --best --lzma $(TARGET).exe
else
CPPFLAGS += -DUNIX
RC =
RES =
UPX =
endif
ifeq ($(STATIC),Y)
LDFLAGS += -static -static-libgcc -static-libstdc++
endif
.PHONY: all dev lib dll
all: $(TARGET)
$(TARGET): $(OBJ) $(RES)
$(CPP) $^ $(LDFLAGS) -o $@
$(UPX)
%.o: %.cpp $(DEPS)
$(CPP) $(CPPFLAGS) -c $< -o $@
icons.res: icons.rc
@-$(RC) $< $@
dev: CPPFLAGS += -DDEV_BUILD
dev: $(TARGET)
lib: CPPFLAGS += -DBUILD_LIB
lib: $(OBJ)
ar r lib$(TARGET).a $(OBJ)
ranlib lib$(TARGET).a
dll: CPPFLAGS += -DBUILD_DLL
dll: LDFLAGS += -Wl,--out-implib,libpackJPG.a -fvisibility=hidden
dll: $(OBJ)
$(CPP) -shared -o $(TARGET).dll $^ $(LDFLAGS)
clean:
@echo clean...
@-rm $(OBJ) lib$(TARGET).a $(TARGET) $(TARGET).exe $(TARGET).dll