host-executable.mk (1213B)
1 ## Copyright 2011 Brian Swetland <swetland@frotz.net> 2 ## 3 ## Licensed under the Apache License, Version 2.0 (the "License"); 4 ## you may not use this file except in compliance with the License. 5 ## You may obtain a copy of the License at 6 ## 7 ## http://www.apache.org/licenses/LICENSE-2.0 8 ## 9 ## Unless required by applicable law or agreed to in writing, software 10 ## distributed under the License is distributed on an "AS IS" BASIS, 11 ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 ## See the License for the specific language governing permissions and 13 ## limitations under the License. 14 15 M_NAME := $(strip $(M_NAME)) 16 17 # sanity check 18 ifeq "$(M_NAME)" "" 19 $(error No module name specified) 20 endif 21 22 M_OBJS := $(addprefix $(OUT_HOST_OBJ)/$(M_NAME)/,$(M_OBJS)) 23 DEPS += $(M_OBJS:%o=%d) 24 25 ALL += $(BIN)/$(M_NAME) 26 27 $(OUT_HOST_OBJ)/$(M_NAME)/%.o: %.c 28 @$(MKDIR) 29 @echo compile $< 30 $(QUIET)$(CC) $(HOST_CFLAGS) -c $< -o $@ -MD -MT $@ -MF $(@:%o=%d) 31 32 $(BIN)/$(M_NAME): _OBJS := $(M_OBJS) 33 $(BIN)/$(M_NAME): _LIBS := $(M_LIBS) $(HOST_LIBS) 34 $(BIN)/$(M_NAME): $(M_OBJS) 35 @$(MKDIR) 36 @echo link $@ 37 $(QUIET)gcc $(HOST_CFLAGS) -o $@ $(_OBJS) $(_LIBS) 38 39 $(info module $(M_NAME)) 40 41 M_LIBS := 42 M_OBJS := 43 M_NAME :=