blob: c00bb47d8134025c2e08f75f925a9ebcdf48ceb2 (
plain) (
blame)
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
|
--- Makefile.orig 2010-11-23 21:27:55 UTC
+++ Makefile
@@ -31,8 +31,12 @@ ifeq (${PLATFORM},linux)
ifeq (${PLATFORM},linux)
-CFLAGS = -pthread -fopenmp -Wall -msse2 -mfpmath=sse -I/usr/include/ImageMagick -I/usr/include/OpenEXR
-LDFLAGS = -lIlmImf -lMagick++ -ltiff -lpopt -lstdc++ -lm
+CXX?= c++
+CXXFLAGS+= -Wall
+CPPFLAGS+= `pkg-config --cflags popt` `pkg-config --cflags OpenEXR` \
+ `pkg-config --cflags Magick++`
+LDFLAGS+= `pkg-config --libs popt` `pkg-config --libs libtiff-4` \
+ `pkg-config --libs OpenEXR` `pkg-config --libs Magick++`
EXECUTABLES = ${TARGET_SOURCES:%.cc=%}
endif
@@ -64,14 +68,24 @@ endif
endif
+TARGET_OBJS = $(TARGET_SOURCES:%.cc=%.o)
+DEPENDENCY_OBJS = $(DEPENDENCY_SOURCES:%.cc=%.o)
+
.PHONY : all
-all : ${TARGET_SOURCES:%.cc=%}
+all : $(EXECUTABLES)
-% : %.cc $(DEPENDENCY_HEADERS) $(DEPENDENCY_SOURCES) Makefile
- @echo "---- building \"$@\" from \"$<\" ($(PLATFORM)/$(BUILD)) ----"
- g++ $(CFLAGS) $< $(DEPENDENCY_SOURCES) -o $@ $(LDFLAGS)
- @echo
+$(TARGET_OBJS) $(DEPENDENCY_OBJS) : $(DEPENDENCY_HEADERS)
+$(EXECUTABLES) : $(DEPENDENCY_OBJS)
+$(foreach prog,$(EXECUTABLES),$(eval $$prog : $$prog.o))
+%.o : %.cc
+# Clang cannot compile image.cc and squish_luminance.cc with -O2 and above
+ $(CXX) $(if $(and $(shell $(CXX) -v 2>&1 | grep clang),$(filter \
+ image.cc squish_luminance.cc,$<)),$(CXXFLAGS:-O%=-O1), \
+ $(CXXFLAGS)) $(CPPFLAGS) -o $@ -c $<
+
+% : %.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) $^ -o $@
.PHONY : strip
strip : all
|