Rework LuCI build system
[project/luci.git] / libs / luci-lib-nixio / axTLS / httpd / Makefile
1 #
2 # Copyright (c) 2007, Cameron Rich
3 #
4 # All rights reserved.
5 #
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions are met:
8 #
9 # * Redistributions of source code must retain the above copyright notice,
10 #   this list of conditions and the following disclaimer.
11 # * Redistributions in binary form must reproduce the above copyright
12 #   notice, this list of conditions and the following disclaimer in the
13 #   documentation and/or other materials provided with the distribution.
14 # * Neither the name of the axTLS project nor the names of its
15 #   contributors may be used to endorse or promote products derived
16 #   from this software without specific prior written permission.
17 #
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
24 # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
26 # OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27 # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #
30
31 all : web_server lua
32
33 AXTLS_HOME=..
34
35 include $(AXTLS_HOME)/config/.config
36 include $(AXTLS_HOME)/config/makefile.conf
37
38 ifndef CONFIG_PLATFORM_WIN32
39
40 ifdef CONFIG_PLATFORM_CYGWIN
41 TARGET=$(AXTLS_HOME)/$(STAGE)/axhttpd.exe
42 TARGET2=$(AXTLS_HOME)/$(STAGE)/htpasswd.exe
43 else
44 TARGET=$(AXTLS_HOME)/$(STAGE)/axhttpd
45 TARGET2=$(AXTLS_HOME)/$(STAGE)/htpasswd
46 endif
47
48 ifdef CONFIG_HTTP_STATIC_BUILD
49 LIBS=$(AXTLS_HOME)/$(STAGE)/libaxtls.a
50 else
51 LIBS=-L$(AXTLS_HOME)/$(STAGE) -laxtls
52 endif
53
54 ifdef CONFIG_HTTP_BUILD_LUA
55 lua: kepler-1.1
56
57 kepler-1.1:
58         @tar xvfz   kepler-1.1-snapshot-20070521-1825.tar.gz
59         @cat kepler.patch | patch -p0
60         cd kepler-1.1; ./configure --prefix=$(CONFIG_HTTP_LUA_PREFIX) --launcher=cgi --lua-suffix= ; make install
61 else
62 lua:
63 endif
64
65 else # win32 build
66 lua:
67
68 TARGET=$(AXTLS_HOME)/$(STAGE)/axhttpd.exe
69 TARGET2=$(AXTLS_HOME)/$(STAGE)/htpasswd.exe
70
71 ifdef CONFIG_HTTP_STATIC_BUILD
72 LIBS=$(AXTLS_HOME)/$(STAGE)/axtls.static.lib $(AXTLS_HOME)\\config\\axtls.res
73 else
74 LIBS=$(AXTLS_HOME)/$(STAGE)/axtls.lib $(AXTLS_HOME)\\config\\axtls.res
75 endif
76 endif
77
78 ifndef CONFIG_AXHTTPD
79 web_server:
80 else
81
82 web_server :: $(TARGET)
83
84 ifdef CONFIG_HTTP_HAS_AUTHORIZATION
85 web_server :: $(TARGET2)
86 endif
87
88 OBJ= \
89         axhttpd.o \
90         proc.o \
91         tdate_parse.o
92
93 include $(AXTLS_HOME)/config/makefile.post
94
95 ifndef CONFIG_PLATFORM_WIN32
96
97 $(TARGET): $(OBJ) $(AXTLS_HOME)/$(STAGE)/libaxtls.a
98         $(LD) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
99 ifdef CONFIG_STRIP_UNWANTED_SECTIONS
100         $(STRIP) --remove-section=.comment $(TARGET)
101 endif
102
103 $(TARGET2): htpasswd.o $(AXTLS_HOME)/$(STAGE)/libaxtls.a
104         $(LD) $(LDFLAGS) -o $@ htpasswd.o $(LIBS)
105
106 else    # Win32
107
108 OBJ:=$(OBJ:.o=.obj)
109 %.obj : %.c
110         $(CC) $(CFLAGS) $< 
111
112 htpasswd.obj : htpasswd.c
113         $(CC) $(CFLAGS) $? 
114         
115 $(TARGET): $(OBJ)
116         $(LD) $(LDFLAGS) /out:$@ $(LIBS) $?
117
118 $(TARGET2): htpasswd.obj
119         $(LD) $(LDFLAGS) /out:$@ $(LIBS) $?
120 endif
121
122 endif       # CONFIG_AXHTTPD
123
124 clean::
125         -@rm -f $(TARGET)*
126         -@rm -fr kepler-1.1
127