git repos / PlatformFolders

blame: Makefile

normal view · raw

f308f41e Poul Sander 2016-02-17 14:47 1
ifdef CROSS
1213f3f3 sago007 2015-09-19 19:24 2
CC=$(CROSS)gcc
1213f3f3 sago007 2015-09-19 19:24 3
CXX=$(CROSS)g++
1213f3f3 sago007 2015-09-19 19:24 4
LD=$(CROSS)ld
1213f3f3 sago007 2015-09-19 19:24 5
AR=$(CROSS)ar
1213f3f3 sago007 2015-09-19 19:24 6
PKG_CONFIG=$(CROSS)pkg-config
f308f41e Poul Sander 2016-02-17 14:47 7
endif
1213f3f3 sago007 2015-09-19 19:24 8
1213f3f3 sago007 2015-09-19 19:24 9
BASE_LIBS=
1213f3f3 sago007 2015-09-19 19:24 10
BASE_CFLAGS=-c -g -O2 -Wall
1213f3f3 sago007 2015-09-19 19:24 11
1213f3f3 sago007 2015-09-19 19:24 12
#The files should compile on both C++03 and C++11
1213f3f3 sago007 2015-09-19 19:24 13
ifdef TESTCPP11
1213f3f3 sago007 2015-09-19 19:24 14
BASE_CFLAGS+= -std=c++11
1213f3f3 sago007 2015-09-19 19:24 15
else
1213f3f3 sago007 2015-09-19 19:24 16
BASE_CFLAGS+= -std=c++03
1213f3f3 sago007 2015-09-19 19:24 17
endif
1213f3f3 sago007 2015-09-19 19:24 18
1eaaab72 sago007 2015-10-26 17:23 19
#This is used to detect Mac because Mac needs CoreServices for linking
1eaaab72 sago007 2015-10-26 17:23 20
ifneq ($(OS),Windows_NT)
1eaaab72 sago007 2015-10-26 17:23 21
UNAME := $(shell uname -s)
1eaaab72 sago007 2015-10-26 17:23 22
ifeq ($(UNAME),Darwin)
1eaaab72 sago007 2015-10-26 17:23 23
BASE_LIBS+= -framework CoreServices
1eaaab72 sago007 2015-10-26 17:23 24
endif
1eaaab72 sago007 2015-10-26 17:23 25
endif
1eaaab72 sago007 2015-10-26 17:23 26
1213f3f3 sago007 2015-09-19 19:24 27
PROGRAMNAME=platform_folders
1213f3f3 sago007 2015-09-19 19:24 28
1213f3f3 sago007 2015-09-19 19:24 29
O_FILES=${PROGRAMNAME}.o sago/platform_folders.o
1213f3f3 sago007 2015-09-19 19:24 30
344d62f1 sago007 2015-09-20 11:42 31
total: ${PROGRAMNAME}.out
1213f3f3 sago007 2015-09-19 19:24 32
1213f3f3 sago007 2015-09-19 19:24 33
clean: 
63627d7a sago007 2015-09-20 18:08 34
	rm -f */*.o *.o *.P */*.P ${PROGRAMNAME}.out
1213f3f3 sago007 2015-09-19 19:24 35
344d62f1 sago007 2015-09-20 11:42 36
${PROGRAMNAME}.out: $(O_FILES)
344d62f1 sago007 2015-09-20 11:42 37
	$(CXX) -O -o ${PROGRAMNAME}.out $(O_FILES) $(BASE_LIBS)
1213f3f3 sago007 2015-09-19 19:24 38
1213f3f3 sago007 2015-09-19 19:24 39
%.o : %.cpp
1213f3f3 sago007 2015-09-19 19:24 40
	$(CXX) -MD ${BASE_CFLAGS} -o $@ $<
1213f3f3 sago007 2015-09-19 19:24 41
	@mkdir -p `dirname .$(CROSS)deps/$*.P` && cp $*.d .$(CROSS)deps/$*.P; \
1213f3f3 sago007 2015-09-19 19:24 42
             sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
1213f3f3 sago007 2015-09-19 19:24 43
                 -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> .$(CROSS)deps/$*.P; \
1213f3f3 sago007 2015-09-19 19:24 44
             rm -f $*.d
1213f3f3 sago007 2015-09-19 19:24 45
1213f3f3 sago007 2015-09-19 19:24 46
-include .$(CROSS)deps/*.P
1970-01-01 00:00 47