]>
Commit | Line | Data |
---|---|---|
39236c6e A |
1 | SDKROOT ?= / |
2 | Embedded?=$(shell echo $(SDKROOT) | grep -iq iphoneos && echo YES || echo NO) | |
3 | CC:=xcrun -sdk "$(SDKROOT)" cc | |
4 | CFLAGS:=-c -Wall -pedantic | |
5 | OPTIMIZATION:=-Os | |
6 | LDFLAGS= | |
7 | ||
8 | SRCROOT?=$(shell /bin/pwd) | |
9 | DSTROOT?=$(shell /bin/pwd) | |
10 | OBJROOT?=$(shell /bin/pwd) | |
11 | ||
12 | SOURCES:=main.c stress_cpu.c stress_memory.c stress_syscall.c stress_fault.c md5.c stress_file_create.c stress_file_write.c stress_file_read.c stress_file_local.c stress_file_ram.c iperf.c compile.c stress_general.c | |
13 | SOURCE_PATHS:=$(addprefix $(SRCROOT)/,$(SOURCES)) | |
14 | OBJECTS:=$(addprefix $(OBJROOT)/,$(SOURCES:.c=.o)) | |
15 | EXECUTABLE=perf_index | |
16 | ||
17 | ifdef RC_ARCHS | |
18 | ARCHS:=$(RC_ARCHS) | |
19 | else | |
20 | ifeq ($(ARCHS),) | |
21 | ifeq "$(Embedded)" "YES" | |
22 | ARCHS:=armv7 armv7s | |
23 | else | |
24 | ARCHS:=x86_64 i386 | |
25 | endif | |
26 | endif | |
27 | endif | |
28 | ||
29 | CFLAGS += $(patsubst %, -arch %, $(ARCHS)) | |
30 | LDFLAGS += $(patsubst %, -arch %, $(ARCHS)) | |
31 | ||
32 | all: $(SOURCE_PATHS) $(EXECUTABLE) | |
33 | ||
34 | $(EXECUTABLE): $(OBJECTS) | |
35 | $(CC) $(LDFLAGS) $(OBJECTS) -o $(DSTROOT)/$@ | |
36 | ||
37 | $(OBJROOT)/%.o: $(SRCROOT)/%.c | |
38 | $(CC) $(CFLAGS) $(OPTIMIZATION) $< -o $@ | |
39 | ||
40 | clean: | |
41 | rm -f *.o | |
42 | rm -f $(EXECUTABLE) |