Finished BUD 1
This commit is contained in:
50
Makefile
Normal file
50
Makefile
Normal file
@@ -0,0 +1,50 @@
|
||||
# Ginxsom Blossom Server Makefile
|
||||
|
||||
CC = gcc
|
||||
CFLAGS = -Wall -Wextra -std=c99 -O2
|
||||
LIBS = -lfcgi -lsqlite3
|
||||
SRCDIR = src
|
||||
BUILDDIR = build
|
||||
TARGET = $(BUILDDIR)/ginxsom-fcgi
|
||||
|
||||
# Source files
|
||||
SOURCES = $(SRCDIR)/main.c
|
||||
OBJECTS = $(SOURCES:$(SRCDIR)/%.c=$(BUILDDIR)/%.o)
|
||||
|
||||
# Default target
|
||||
all: $(TARGET)
|
||||
|
||||
# Create build directory
|
||||
$(BUILDDIR):
|
||||
mkdir -p $(BUILDDIR)
|
||||
|
||||
# Compile object files
|
||||
$(BUILDDIR)/%.o: $(SRCDIR)/%.c | $(BUILDDIR)
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
# Link final executable
|
||||
$(TARGET): $(OBJECTS)
|
||||
$(CC) $(OBJECTS) $(LIBS) -o $@
|
||||
|
||||
# Clean build files
|
||||
clean:
|
||||
rm -rf $(BUILDDIR)
|
||||
|
||||
# Install (copy to system location)
|
||||
install: $(TARGET)
|
||||
sudo cp $(TARGET) /usr/local/bin/
|
||||
sudo chmod 755 /usr/local/bin/ginxsom-fcgi
|
||||
|
||||
# Uninstall
|
||||
uninstall:
|
||||
sudo rm -f /usr/local/bin/ginxsom-fcgi
|
||||
|
||||
# Run the FastCGI application
|
||||
run: $(TARGET)
|
||||
./$(TARGET)
|
||||
|
||||
# Debug build
|
||||
debug: CFLAGS += -g -DDEBUG
|
||||
debug: $(TARGET)
|
||||
|
||||
.PHONY: all clean install uninstall run debug
|
||||
Reference in New Issue
Block a user