-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (45 loc) · 1.83 KB
/
Copy pathMakefile
File metadata and controls
57 lines (45 loc) · 1.83 KB
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
include Makefile.config
include Makefile.inc
# library
PLATFILE = ps_plat.h
QUIESCEFILE = ps_quiesce.h
CFILES = $(wildcard *.c) $(wildcard plat/os/$(OSNAME)/*.c) $(wildcard plat/arch/$(ARCHNAME)/*.c) $(wildcard quiesce_type/$(QUIESCETYPE)/*.c)
COBJS = $(patsubst %.c,%.o,$(CFILES))
CDEPS = $(patsubst %.c,%.d,$(CFILES))
CDEPRM = $(patsubst %.c,%.d,$(CFILES))
.PHONY: config clean all
all: $(CLIB)
config:
@arch_res=`cat $(PLATFILE) | grep -w $(ARCHNAME)` || true; \
osname_res=`cat $(PLATFILE) | grep -w $(OSNAME)` || true; \
if [ -f $(PLATFILE) -a "$$arch_res" != "" -a "$$osname_res" != "" ]; then \
exit 0; \
else \
rm -f $(PLATFILE); \
echo '#ifndef PS_PLAT_H' > $(PLATFILE); \
echo '#define PS_PLAT_H' >> $(PLATFILE); \
echo '#include "plat/arch/$(ARCHNAME)/ps_arch.h"' >> $(PLATFILE); \
echo '#include "plat/os/$(OSNAME)/ps_os.h"' >> $(PLATFILE); \
echo '#endif /* PS_PLAT_H */' >> $(PLATFILE); \
fi
@quiesce_res=`cat $(QUIESCEFILE) | grep -w $(QUIESCETYPE)` || true; \
if [ -f $(QUIESCEFILE) -a "$$quiesce_res" != "" ]; then \
exit 0; \
else \
rm -f $(QUIESCEFILE); \
echo '#ifndef PS_QUIESCE_H' > $(QUIESCEFILE); \
echo '#define PS_QUIESCE_H' >> $(QUIESCEFILE); \
echo '#include "quiesce_type/$(QUIESCETYPE)/ps_quiesce_impl.h"' >> $(QUIESCEFILE); \
echo '#endif /* PS_QUIESCE_H */' >> $(QUIESCEFILE); \
fi
$(PLATFILE): config
%.o:%.c
$(CC) $(CFLAGS) -o $@ -c $<
$(CLIB):$(PLATFILE) $(COBJS)
$(AR) cr $@ $^
tests: $(CLIB)
$(MAKE) $(MAKEFLAGS) -C tests/ all
clean:
rm -f $(PLATFILE) $(COBJS) $(CLIB) $(CDEPRM)
$(MAKE) $(MAKEFLAGS) -C tests/ clean
-include $(CDEPS)