summaryrefslogtreecommitdiff
path: root/Makefile.prebuild
blob: c7d0de70ebce93bd3c831957df242a566e5ffaae (plain)
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
# This is triggered by Makefile.system and runs before any of the code is built.

export BINARY
export USE_OPENMP

ifdef TARGET_CORE
TARGET_MAKE = Makefile_kernel.conf
TARGET_CONF = config_kernel.h
else
TARGET_MAKE = Makefile.conf
TARGET_CONF = config.h
endif

# CPUIDEMU = ../../cpuid/table.o

ifdef CPUIDEMU
EXFLAGS = -DCPUIDEMU -DVENDOR=99
endif

all: getarch_2nd cblas_noconst.h
	./getarch_2nd  0 >> $(TARGET_MAKE)
	./getarch_2nd  1 >> $(TARGET_CONF)

config.h : c_check f_check getarch
	perl ./c_check $(TARGET_MAKE) $(TARGET_CONF) $(CC)
	perl ./f_check $(TARGET_MAKE) $(TARGET_CONF) $(FC)
	./getarch 0 >> $(TARGET_MAKE)
	./getarch 1 >> $(TARGET_CONF)


getarch : getarch.c cpuid.S dummy $(CPUIDEMU)
	$(HOSTCC) $(CFLAGS) $(EXFLAGS) -o $(@F) getarch.c cpuid.S $(CPUIDEMU)

getarch_2nd : getarch_2nd.c config.h dummy
ifndef TARGET_CORE
	$(HOSTCC) -I. $(CFLAGS) -o $(@F) getarch_2nd.c
else
	$(HOSTCC) -I. $(CFLAGS) -DBUILD_KERNEL -o $(@F) getarch_2nd.c
endif

cblas_noconst.h : cblas.h
	perl -ane ' s/\bconst\b\s*//g; print; ' < cblas.h > cblas_noconst.h	

dummy: