-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathmakefile
More file actions
47 lines (39 loc) · 985 Bytes
/
makefile
File metadata and controls
47 lines (39 loc) · 985 Bytes
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
libs := -lpng -lz
flags := -g -O2 -Wall -std=c++11
out := bin/texpack
PREFIX ?= /usr/local
ifeq ($(shell uname | grep 'MINGW32_NT' -c),1)
out := bin/texpack.exe
flags += -static-libgcc -static-libstdc++
win32 := yes
endif
src += src/main.cpp
src += src/packer.cpp
src += src/bleeding.cpp
src += src/png/png.cpp
src += src/rbp/MaxRects.cpp
hpp += src/help.h
hpp += src/packer.h
hpp += src/bleeding.h
hpp += src/png/png.h
hpp += src/rbp/MaxRects.h
$(out): $(src) $(hpp)
@mkdir -p bin
$(CXX) $(src) $(inc) $(flags) $(CFLAGS) $(LDFLAGS) $(libs) -o $(out)
src/help.h: help.txt
echo "#pragma once" > src/help.h
echo "const char *help_text = " >> src/help.h
cat help.txt | \
sed -e 's/\\/\\\\/g' | \
sed -e 's/"/\\"/g' | \
sed -e 's/^/\t"/g' | \
sed -e 's/$$/\\n"/g' >> src/help.h
echo ' "";' >> src/help.h
ifeq ($(win32),yes)
sed -i 's/$$/\r/' src/help.h
endif
clean:
rm -rf bin
install: $(out)
cp $(out) "$(PREFIX)/bin/"
.PHONY: clean install