-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
60 lines (46 loc) · 1.26 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
TARGET = timedit
RCFILE = timedit.rc
INSTALL = /usr/bin
CFILES = $(notdir $(wildcard *.c))
CPPFILES = $(notdir $(wildcard *.cpp))
CXXFILES = $(notdir $(wildcard *.cxx))
AFILES = $(notdir $(wildcard *.s))
IMAGES = timedit.png
OFILES = $(addprefix build/,$(CPPFILES:.cpp=.o) $(CXXFILES:.cxx=.o) $(IMAGES:.png=.o))
LIBS = -lfreeimage -ltinyxml2 -lfltk_images -lfltk_png -lfltk_z -lfltk
ifeq "$(CONF)" "debug"
CFLAGS = -g
CXXFLAGS = $(CFLAGS)
AFLAGS =
else
CFLAGS = -mwindows -O2
CXXFLAGS = $(CFLAGS)
AFLAGS =
endif
WINRES = $(addprefix build/,$(RCFILE:.rc=.res))
ifeq "$(OS)" "Windows_NT"
LIBS += -lcomctl32 -lcomdlg32 -lgdi32 -lole32 -luuid
LIBDIRS = -LC:\fltk-1.3.4-1\lib -LC:\tinyxml2 -LC:\freeimage
INCLUDE = -IC:\fltk-1.3.4-1 -IC:\tinyxml2 -IC:\freeimage
CFLAGS += -DWIN32
endif
CC = gcc
CXX = g++
AS = as
all: $(OFILES) $(WINRES)
$(CXX) $(CXXFLAGS) $(OFILES) $(LIBDIRS) $(LIBS) $(WINRES) -o $(TARGET)
clean:
rm -Rf build $(TARGET)
build/%.o: %.cpp
@mkdir -p $(dir $@)
$(CXX) $(CXXFLAGS) $(INCLUDE) -c $< -o $@
build/%.o: %.cxx
@mkdir -p $(dir $@)
$(CXX) $(CXXFLAGS) $(INCLUDE) -c $< -o $@
build/%.o: icons/%.png
@mkdir -p $(dir $@)
ld -r -b binary -o $@ $<
build/%.res: %.rc
windres $< -O coff $@
install:
cp -p $(TARGET) $(INSTALL)/$(TARGET)