2011-03-20 19:18:19 +01:00
|
|
|
############################################################################
|
2015-06-02 18:45:48 +02:00
|
|
|
# apps/examples/thttpd/content/Makefile.nxflat
|
2011-03-20 19:18:19 +01:00
|
|
|
#
|
2021-06-07 17:31:08 +02:00
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
# contributor license agreements. See the NOTICE file distributed with
|
|
|
|
# this work for additional information regarding copyright ownership. The
|
|
|
|
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
# "License"); you may not use this file except in compliance with the
|
|
|
|
# License. You may obtain a copy of the License at
|
2011-03-20 19:18:19 +01:00
|
|
|
#
|
2021-06-07 17:31:08 +02:00
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
2011-03-20 19:18:19 +01:00
|
|
|
#
|
2021-06-07 17:31:08 +02:00
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
# License for the specific language governing permissions and limitations
|
|
|
|
# under the License.
|
2011-03-20 19:18:19 +01:00
|
|
|
#
|
|
|
|
############################################################################
|
|
|
|
|
2020-05-20 06:35:03 +02:00
|
|
|
include $(APPDIR)/Make.defs
|
2020-06-10 13:34:53 +02:00
|
|
|
|
2017-07-01 16:03:54 +02:00
|
|
|
SUBDIRS = hello tasks
|
2015-06-02 18:45:48 +02:00
|
|
|
INSTALL_FILES = index.html style.css
|
2011-03-20 19:18:19 +01:00
|
|
|
|
2015-06-02 18:45:48 +02:00
|
|
|
THTTPD_DIR = $(APPDIR)/examples/thttpd
|
|
|
|
CONTENT_DIR = $(THTTPD_DIR)/content
|
|
|
|
ROMFS_DIR = $(CONTENT_DIR)/romfs
|
|
|
|
ROMFS_IMG = $(CONTENT_DIR)/romfs.img
|
2020-05-14 05:32:35 +02:00
|
|
|
ROMFS_SRC = $(CONTENT_DIR)/romfs.c
|
2015-06-02 18:45:48 +02:00
|
|
|
ROMFSCGI_DIR = $(ROMFS_DIR)/cgi-bin
|
2020-05-14 05:32:35 +02:00
|
|
|
SYMTAB_SRC = $(CONTENT_DIR)/symtab.c
|
2011-03-20 19:18:19 +01:00
|
|
|
|
|
|
|
define DIR_template
|
|
|
|
$(1)_$(2):
|
2020-03-23 18:40:44 +01:00
|
|
|
+$(Q) $(MAKE) -C $(1) $(2) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" CROSSDEV=$(CROSSDEV) CGI_DIR="$(ROMFSCGI_DIR)"
|
2011-03-20 19:18:19 +01:00
|
|
|
endef
|
|
|
|
|
2020-05-14 05:32:35 +02:00
|
|
|
all: $(ROMFS_SRC) $(SYMTAB_SRC)
|
2020-03-23 18:40:44 +01:00
|
|
|
.PHONY: all clean distclean install context depend
|
2011-03-20 19:18:19 +01:00
|
|
|
|
2020-03-23 18:40:44 +01:00
|
|
|
$(foreach DIR, $(SUBDIRS), $(eval $(call DIR_template,$(DIR),clean)))
|
|
|
|
$(foreach DIR, $(SUBDIRS), $(eval $(call DIR_template,$(DIR),install)))
|
2011-03-20 19:18:19 +01:00
|
|
|
|
|
|
|
# Install each program in the romfs directory
|
|
|
|
|
2014-09-06 16:28:24 +02:00
|
|
|
install: $(foreach DIR, $(SUBDIRS), $(DIR)_install)
|
2022-10-08 10:31:21 +02:00
|
|
|
$(Q) (for file in $(INSTALL_FILES); do \
|
2011-03-20 19:18:19 +01:00
|
|
|
install -m 0644 -D $${file} $(ROMFS_DIR)/$${file}; \
|
|
|
|
done; )
|
|
|
|
|
|
|
|
# Create the romfs.img file from the populated romfs directory
|
|
|
|
|
2020-03-23 18:40:44 +01:00
|
|
|
$(ROMFS_IMG): install
|
|
|
|
$(Q) genromfs -f $@.tmp -d $(ROMFS_DIR) -V "THTTPDTEST"
|
|
|
|
$(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
|
2011-03-20 19:18:19 +01:00
|
|
|
|
2020-05-14 05:32:35 +02:00
|
|
|
# Create the romfs.c file from the romfs.img file
|
2011-03-20 19:18:19 +01:00
|
|
|
|
2020-05-14 05:32:35 +02:00
|
|
|
$(ROMFS_SRC): $(ROMFS_IMG)
|
2022-01-27 15:32:39 +01:00
|
|
|
$(Q) (cd $(CONTENT_DIR) && echo "#include <nuttx/compiler.h>" >$@ && \
|
|
|
|
xxd -i romfs.img | sed -e "s/^unsigned char/const unsigned char aligned_data(4)/g" >>$@)
|
2011-03-20 19:18:19 +01:00
|
|
|
|
|
|
|
# Create the exported symbol table list from the derived *-thunk.S files
|
|
|
|
|
2020-05-14 05:32:35 +02:00
|
|
|
$(SYMTAB_SRC): install
|
2020-06-10 13:34:53 +02:00
|
|
|
$(Q) $(APPDIR)/tools/mksymtab.sh $(CONTENT_DIR) g_thttpd >$@.tmp
|
2020-03-23 18:40:44 +01:00
|
|
|
$(Q) $(call TESTANDREPLACEFILE, $@.tmp, $@)
|
2015-06-02 18:45:48 +02:00
|
|
|
|
|
|
|
# Nothing special needs to be done during the context phase
|
|
|
|
|
|
|
|
context:
|
|
|
|
|
2011-03-20 19:18:19 +01:00
|
|
|
# Clean each subdirectory
|
|
|
|
|
|
|
|
clean: $(foreach DIR, $(SUBDIRS), $(DIR)_clean)
|
2020-05-14 05:32:35 +02:00
|
|
|
$(call DELFILE, $(ROMFS_SRC))
|
2012-11-20 16:47:41 +01:00
|
|
|
$(call DELFILE, $(ROMFS_IMG))
|
2020-05-14 05:32:35 +02:00
|
|
|
$(call DELFILE, $(SYMTAB_SRC))
|
2020-03-23 18:40:44 +01:00
|
|
|
$(Q) rm -rf $(ROMFS_DIR)
|
2011-03-20 19:18:19 +01:00
|
|
|
|
2015-06-02 18:45:48 +02:00
|
|
|
distclean: clean
|
|
|
|
|
|
|
|
# No dependencies
|
2011-03-20 19:18:19 +01:00
|
|
|
|
2015-06-02 18:45:48 +02:00
|
|
|
depend:
|