1#
2# Copyright (c) 2013 No Face Press, LLC
3# License http://opensource.org/licenses/mit-license.php MIT License
4#
5
6# For codesign to work in non-interactive mode, unlock login keychain:
7# security unlock ~/Library/Keychains/login.keychain
8# See e.g. http://lists.apple.com/archives/apple-cdsa/2008/Jan/msg00027.html
9
10# Civetweb features
11WITH_LUA = 1
12
13PACKAGE = Civetweb
14BUILD_DIR = out
15
16CFLAGS += -DUSE_COCOA -DENABLE_CREATE_CONFIG_FILE -mmacosx-version-min=10.4 -ObjC -arch i386 -arch x86_64
17LDFLAGS += -framework Cocoa
18
19DMG_DIR = $(BUILD_DIR)/dmg
20CONTENTS_DIR = $(DMG_DIR)/$(PACKAGE).app/Contents
21RESOURCES_DIR = $(CONTENTS_DIR)/Resources
22OSXBIN_DIR = $(CONTENTS_DIR)/MacOS
23
24CIVETWEB_VERSION = $(shell perl -lne '/define\s+CIVETWEB_VERSION\s+"(\S+)"/ and print $$1' include/civetweb.h)
25ZIPFILENAME = $(PACKAGE)-$(CIVETWEB_VERSION).zip
26
27include Makefile
28
29package: build
30	@rm -rf $(DMG_DIR)
31	install -d -m 755 $(CONTENTS_DIR) $(RESOURCES_DIR) $(OSXBIN_DIR)
32	install -m 644 resources/Info.plist $(CONTENTS_DIR)/
33	install -m 644 resources/civetweb_*.png resources/civetweb.icns $(RESOURCES_DIR)/
34	install -m 644 resources/itworks.html $(OSXBIN_DIR)/index.html
35	install -m 644 resources/civetweb_64x64.png $(OSXBIN_DIR)/
36	install -m 755 $(CPROG) $(OSXBIN_DIR)/$(PACKAGE)
37	install -m 644 docs/Installing.md $(DMG_DIR)/Installing.txt
38	install -m 644 LICENSE.md $(DMG_DIR)/License.txt
39	rm -rf $(ZIPFILENAME)
40	cd $(DMG_DIR) && zip -r ../../$(ZIPFILENAME) .
41
42.PHONY: package
43