let make recognise ports as a target
[AROS.git] / compiler / include / mmakefile
blobd075873e7f3511e309833177102f79ca99ba94a8
1 # $Id$
2 include $(TOP)/config/make.cfg
4 INCSUBDIRS :=   aros                            \
5                 aros/preprocessor               \
6                 aros/preprocessor/facilities    \
7                 aros/preprocessor/variadic      \
8                 aros/types                      \
9                 asm                             \
10                 bluetooth \
11                 c++ \
12                 c++/exec \
13                 clib \
14                 datatypes \
15                 devices \
16                 diskfont \
17                 dos \
18                 exec \
19                 gadgets \
20                 graphics \
21                 hardware \
22                 hardware/cpu \
23                 hardware/efi \
24                 hardware/pic \
25                 hidd \
26                 intuition \
27                 irda \
28                 libcore                         \
29                 libraries \
30                 midi \
31                 pragmas \
32                 prefs \
33                 proto \
34                 resources \
35                 rexx \
36                 SDI \
37         scsi \
38                 utility \
39                 workbench
41 INCLUDES      := $(foreach d,$(INCSUBDIRS),$(wildcard $(d)/*.h) $(wildcard $(d)/*.hpp)) $(wildcard *.h)
42 ARCHINCDIR    := $(SRCDIR)/arch/$(CPU)-$(ARCH)/include/
43 ARCH_INCLUDES := $(subst $(ARCHINCDIR),,$(foreach d,$(addprefix $(ARCHINCDIR),$(INCSUBDIRS)),$(wildcard $(d)/*.h) $(wildcard $(d)/*.hpp)))
44 INCLUDES      := $(filter-out $(ARCH_INCLUDES),$(INCLUDES))
45 DEST_INCLUDES := $(foreach f,$(INCLUDES),$(AROS_INCLUDES)/$(f))
46 GEN_INCLUDES  := $(foreach f,$(INCLUDES),$(GENINCDIR)/$(f))
47 INCL_DIRS     := $(foreach dir,$(INCSUBDIRS),$(AROS_INCLUDES)/$(dir)) \
48                  $(foreach dir,$(INCSUBDIRS),$(GENINCDIR)/$(dir))
50 #MM- includes : includes-generate
51 #MM- includes-generate : includes-generate-deps
52 #MM- includes-generate-deps : includes-copy includes-$(ARCH)-$(CPU)
53 #MM- includes-copy : compiler-includes includes-copy-$(ARCH)-$(CPU)
55 #MM- includes-$(ARCH)-$(CPU) : \
56 #MM     includes-copy-$(ARCH)-$(CPU) \
57 #MM     includes-generate-$(ARCH)-$(CPU)
58 #MM- includes-generate-$(ARCH)-$(CPU) : includes-copy-$(ARCH)-$(CPU)
59 #MM- includes-copy-$(ARCH)-$(CPU) :
61 #MM
62 compiler-includes : setup $(DEST_INCLUDES) $(GEN_INCLUDES)
64 $(AROS_INCLUDES)/%.h : %.h
65         @$(ECHO) "Copying    C   includes to $(AROS_INCLUDES)..."
66         @$(CP) $< $@
68 $(GENINCDIR)/%.h : %.h
69         @$(ECHO) "Copying    C   includes to $(GENINCDIR)..."
70         @$(CP) $< $@
72 $(AROS_INCLUDES)/%.hpp : %.hpp
73         @$(ECHO) "Copying    C++ includes to $(AROS_INCLUDES)..."
74         @$(CP) $< $@
76 $(GENINCDIR)/%.hpp : %.hpp
77         @$(ECHO) "Copying    C++ includes to $(GENINCDIR)..."
78         @$(CP) $< $@
80 setup : $(INCL_DIRS)
82 $(INCL_DIRS) :
83         @$(ECHO) "Creating   $@..."
84         @$(MKDIR) $@
86 #MM
87 includes-asm_h-$(CPU) : $(GENINCDIR)/aros/$(CPU)/asm.h
89 .PHONY : includes-asm_h-$(CPU)
91 $(OBJDIR)/asm.s : asm.c | $(OBJDIR)
92         @$(ECHO) "Compiling  $<..."
93         @$(TARGET_CC) $(CFLAGS) $(PRIV_EXEC_INCLUDES) $(PRIV_KERNEL_INCLUDES) -S $< -o $@
95 $(GENINCDIR)/aros/$(CPU)/asm.h : $(OBJDIR)/asm.s | $(GENINCDIR)/aros/$(AROS_TARGET_CPU)
96         @$(ECHO) Generating $@...
97         @grep "^[/#][*d]" $< | sed s/[$$]//g >$@
99 $(OBJDIR) :
100         @$(MKDIR) $@
102 $(GENINCDIR)/aros/$(CPU) :
103         @$(MKDIR) $@
106 clean :
107         -$(RM) $(AROS_INCLUDES) $(GENINCDIR)